All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: "dsterba@suse.cz" <dsterba@suse.cz>
Cc: 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: Tue, 28 Jun 2022 07:15:14 +0000	[thread overview]
Message-ID: <PH0PR04MB74165A85F6DAD1C596F1F61C9BB89@PH0PR04MB7416.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20220627164018.GZ20633@twin.jikos.cz

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.

  reply	other threads:[~2022-06-28  7:15 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 [this message]
2022-07-07 18:52         ` David Sterba

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=PH0PR04MB74165A85F6DAD1C596F1F61C9BB89@PH0PR04MB7416.namprd04.prod.outlook.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.