Message ID | 71c65793ebc15d59e8ff4112f47df85f3ed766e3.1746734746.git.ritesh.list@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | ext4: Add multi-fsblock atomic write support with bigalloc | expand |
On Fri, May 09, 2025 at 02:20:36AM +0530, Ritesh Harjani (IBM) wrote: > Last couple of patches added the needed support for multi-fsblock atomic > writes using bigalloc. This patch ensures that filesystem advertizes the > needed atomic write unit min and max values for enabling multi-fsblock > atomic write support with bigalloc. > > Co-developed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> > Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> > Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> > --- > fs/ext4/super.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 181934499624..508ea5cff1c7 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -4442,12 +4442,12 @@ static int ext4_handle_clustersize(struct super_block *sb) > /* > * ext4_atomic_write_init: Initializes filesystem min & max atomic write units. > * @sb: super block > - * TODO: Later add support for bigalloc > */ > static void ext4_atomic_write_init(struct super_block *sb) > { > struct ext4_sb_info *sbi = EXT4_SB(sb); > struct block_device *bdev = sb->s_bdev; > + unsigned int clustersize = sb->s_blocksize; > > if (!bdev_can_atomic_write(bdev)) > return; > @@ -4455,9 +4455,12 @@ static void ext4_atomic_write_init(struct super_block *sb) > if (!ext4_has_feature_extents(sb)) > return; > > + if (ext4_has_feature_bigalloc(sb)) > + clustersize = EXT4_CLUSTER_SIZE(sb); Doesn't EXT4_CLUSTER_SIZE return EXT4_BLOCK_SIZE(sb) (aka s_blocksize) for !bigalloc filesystems? Looks fine to me otherwise Acked-by: "Darrick J. Wong" <djwong@kernel.org> --D > + > sbi->s_awu_min = max(sb->s_blocksize, > bdev_atomic_write_unit_min_bytes(bdev)); > - sbi->s_awu_max = min(sb->s_blocksize, > + sbi->s_awu_max = min(clustersize, > bdev_atomic_write_unit_max_bytes(bdev)); > if (sbi->s_awu_min && sbi->s_awu_max && > sbi->s_awu_min <= sbi->s_awu_max) { > -- > 2.49.0 > >
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 181934499624..508ea5cff1c7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4442,12 +4442,12 @@ static int ext4_handle_clustersize(struct super_block *sb) /* * ext4_atomic_write_init: Initializes filesystem min & max atomic write units. * @sb: super block - * TODO: Later add support for bigalloc */ static void ext4_atomic_write_init(struct super_block *sb) { struct ext4_sb_info *sbi = EXT4_SB(sb); struct block_device *bdev = sb->s_bdev; + unsigned int clustersize = sb->s_blocksize; if (!bdev_can_atomic_write(bdev)) return; @@ -4455,9 +4455,12 @@ static void ext4_atomic_write_init(struct super_block *sb) if (!ext4_has_feature_extents(sb)) return; + if (ext4_has_feature_bigalloc(sb)) + clustersize = EXT4_CLUSTER_SIZE(sb); + sbi->s_awu_min = max(sb->s_blocksize, bdev_atomic_write_unit_min_bytes(bdev)); - sbi->s_awu_max = min(sb->s_blocksize, + sbi->s_awu_max = min(clustersize, bdev_atomic_write_unit_max_bytes(bdev)); if (sbi->s_awu_min && sbi->s_awu_max && sbi->s_awu_min <= sbi->s_awu_max) {