From patchwork Fri Feb 17 14:42:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9579965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 68E46600F6 for ; Fri, 17 Feb 2017 14:44:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 594E0286F4 for ; Fri, 17 Feb 2017 14:44:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E65F286F6; Fri, 17 Feb 2017 14:44:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EADCD286F4 for ; Fri, 17 Feb 2017 14:44:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934386AbdBQOoA (ORCPT ); Fri, 17 Feb 2017 09:44:00 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34999 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934311AbdBQOnz (ORCPT ); Fri, 17 Feb 2017 09:43:55 -0500 Received: by mail-wr0-f196.google.com with SMTP id q39so5486632wrb.2 for ; Fri, 17 Feb 2017 06:43:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YL6toRkLLFn5gdeVWOQf08i3k+ZsCwGsJLpsP5qeuRk=; b=m+KXI/doxB9Zd9f9IWHxBktCrfdVWLR+bsojszMOndDrFFQDVMjIJgDInYs4nNUQyP DQ/xcuiHxXNPNEBUZJ0uXzrMGhA3vR6iHROXyxM3o9s44DVvJQkVlL+iS+LD5urKdOOX nY8mxcfRiw9diGk34ZrSK0GgcUPDPSO0lf84eeGZtHZya/cgSKBbMJxvPNRbbRKpkFGb CkFrGV9JsPqofmTuN0dbupsEOKozvYTDcYwb1WEOyBRcSW2YGtCe0NHTOm/myeNz1AY6 LkorokZRH0x3Im0QTLYPOIrqTFkXsMtkcviUCinfaiLPgai1yKdZMKp9Da4+d6hSJ/ID 444A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YL6toRkLLFn5gdeVWOQf08i3k+ZsCwGsJLpsP5qeuRk=; b=TRBQYyLegvMxmFm9fYPUtf2XvqvIHUnLKkPVtnSt4kMwlrRxQIdGRfGJuGfGE/zOff Rft11Q1aYO6TL5TcZHAopqcSoeW8NXU6b/D6Kcww7EBoYOchEOnI1RPwBbQnBzbptItg 3EWwsby2KmJvaVaz2NZ8k3VTNw2azkbckRzzcBjvQwTvGQ1vRl3k3Z1WRisLwdTtzJBl 3uuN6y2bUV6jPKLKVelw4FlQDmO3qLm0mHxEy6MSeJlMuJ2jpIsXUFxmDlJNmyWIUttP Vh24Vkm2mNiDKCGlNiNB2mfhztTWwPoNWArXrah5rcDfQNuZ2L8ysg6XytlnE0z2hxa/ iGyg== X-Gm-Message-State: AMke39mw6kCwTmXk/xdXxZY3YxTWxa0dr32UfbxWNUDOiRjU80c1sAbgHeO7EE91Ax84Aw== X-Received: by 10.223.163.142 with SMTP id l14mr4809685wrb.35.1487342634434; Fri, 17 Feb 2017 06:43:54 -0800 (PST) Received: from fisk.suse.de (ivokamhome.ddns.nbis.net. [87.120.136.31]) by smtp.gmail.com with ESMTPSA id y126sm1932713wmg.19.2017.02.17.06.43.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 06:43:53 -0800 (PST) From: Nikolay Borisov X-Google-Original-From: Nikolay Borisov To: dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov Subject: [PATCH 07/38] btrfs: make btrfs_alloc_data_chunk_ondemand take btrfs_inode Date: Fri, 17 Feb 2017 16:42:58 +0200 Message-Id: <1487342609-20652-8-git-send-email-nborisov@suse.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487342609-20652-1-git-send-email-nborisov@suse.com> References: <1487342609-20652-1-git-send-email-nborisov@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Nikolay Borisov --- fs/btrfs/ctree.h | 2 +- fs/btrfs/extent-tree.c | 8 ++++---- fs/btrfs/file.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 8ab0ce65a218..76e661d00822 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2687,7 +2687,7 @@ enum btrfs_flush_state { }; int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len); -int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes); +int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes); void btrfs_free_reserved_data_space(struct inode *inode, u64 start, u64 len); void btrfs_free_reserved_data_space_noquota(struct inode *inode, u64 start, u64 len); diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 883819c5abc0..293ca5d34d44 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4135,10 +4135,10 @@ static u64 btrfs_space_info_used(struct btrfs_space_info *s_info, (may_use_included ? s_info->bytes_may_use : 0); } -int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes) +int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes) { struct btrfs_space_info *data_sinfo; - struct btrfs_root *root = BTRFS_I(inode)->root; + struct btrfs_root *root = inode->root; struct btrfs_fs_info *fs_info = root->fs_info; u64 used; int ret = 0; @@ -4148,7 +4148,7 @@ int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes) /* make sure bytes are sectorsize aligned */ bytes = ALIGN(bytes, fs_info->sectorsize); - if (btrfs_is_free_space_inode(BTRFS_I(inode))) { + if (btrfs_is_free_space_inode(inode)) { need_commit = 0; ASSERT(current->journal_info); } @@ -4281,7 +4281,7 @@ int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len) round_down(start, fs_info->sectorsize); start = round_down(start, fs_info->sectorsize); - ret = btrfs_alloc_data_chunk_ondemand(inode, len); + ret = btrfs_alloc_data_chunk_ondemand(BTRFS_I(inode), len); if (ret < 0) return ret; diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 18e5146df864..7cdaafff4764 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2747,7 +2747,7 @@ static long btrfs_fallocate(struct file *file, int mode, * * For qgroup space, it will be checked later. */ - ret = btrfs_alloc_data_chunk_ondemand(inode, alloc_end - alloc_start); + ret = btrfs_alloc_data_chunk_ondemand(BTRFS_I(inode), alloc_end - alloc_start); if (ret < 0) return ret;