Skip to content

Commit 0f1ba5f

Browse files
damien-lemoalaxboe
authored andcommitted
zonefs: use zone write granularity as block size
Zoned block devices have different granularity constraints for write operations into sequential zones. E.g. ZBC and ZAC devices require that writes be aligned to the device physical block size while NVMe ZNS devices allow logical block size aligned write operations. To correctly handle such difference, use the device zone write granularity limit to set the block size of a zonefs volume, thus allowing the smallest possible write unit for all zoned device types. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@edc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent a805a4f commit 0f1ba5f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fs/zonefs/super.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,12 +1581,11 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent)
15811581
sb->s_time_gran = 1;
15821582

15831583
/*
1584-
* The block size is set to the device physical sector size to ensure
1585-
* that write operations on 512e devices (512B logical block and 4KB
1586-
* physical block) are always aligned to the device physical blocks,
1587-
* as mandated by the ZBC/ZAC specifications.
1584+
* The block size is set to the device zone write granularity to ensure
1585+
* that write operations are always aligned according to the device
1586+
* interface constraints.
15881587
*/
1589-
sb_set_blocksize(sb, bdev_physical_block_size(sb->s_bdev));
1588+
sb_set_blocksize(sb, bdev_zone_write_granularity(sb->s_bdev));
15901589
sbi->s_zone_sectors_shift = ilog2(bdev_zone_sectors(sb->s_bdev));
15911590
sbi->s_uid = GLOBAL_ROOT_UID;
15921591
sbi->s_gid = GLOBAL_ROOT_GID;

0 commit comments

Comments
 (0)