From: David Sterba <dsterba@suse.cz>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: "dsterba@suse.cz" <dsterba@suse.cz>,
David Sterba <dsterba@suse.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 3/3] btrfs: use u8 type for btrfs_block_rsv::type
Date: Thu, 7 Jul 2022 20:52:09 +0200 [thread overview]
Message-ID: <20220707185209.GO15169@twin.jikos.cz> (raw)
In-Reply-To: <PH0PR04MB74165A85F6DAD1C596F1F61C9BB89@PH0PR04MB7416.namprd04.prod.outlook.com>
On Tue, Jun 28, 2022 at 07:15:14AM +0000, Johannes Thumshirn wrote:
> On 27.06.22 18:45, David Sterba wrote:
> > On Mon, Jun 27, 2022 at 06:51:30AM +0000, Johannes Thumshirn wrote:
> >> On 24.06.22 16:15, David Sterba wrote:
> >>> diff --git a/fs/btrfs/block-rsv.h b/fs/btrfs/block-rsv.h
> >>> index 0702d4087ff6..bb449c75ee4c 100644
> >>> --- a/fs/btrfs/block-rsv.h
> >>> +++ b/fs/btrfs/block-rsv.h
> >>> @@ -27,7 +27,8 @@ struct btrfs_block_rsv {
> >>> spinlock_t lock;
> >>> bool full;
> >>> bool failfast;
> >>> - unsigned short type;
> >>> + /* Block reserve type, one of BTRFS_BLOCK_RSV_* */
> >>> + u8 type;
> >>>
> >>
> >> Is there any reason to not use the enum?
> >
> > Enum would be 'int', 4 bytes to the space optimization would be
> > lost. Enum types can be shortened as
> >
> > enum btrfs_reserve type:8
> >
> > but I'm not sure it's an improvement.
> >
>
> Using an enum would give some type safety (I think -Wenum-compare is
> on by default in the kernel). Packing that enum would give us the 1 byte
> size you're looking for.
Yeah I'll go with the named enum and :8 in the structure.
prev parent reply other threads:[~2022-07-07 18:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-24 14:01 [PATCH 0/3] Cleanup short int types in block group reserve David Sterba
2022-06-24 14:01 ` [PATCH 1/3] btrfs: switch btrfs_block_rsv::full to bool David Sterba
2022-06-24 17:12 ` Antonio Pérez
2022-07-07 18:46 ` David Sterba
2022-06-24 14:01 ` [PATCH 2/3] btrfs: switch btrfs_block_rsv::failfast " David Sterba
2022-06-27 6:48 ` Johannes Thumshirn
2022-06-24 14:01 ` [PATCH 3/3] btrfs: use u8 type for btrfs_block_rsv::type David Sterba
2022-06-27 6:51 ` Johannes Thumshirn
2022-06-27 16:40 ` David Sterba
2022-06-28 7:15 ` Johannes Thumshirn
2022-07-07 18:52 ` 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=20220707185209.GO15169@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=Johannes.Thumshirn@wdc.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).