Re: [RFC PATCH v2 2/4] ext2: remove buffer heads from group descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 25, 2025 at 06:49:26PM -0700, Catherine Hoang wrote:
> The group descriptors are stored as an array of buffer_heads
> s_group_desc in struct ext2_sb_info. Replace these buffer heads with the
> new ext2_buffer and update the buffer functions accordingly.
> 
> Signed-off-by: Catherine Hoang <catherine.hoang@xxxxxxxxxx>
> ---
>  fs/ext2/balloc.c | 24 ++++++++++++------------
>  fs/ext2/ext2.h   |  4 ++--
>  fs/ext2/ialloc.c | 12 ++++++------
>  fs/ext2/super.c  | 10 +++++-----
>  4 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
> index b8cfab8f98b9..21dafa9ae2ea 100644
> --- a/fs/ext2/balloc.c
> +++ b/fs/ext2/balloc.c
> @@ -38,7 +38,7 @@
>  
>  struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
>  					     unsigned int block_group,
> -					     struct buffer_head ** bh)
> +					     struct ext2_buffer ** buf)
>  {
>  	unsigned long group_desc;
>  	unsigned long offset;
> @@ -63,8 +63,8 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
>  	}
>  
>  	desc = (struct ext2_group_desc *) sbi->s_group_desc[group_desc]->b_data;
> -	if (bh)
> -		*bh = sbi->s_group_desc[group_desc];
> +	if (buf)
> +		*buf = sbi->s_group_desc[group_desc];

Yeah, these patches would be less long if you'd stuck with the "bh"
name.  I hate how this sounds like busy work, but please put it back to
make reviewing easier.

> @@ -1109,10 +1109,10 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  	}
>  	for (i = 0; i < db_count; i++) {
>  		block = descriptor_loc(sb, logic_sb_block, i);
> -		sbi->s_group_desc[i] = sb_bread(sb, block);
> +		sbi->s_group_desc[i] = ext2_read_buffer(sb, block);

ext2_read_buffer can return an ERR_PTR, you need to check for errors
here, not just null pointers.

--D




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux