public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] Btrfs-progs: use bitfield instead of integer for some variants in fs_info
Date: Wed, 26 Feb 2014 19:16:12 +0100	[thread overview]
Message-ID: <20140226181612.GG16073@twin.jikos.cz> (raw)
In-Reply-To: <530D5094.9020605@cn.fujitsu.com>

On Wed, Feb 26, 2014 at 10:25:24AM +0800, Wang Shilong wrote:
> On 02/26/2014 12:28 AM, David Sterba wrote:
> >On Tue, Feb 25, 2014 at 07:48:57PM +0800, Wang Shilong wrote:
> >>Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
> >>---
> >>  ctree.h | 8 +++++---
> >>  1 file changed, 5 insertions(+), 3 deletions(-)
> >>
> >>diff --git a/ctree.h b/ctree.h
> >>index 3cc3477..9b461af 100644
> >>--- a/ctree.h
> >>+++ b/ctree.h
> >>@@ -984,9 +984,11 @@ struct btrfs_fs_info {
> >>  	struct btrfs_fs_devices *fs_devices;
> >>  	struct list_head space_info;
> >>  	int system_allocs;
> >>-	int readonly;
> >>-	int on_restoring;
> >>-	int is_chunk_recover;
> >>+
> >>+	unsigned int readonly:1;
> >>+	unsigned int on_restoring:1;
> >>+	unsigned int is_chunk_recover:1;
> >Well, the integers are wasteful, but there's only one instance of
> >fs_info per fsck run, so it saves like 8 bytes in total. I'm not sure
> >this patch is needed.
> Originally, i wrote this patch, it is because i was going to add a new flag.
> However, that approach has been replaced by a better idea.
> 
> Anyway, this patch will be a good start, however, i don't insist on it.
> We can also change it  when we have to add another flag later.

Ok, let's keep it, as an example of the pattern 'bitfields for flags'.

      reply	other threads:[~2014-02-26 18:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25 11:48 [PATCH 1/2] Btrfs-progs: fsck: avoid overwritting existed space when initting csum tree Wang Shilong
2014-02-25 11:48 ` [PATCH 2/2] Btrfs-progs: use bitfield instead of integer for some variants in fs_info Wang Shilong
2014-02-25 16:28   ` David Sterba
2014-02-26  2:25     ` Wang Shilong
2014-02-26 18:16       ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140226181612.GG16073@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wangsl.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox