From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:51017 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbdBNP4g (ORCPT ); Tue, 14 Feb 2017 10:56:36 -0500 Date: Tue, 14 Feb 2017 16:56:06 +0100 From: David Sterba To: Liu Bo Cc: linux-btrfs@vger.kernel.org, David Sterba Subject: Re: [PATCH] Btrfs: use helper to get used bytes of space_info Message-ID: <20170214155606.GO16928@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <1487029341-12911-1-git-send-email-bo.li.liu@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1487029341-12911-1-git-send-email-bo.li.liu@oracle.com> Sender: linux-btrfs-owner@vger.kernel.org List-ID: On Mon, Feb 13, 2017 at 03:42:21PM -0800, Liu Bo wrote: > This uses a helper instead of open code around used byte of space_info > everywhere. > > Signed-off-by: Liu Bo Reviewed-by: David Sterba > --- > fs/btrfs/extent-tree.c | 42 ++++++++++++++++++++---------------------- > 1 file changed, 20 insertions(+), 22 deletions(-) > > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c > index 097fa4a..b2b0b82 100644 > --- a/fs/btrfs/extent-tree.c > +++ b/fs/btrfs/extent-tree.c > @@ -4118,6 +4118,15 @@ u64 btrfs_get_alloc_profile(struct btrfs_root *root, int data) > return ret; > } > > +static u64 btrfs_space_info_used(struct btrfs_space_info *s_info, > + bool may_used_included) > +{ > + ASSERT(s_info); > + return s_info->bytes_used + s_info->bytes_reserved + > + s_info->bytes_pinned + s_info->bytes_readonly + > + ((may_used_included) ? s_info->bytes_may_use : 0); I'd rename may_used_included to 'may_use_included' so it matches bytes_may_use.