dm-zoned: extend the way of exposing zoned block device
Subsystems (2)
RFC PATCH 1/1 dm-zoned: extend the way of exposing zoned block device
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned block device(ZBC) as a regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zones and the performance may be constrained.
By putting metadata(also buffering random writes) in separated device we can get more flexibility and potential performance improvement e.g by storing metadata in faster device like persistent memory.
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)
Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separated metadata device based on md framework.
--- drivers/md/dm-zoned-metadata.c | 6 +++--- drivers/md/dm-zoned-target.c | 15 +++++++++++++-- drivers/md/dm-zoned.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-)
drivers/md/dm-zoned-metadata.c +3 -3
@@ -439,7 +439,7 @@ static struct dmz_mblock *dmz_get_mblock_slow(struct dmz_metadata *zmd,/* Submit read BIO */ bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_READ ,REQ_META |REQ_PRIO );
@@ -593,7 +593,7 @@ static int dmz_write_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk,set_bit (DMZ_META_WRITING , &mblk->state); bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_WRITE ,REQ_META |REQ_PRIO );
@@ -620,7 +620,7 @@ static int dmz_rdwr_block(struct dmz_metadata *zmd, int op, sector_t block,return -ENOMEM ; bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev);bio_set_op_attrs (bio, op,REQ_SYNC |REQ_META |REQ_PRIO );bio_add_page (bio, page,DMZ_BLOCK_SIZE ,0 ); ret =submit_bio_wait (bio);
drivers/md/dm-zoned-target.c +13 -2
@@ -39,6 +39,7 @@ struct dm_chunk_work {*/ struct dmz_target {struct dm_dev *ddev; +struct dm_dev *metadata_dev;unsigned long flags;
@@ -701,6 +702,7 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path) goto err; } + dev->meta_bdev = dmz->metadata_dev->bdev; dev->bdev = dmz->ddev->bdev; (void )bdevname (dev->bdev, dev->name);
@@ -761,7 +763,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv)int ret;/* Check arguments */ -if (argc !=1 ) { +if (argc !=2 ) { ti->error ="Invalid argument count" ;return -EINVAL ; }
@@ -774,8 +776,16 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) } ti->private = dmz; +/* Get the metadata block device */ + ret =dm_get_device (ti, argv[0 ],dm_table_get_mode (ti->table), + &dmz->metadata_dev); +if (ret) { + dmz->metadata_dev =NULL ; + goto err; + } +/* Get the target zoned block device */ - ret =dmz_get_zoned_device (ti, argv[0 ]); + ret =dmz_get_zoned_device (ti, argv[1 ]);if (ret) { dmz->ddev =NULL ; goto err;
@@ -856,6 +866,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) err_dev:dmz_put_zoned_device (ti); err: +dm_put_device (ti, dmz->metadata_dev);kfree (dmz);return ret;
drivers/md/dm-zoned.h +1 -0
@@ -50,6 +50,7 @@*/ struct dmz_dev {struct block_device *bdev; +struct block_device *meta_bdev;char name[BDEVNAME_SIZE ];
Signature · 1 line
2.9.5
Quoted 12 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned block device(ZBC) as a regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zones and the performance may be constrained.
By putting metadata(also buffering random writes) in separated device we can get more flexibility and potential performance improvement e.g by storing metadata in faster device like persistent memory.
Quoted 8 lines
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separated metadata device based on md framework.
For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this random write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Another approach worth exploring is stacking dm-zoned as is on top of a modified dm-linear with the ability to emulate conventional zones on top of a regular block device (you only need report zones method implemented). That is much easier to do. We actually hacked something like that last month to see the performance change and saw a jump from 56 MB/s to 250 MB/s for write intensive workloads (file creation on ext4). I am not so warm in this approach though as it modifies dm-linear and we want to keep it very lean and simple. Modifying dm-zoned to allow support for a device pair is a better approach I think.
Quoted 44 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/md/dm-zoned-metadata.c | 6 +++--- drivers/md/dm-zoned-target.c | 15 +++++++++++++-- drivers/md/dm-zoned.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-)drivers/md/dm-zoned-metadata.c +3
-3@@ -439,7 +439,7 @@ static struct dmz_mblock *dmz_get_mblock_slow(struct dmz_metadata *zmd,/* Submit read BIO */ bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_READ ,REQ_META |REQ_PRIO );@@ -593,7 +593,7 @@ static int dmz_write_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk,set_bit (DMZ_META_WRITING , &mblk->state); bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_WRITE ,REQ_META |REQ_PRIO );@@ -620,7 +620,7 @@ static int dmz_rdwr_block(struct dmz_metadata *zmd, int op, sector_t block,return -ENOMEM ; bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev);bio_set_op_attrs (bio, op,REQ_SYNC |REQ_META |REQ_PRIO );bio_add_page (bio, page,DMZ_BLOCK_SIZE ,0 ); ret =submit_bio_wait (bio);drivers/md/dm-zoned-target.c +0
-0
drivers/md/dm-zoned-target.c struct dm_chunk_work { · line 42
Quoted 4 lines
drivers/md/dm-zoned-target.c +1
-0@@ -39,6 +39,7 @@ struct dm_chunk_work {*/ struct dmz_target {struct dm_dev *ddev; +struct dm_dev *metadata_dev;
This naming would be confusing as it implies metadata only. If you also want to move the random write zones to a regular device, then I would suggest names like:
ddev -> zoned_bdev (the zoned device, e.g. SMR disk) metadata_dev -> reg_bdev (regular block device, e.g. an SSD)
The metadata+random write (fake) zones space can use the regular block device, and all sequential zones are assumed to be on the zoned device. Care must be taken to handle the case of a zoned device that has conventional zones: these could be used as is, not needing any reclaim, so potentially contributing to further optimization.
Quoted 59 lines
drivers/md/dm-zoned-target.c +12
-2unsigned long flags;@@ -701,6 +702,7 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path) goto err; } + dev->meta_bdev = dmz->metadata_dev->bdev; dev->bdev = dmz->ddev->bdev; (void )bdevname (dev->bdev, dev->name);@@ -761,7 +763,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv)int ret;/* Check arguments */ -if (argc !=1 ) { +if (argc !=2 ) { ti->error ="Invalid argument count" ;return -EINVAL ; }@@ -774,8 +776,16 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) } ti->private = dmz; +/* Get the metadata block device */ + ret =dm_get_device (ti, argv[0 ],dm_table_get_mode (ti->table), + &dmz->metadata_dev); +if (ret) { + dmz->metadata_dev =NULL ; + goto err; + } +/* Get the target zoned block device */ - ret =dmz_get_zoned_device (ti, argv[0 ]); + ret =dmz_get_zoned_device (ti, argv[1 ]);if (ret) { dmz->ddev =NULL ; goto err;@@ -856,6 +866,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) err_dev:dmz_put_zoned_device (ti); err: +dm_put_device (ti, dmz->metadata_dev);kfree (dmz);return ret;drivers/md/dm-zoned.h +1
-0@@ -50,6 +50,7 @@*/ struct dmz_dev {struct block_device *bdev; +struct block_device *meta_bdev;char name[BDEVNAME_SIZE ];
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 22 lines · Damien Le Moal
Quoted 12 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned block device(ZBC) as a regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zones and the performance may be constrained.
By putting metadata(also buffering random writes) in separated device we can get more flexibility and potential performance improvement e.g by storing metadata in faster device like persistent memory.Quoted 8 lines
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separated metadata device based on md framework.
Quoted 7 lines
For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this random write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Indeed.
I'll try to implement zone emulation next version.
Quoted 4 lines
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Do you mean the check in device_area_is_invalid()?
320 /*
321 * If the target is mapped to zoned block device(s), check 322 * that the zones are not partially mapped. 323 */
324 if (bdev_zoned_model(bdev) != BLK_ZONED_NONE) {
Quoted 63 lines
Another approach worth exploring is stacking dm-zoned as is on top of a modified dm-linear with the ability to emulate conventional zones on top of a regular block device (you only need report zones method implemented). That is much easier to do. We actually hacked something like that last month to see the performance change and saw a jump from 56 MB/s to 250 MB/s for write intensive workloads (file creation on ext4). I am not so warm in this approach though as it modifies dm-linear and we want to keep it very lean and simple. Modifying dm-zoned to allow support for a device pair is a better approach I think.
Quoted 44 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/md/dm-zoned-metadata.c | 6 +++--- drivers/md/dm-zoned-target.c | 15 +++++++++++++-- drivers/md/dm-zoned.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-)drivers/md/dm-zoned-metadata.c +3
-3@@ -439,7 +439,7 @@ static struct dmz_mblock *dmz_get_mblock_slow(struct dmz_metadata *zmd,/* Submit read BIO */ bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_READ ,REQ_META |REQ_PRIO );@@ -593,7 +593,7 @@ static int dmz_write_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk,set_bit (DMZ_META_WRITING , &mblk->state); bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_WRITE ,REQ_META |REQ_PRIO );@@ -620,7 +620,7 @@ static int dmz_rdwr_block(struct dmz_metadata *zmd, int op, sector_t block,return -ENOMEM ; bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev);bio_set_op_attrs (bio, op,REQ_SYNC |REQ_META |REQ_PRIO );bio_add_page (bio, page,DMZ_BLOCK_SIZE ,0 ); ret =submit_bio_wait (bio);drivers/md/dm-zoned-target.c +0
-0drivers/md/dm-zoned-target.c struct dm_chunk_work { · line 42
Quoted 4 lines
drivers/md/dm-zoned-target.c +1
-0@@ -39,6 +39,7 @@ struct dm_chunk_work {*/ struct dmz_target {struct dm_dev *ddev; +struct dm_dev *metadata_dev;This naming would be confusing as it implies metadata only. If you also want to move the random write zones to a regular device, then I would suggest names like:
Quoted 3 lines
ddev ->
zoned_bdev(the zoned device, e.g. SMR disk)metadata_dev->reg_bdev(regular block device, e.g. an SSD)
Will update.
Quoted 4 lines
The metadata+random write (fake) zones space can use the regular block device, and all sequential zones are assumed to be on the zoned device. Care must be taken to handle the case of a zoned device that has conventional zones: these could be used as is, not needing any reclaim,
Agree, that won't make things too complicate.
Thank you for all the suggestions.
Regards,
Bob
Quoted 61 lines
so potentially contributing to further optimization.
Quoted 59 lines
drivers/md/dm-zoned-target.c +12
-2unsigned long flags;@@ -701,6 +702,7 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path) goto err; } + dev->meta_bdev = dmz->metadata_dev->bdev; dev->bdev = dmz->ddev->bdev; (void )bdevname (dev->bdev, dev->name);@@ -761,7 +763,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv)int ret;/* Check arguments */ -if (argc !=1 ) { +if (argc !=2 ) { ti->error ="Invalid argument count" ;return -EINVAL ; }@@ -774,8 +776,16 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) } ti->private = dmz; +/* Get the metadata block device */ + ret =dm_get_device (ti, argv[0 ],dm_table_get_mode (ti->table), + &dmz->metadata_dev); +if (ret) { + dmz->metadata_dev =NULL ; + goto err; + } +/* Get the target zoned block device */ - ret =dmz_get_zoned_device (ti, argv[0 ]); + ret =dmz_get_zoned_device (ti, argv[1 ]);if (ret) { dmz->ddev =NULL ; goto err;@@ -856,6 +866,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) err_dev:dmz_put_zoned_device (ti); err: +dm_put_device (ti, dmz->metadata_dev);kfree (dmz);return ret;drivers/md/dm-zoned.h +1
-0@@ -50,6 +50,7 @@*/ struct dmz_dev {struct block_device *bdev; +struct block_device *meta_bdev;char name[BDEVNAME_SIZE ];
Quoted 165 lines
-----Original Message-----
From: [email protected] <linux-block- [email protected]> On Behalf Of Bob Liu
Sent: Wednesday, January 8, 2020 8:46 AM
To: Damien Le Moal <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Dmitry Fomichev <[email protected]>; [email protected]; [email protected]
Subject: Re: [RFC PATCH] dm-zoned: extend the way of exposing zoned block deviceQuoted 5 lines · Damien Le Moal
Quoted 4 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned blockdevice(ZBC) as a
Quoted 3 lines
Quoted 3 lines
regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zonesand the
Quoted 2 lines
Quoted 2 lines
performance may be constrained.
By putting metadata(also buffering random writes) in separated devicewe can get
Quoted 1 line
Quoted 1 line
more flexibility and potential performance improvement e.g by storing
metadata
Quoted 9 lines
Quoted 9 lines
in faster device like persistent memory.
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separatedmetadata
Quoted 5 lines
Quoted 1 line
device based on md framework.
For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this
random
Quoted 4 lines
write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Indeed.
I'll try to implement zone emulation next version.Quoted 4 lines
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Do you mean the check in
device_area_is_invalid()?320 /*
321 * If the target is mapped to zoned block device(s), check 322 * that the zones are not partially mapped. 323 */324 if (
bdev_zoned_model(bdev)!=BLK_ZONED_NONE) {Quoted 11 lines
Another approach worth exploring is stacking dm-zoned as is on top of a modified dm-linear with the ability to emulate conventional zones on top of a regular block device (you only need report zones method implemented). That is much easier to do. We actually hacked something like that last month to see the performance change and saw a jump from 56 MB/s to 250 MB/s for write intensive workloads (file creation on ext4). I am not so warm in this approach though as it modifies dm-linear and we want to keep it very lean and simple. Modifying dm-zoned to allow support for a device pair is a better approach I think.
Quoted 1 line
Quoted 8 lines
drivers/md/dm-zoned-
Quoted 8 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/md/dm-zoned-metadata.c | 6 +++--- drivers/md/dm-zoned-target.c | 15 +++++++++++++-- drivers/md/dm-zoned.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-)drivers/md/dm-zoned- renamed from drivers/md/dm-zoned-metadata.c +0
-0
metadata.cQuoted 4 lines
drivers/md/dm-zoned-metadata.c static struct dmz_mblock
Quoted 4 lines
index 22b3cb0..89cd554 100644
drivers/md/dm-zoned-metadata.c +0
-0@@ -439,7 +439,7 @@ static struct dmz_mblock*dmz_get_mblock_slow(struct
dmz_metadata*zmd,Quoted 9 lines
drivers/md/dm-zoned-metadata.c static int dmz_write_mblock(struct dmz_metadata
Quoted 9 lines
drivers/md/dm-zoned-metadata.c +1
-1/* Submit read BIO */ bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_READ ,REQ_META |REQ_PRIO );@@ -593,7 +593,7 @@ static int dmz_write_mblock(struct dmz_metadata*zmd, struct
dmz_mblock*mblk,Quoted 9 lines
drivers/md/dm-zoned-metadata.c static int dmz_rdwr_block(struct dmz_metadata
Quoted 9 lines
drivers/md/dm-zoned-metadata.c +1
-1set_bit (DMZ_META_WRITING , &mblk->state); bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_WRITE ,REQ_META |REQ_PRIO );@@ -620,7 +620,7 @@ static int dmz_rdwr_block(struct dmz_metadata*zmd, int op,
sector_tblock,Quoted 9 lines
drivers/md/dm-zoned-
Quoted 9 lines
drivers/md/dm-zoned-metadata.c +1
-1return -ENOMEM ; bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev);bio_set_op_attrs (bio, op,REQ_SYNC |REQ_META |REQ_PRIO );bio_add_page (bio, page,DMZ_BLOCK_SIZE ,0 ); ret =submit_bio_wait (bio);drivers/md/dm-zoned- renamed from drivers/md/dm-zoned-target.c +0
-0
target.cQuoted 13 lines
drivers/md/dm-zoned-target.c struct dm_chunk_work { · line 42
Quoted 8 lines
index 70a1063..55c64fe 100644
drivers/md/dm-zoned-target.c +1
-0@@ -39,6 +39,7 @@ struct dm_chunk_work {*/ struct dmz_target {struct dm_dev *ddev; +struct dm_dev *metadata_dev;This naming would be confusing as it implies metadata only. If you also want to move the random write zones to a regular device, then I would suggest names like:
Quoted 3 lines
ddev ->
zoned_bdev(the zoned device, e.g. SMR disk)metadata_dev->reg_bdev(regular block device, e.g. an SSD)Will update.
Quoted 4 lines
The metadata+random write (fake) zones space can use the regular block device, and all sequential zones are assumed to be on the zoned device. Care must be taken to handle the case of a zoned device that has conventional zones: these could be used as is, not needing any reclaim,
Agree, that won't make things too complicate.
Thank you for all the suggestions.Regards,
BobQuoted 6 lines
so potentially contributing to further optimization.
drivers/md/dm-zoned-target.c static int dmz_get_zoned_device(struct dm_target
Quoted 4 lines
drivers/md/dm-zoned-target.c +0
-0unsigned long flags;@@ -701,6 +702,7 @@ static int dmz_get_zoned_device(struct dm_target*ti, char *path)
Quoted 8 lines
drivers/md/dm-zoned-target.c static int dmz_ctr(struct dm_target *ti, unsigned
Quoted 8 lines
drivers/md/dm-zoned-target.c +1
-0goto err; } + dev->meta_bdev = dmz->metadata_dev->bdev; dev->bdev = dmz->ddev->bdev; (void )bdevname (dev->bdev, dev->name);@@ -761,7 +763,7 @@ static int dmz_ctr(struct dm_target *ti, unsignedint argc, char **argv)
Quoted 8 lines
Quoted 8 lines
drivers/md/dm-zoned-target.c static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) · line 769
Quoted 8 lines
drivers/md/dm-zoned-target.c +1
-1int ret;/* Check arguments */ -if (argc !=1 ) { +if (argc !=2 ) { ti->error ="Invalid argument count" ;return -EINVAL ; }
I like the idea to have an additional device in dm-zoned as the source of random zones as opposed to using block range concatenation via dm-linear. But, shouldn't we retain the possibility to use just the conventional zones that exist on the drive? This seems necessary for backwards compatibility. In the code above, if the arg count is one, the processing probably should fall back to the existing way of using drive's conventional zones.
Quoted 41 lines
Quoted 1 line
drivers/md/dm-zoned-target.c static int dmz_ctr(struct dm_target *ti, unsigned
Quoted 1 line
drivers/md/dm-zoned-target.c +0
-0@@ -774,8 +776,16 @@ static int dmz_ctr(struct dm_target *ti, unsignedint argc, char **argv)
Quoted 18 lines
drivers/md/dm-zoned-target.c static int dmz_ctr(struct dm_target *ti, unsigned
Quoted 18 lines
drivers/md/dm-zoned-target.c +9
-1} ti->private = dmz; +/* Get the metadata block device */ + ret =dm_get_device (ti, argv[0 ],dm_table_get_mode (ti->table), + &dmz->metadata_dev); +if (ret) { + dmz->metadata_dev =NULL ; + goto err; + } +/* Get the target zoned block device */ - ret =dmz_get_zoned_device (ti, argv[0 ]); + ret =dmz_get_zoned_device (ti, argv[1 ]);if (ret) { dmz->ddev =NULL ; goto err;@@ -856,6 +866,7 @@ static int dmz_ctr(struct dm_target *ti, unsignedint argc, char **argv)
Quoted 20 lines
Quoted 20 lines
drivers/md/dm-zoned-target.c +1
-0err_dev:dmz_put_zoned_device (ti); err: +dm_put_device (ti, dmz->metadata_dev);kfree (dmz);return ret;drivers/md/dm-zoned.h +1
-0@@ -50,6 +50,7 @@*/ struct dmz_dev {struct block_device *bdev; +struct block_device *meta_bdev;char name[BDEVNAME_SIZE ];
Quoted 167 lines · Dmitry Fomichev
Quoted 167 lines
-----Original Message-----
From: [email protected] <linux-block- [email protected]> On Behalf Of Bob Liu
Sent: Wednesday, January 8, 2020 8:46 AM
To: Damien Le Moal <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Dmitry Fomichev <[email protected]>; [email protected]; [email protected]
Subject: Re: [RFC PATCH] dm-zoned: extend the way of exposing zoned block deviceQuoted 5 lines · Damien Le Moal
Quoted 4 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned blockdevice(ZBC) as a
Quoted 3 lines
Quoted 3 lines
regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zonesand the
Quoted 2 lines
Quoted 2 lines
performance may be constrained.
By putting metadata(also buffering random writes) in separated devicewe can get
Quoted 1 line
Quoted 1 line
more flexibility and potential performance improvement e.g by storing
metadata
Quoted 9 lines
Quoted 9 lines
in faster device like persistent memory.
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separatedmetadata
Quoted 5 lines
Quoted 1 line
device based on md framework.
For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this
random
Quoted 4 lines
write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Indeed.
I'll try to implement zone emulation next version.Quoted 4 lines
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Do you mean the check in
device_area_is_invalid()?320 /*
321 * If the target is mapped to zoned block device(s), check 322 * that the zones are not partially mapped. 323 */324 if (
bdev_zoned_model(bdev)!=BLK_ZONED_NONE) {Quoted 11 lines
Another approach worth exploring is stacking dm-zoned as is on top of a modified dm-linear with the ability to emulate conventional zones on top of a regular block device (you only need report zones method implemented). That is much easier to do. We actually hacked something like that last month to see the performance change and saw a jump from 56 MB/s to 250 MB/s for write intensive workloads (file creation on ext4). I am not so warm in this approach though as it modifies dm-linear and we want to keep it very lean and simple. Modifying dm-zoned to allow support for a device pair is a better approach I think.
Quoted 1 line
Quoted 8 lines
drivers/md/dm-zoned-
Quoted 8 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/md/dm-zoned-metadata.c | 6 +++--- drivers/md/dm-zoned-target.c | 15 +++++++++++++-- drivers/md/dm-zoned.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-)drivers/md/dm-zoned- renamed from drivers/md/dm-zoned-metadata.c +0
-0
metadata.cQuoted 4 lines
drivers/md/dm-zoned-metadata.c static struct dmz_mblock
Quoted 4 lines
index 22b3cb0..89cd554 100644
drivers/md/dm-zoned-metadata.c +0
-0@@ -439,7 +439,7 @@ static struct dmz_mblock*dmz_get_mblock_slow(struct
dmz_metadata*zmd,Quoted 9 lines
drivers/md/dm-zoned-metadata.c static int dmz_write_mblock(struct dmz_metadata
Quoted 9 lines
drivers/md/dm-zoned-metadata.c +1
-1/* Submit read BIO */ bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_READ ,REQ_META |REQ_PRIO );@@ -593,7 +593,7 @@ static int dmz_write_mblock(struct dmz_metadata*zmd, struct
dmz_mblock*mblk,Quoted 9 lines
drivers/md/dm-zoned-metadata.c static int dmz_rdwr_block(struct dmz_metadata
Quoted 9 lines
drivers/md/dm-zoned-metadata.c +1
-1set_bit (DMZ_META_WRITING , &mblk->state); bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_WRITE ,REQ_META |REQ_PRIO );@@ -620,7 +620,7 @@ static int dmz_rdwr_block(struct dmz_metadata*zmd, int op,
sector_tblock,Quoted 9 lines
drivers/md/dm-zoned-
Quoted 9 lines
drivers/md/dm-zoned-metadata.c +1
-1return -ENOMEM ; bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev);bio_set_op_attrs (bio, op,REQ_SYNC |REQ_META |REQ_PRIO );bio_add_page (bio, page,DMZ_BLOCK_SIZE ,0 ); ret =submit_bio_wait (bio);drivers/md/dm-zoned- renamed from drivers/md/dm-zoned-target.c +0
-0
target.cQuoted 13 lines
drivers/md/dm-zoned-target.c struct dm_chunk_work { · line 42
Quoted 8 lines
index 70a1063..55c64fe 100644
drivers/md/dm-zoned-target.c +1
-0@@ -39,6 +39,7 @@ struct dm_chunk_work {*/ struct dmz_target {struct dm_dev *ddev; +struct dm_dev *metadata_dev;This naming would be confusing as it implies metadata only. If you also want to move the random write zones to a regular device, then I would suggest names like:
Quoted 3 lines
ddev ->
zoned_bdev(the zoned device, e.g. SMR disk)metadata_dev->reg_bdev(regular block device, e.g. an SSD)Will update.
Quoted 4 lines
The metadata+random write (fake) zones space can use the regular block device, and all sequential zones are assumed to be on the zoned device. Care must be taken to handle the case of a zoned device that has conventional zones: these could be used as is, not needing any reclaim,
Agree, that won't make things too complicate.
Thank you for all the suggestions.Regards,
BobQuoted 6 lines
so potentially contributing to further optimization.
drivers/md/dm-zoned-target.c static int dmz_get_zoned_device(struct dm_target
Quoted 4 lines
drivers/md/dm-zoned-target.c +0
-0unsigned long flags;@@ -701,6 +702,7 @@ static int dmz_get_zoned_device(struct dm_target*ti, char *path)
Quoted 8 lines
drivers/md/dm-zoned-target.c static int dmz_ctr(struct dm_target *ti, unsigned
Quoted 8 lines
drivers/md/dm-zoned-target.c +1
-0goto err; } + dev->meta_bdev = dmz->metadata_dev->bdev; dev->bdev = dmz->ddev->bdev; (void )bdevname (dev->bdev, dev->name);@@ -761,7 +763,7 @@ static int dmz_ctr(struct dm_target *ti, unsignedint argc, char **argv)
Quoted 2 lines
Quoted 2 lines
drivers/md/dm-zoned-target.c +0
-0int ret;
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
drivers/md/dm-zoned-target.c static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) · line 769
Quoted 6 lines
drivers/md/dm-zoned-target.c +1
-1/* Check arguments */ -if (argc !=1 ) { +if (argc !=2 ) { ti->error ="Invalid argument count" ;return -EINVAL ; }I like the idea to have an additional device in dm-zoned as the source of random zones as opposed to using block range concatenation via dm-linear. But, shouldn't we retain the possibility to use just the conventional zones that exist on the drive? This seems necessary for backwards compatibility. In the code above, if the arg count is one, the processing probably should fall back to the existing way of using drive's conventional zones.
Yeah, that's better. Will update.
Thanks! -Bob
Quoted 42 lines
Quoted 41 lines
Quoted 1 line
drivers/md/dm-zoned-target.c static int dmz_ctr(struct dm_target *ti, unsigned
Quoted 1 line
drivers/md/dm-zoned-target.c +0
-0@@ -774,8 +776,16 @@ static int dmz_ctr(struct dm_target *ti, unsignedint argc, char **argv)
Quoted 18 lines
drivers/md/dm-zoned-target.c static int dmz_ctr(struct dm_target *ti, unsigned
Quoted 18 lines
drivers/md/dm-zoned-target.c +9
-1} ti->private = dmz; +/* Get the metadata block device */ + ret =dm_get_device (ti, argv[0 ],dm_table_get_mode (ti->table), + &dmz->metadata_dev); +if (ret) { + dmz->metadata_dev =NULL ; + goto err; + } +/* Get the target zoned block device */ - ret =dmz_get_zoned_device (ti, argv[0 ]); + ret =dmz_get_zoned_device (ti, argv[1 ]);if (ret) { dmz->ddev =NULL ; goto err;@@ -856,6 +866,7 @@ static int dmz_ctr(struct dm_target *ti, unsignedint argc, char **argv)
Quoted 20 lines
Quoted 20 lines
drivers/md/dm-zoned-target.c +1
-0err_dev:dmz_put_zoned_device (ti); err: +dm_put_device (ti, dmz->metadata_dev);kfree (dmz);return ret;drivers/md/dm-zoned.h +1
-0@@ -50,6 +50,7 @@*/ struct dmz_dev {struct block_device *bdev; +struct block_device *meta_bdev;char name[BDEVNAME_SIZE ];
Quoted 39 lines · Bob Liu
Quoted 22 lines · Damien Le Moal
Quoted 12 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned block device(ZBC) as a regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zones and the performance may be constrained.
By putting metadata(also buffering random writes) in separated device we can get more flexibility and potential performance improvement e.g by storing metadata in faster device like persistent memory.Quoted 8 lines
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separated metadata device based on md framework.Quoted 7 lines
For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this random write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Indeed.
I'll try to implement zone emulation next version.Quoted 4 lines
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Quoted 7 lines
Do you mean the check in
device_area_is_invalid()?320 /*
321 * If the target is mapped to zoned block device(s), check 322 * that the zones are not partially mapped. 323 */324 if (
bdev_zoned_model(bdev)!=BLK_ZONED_NONE) {
This is only to check that the mapping are zone aligned for zoned block devices. I was referring to the checks done using the device_is_zoned_model() callback in dm_table_supports_zoned_model() which restricts mappings to be *all* on top of zoned disks for targets that have the DM_TARGET_ZONED_HM feature set. That code will prevent using a regular SSD and an SMR disk for dm-zoned. A new feature (e.g. DM_TARGET_MIXED_ZONED_HM or something) will be needed.
Best regards.
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 29 lines · Damien Le Moal
Quoted 12 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned block device(ZBC) as a regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zones and the performance may be constrained.
By putting metadata(also buffering random writes) in separated device we can get more flexibility and potential performance improvement e.g by storing metadata in faster device like persistent memory.Quoted 8 lines
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separated metadata device based on md framework.For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this random write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Quoted 8 lines
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Another approach worth exploring is stacking dm-zoned as is on top of a modified dm-linear with the ability to emulate conventional zones on top of a regular block device (you only need report zones method implemented).
Looks like the only way to do this emulation is in user space tool(dm-zoned-tools). Write metadata(which contains emulated zone information constructed by dm-zoned-tools) into regular block device.
It's impossible to add code to every regular block device for emulating conventional zones.
Thanks,
Bob
Quoted 128 lines
That is much easier to do. We actually hacked something
like that last month to see the performance change and saw a jump from 56 MB/s to 250 MB/s for write intensive workloads (file creation on ext4). I am not so warm in this approach though as it modifies dm-linear and we want to keep it very lean and simple. Modifying dm-zoned to allow support for a device pair is a better approach I think.Quoted 44 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/md/dm-zoned-metadata.c | 6 +++--- drivers/md/dm-zoned-target.c | 15 +++++++++++++-- drivers/md/dm-zoned.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-)drivers/md/dm-zoned-metadata.c +3
-3@@ -439,7 +439,7 @@ static struct dmz_mblock *dmz_get_mblock_slow(struct dmz_metadata *zmd,/* Submit read BIO */ bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_READ ,REQ_META |REQ_PRIO );@@ -593,7 +593,7 @@ static int dmz_write_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk,set_bit (DMZ_META_WRITING , &mblk->state); bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io;bio_set_op_attrs (bio,REQ_OP_WRITE ,REQ_META |REQ_PRIO );@@ -620,7 +620,7 @@ static int dmz_rdwr_block(struct dmz_metadata *zmd, int op, sector_t block,return -ENOMEM ; bio->bi_iter.bi_sector =dmz_blk2sect (block); -bio_set_dev (bio, zmd->dev->bdev); +bio_set_dev (bio, zmd->dev->meta_bdev);bio_set_op_attrs (bio, op,REQ_SYNC |REQ_META |REQ_PRIO );bio_add_page (bio, page,DMZ_BLOCK_SIZE ,0 ); ret =submit_bio_wait (bio);drivers/md/dm-zoned-target.c +0
-0drivers/md/dm-zoned-target.c struct dm_chunk_work { · line 42
Quoted 4 lines
drivers/md/dm-zoned-target.c +1
-0@@ -39,6 +39,7 @@ struct dm_chunk_work {*/ struct dmz_target {struct dm_dev *ddev; +struct dm_dev *metadata_dev;This naming would be confusing as it implies metadata only. If you also want to move the random write zones to a regular device, then I would suggest names like:
ddev ->
zoned_bdev(the zoned device, e.g. SMR disk)metadata_dev->reg_bdev(regular block device, e.g. an SSD)The metadata+random write (fake) zones space can use the regular block device, and all sequential zones are assumed to be on the zoned device. Care must be taken to handle the case of a zoned device that has conventional zones: these could be used as is, not needing any reclaim, so potentially contributing to further optimization.
Quoted 59 lines
drivers/md/dm-zoned-target.c +12
-2unsigned long flags;@@ -701,6 +702,7 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path) goto err; } + dev->meta_bdev = dmz->metadata_dev->bdev; dev->bdev = dmz->ddev->bdev; (void )bdevname (dev->bdev, dev->name);@@ -761,7 +763,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv)int ret;/* Check arguments */ -if (argc !=1 ) { +if (argc !=2 ) { ti->error ="Invalid argument count" ;return -EINVAL ; }@@ -774,8 +776,16 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) } ti->private = dmz; +/* Get the metadata block device */ + ret =dm_get_device (ti, argv[0 ],dm_table_get_mode (ti->table), + &dmz->metadata_dev); +if (ret) { + dmz->metadata_dev =NULL ; + goto err; + } +/* Get the target zoned block device */ - ret =dmz_get_zoned_device (ti, argv[0 ]); + ret =dmz_get_zoned_device (ti, argv[1 ]);if (ret) { dmz->ddev =NULL ; goto err;@@ -856,6 +866,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) err_dev:dmz_put_zoned_device (ti); err: +dm_put_device (ti, dmz->metadata_dev);kfree (dmz);return ret;drivers/md/dm-zoned.h +1
-0@@ -50,6 +50,7 @@*/ struct dmz_dev {struct block_device *bdev; +struct block_device *meta_bdev;char name[BDEVNAME_SIZE ];
Quoted 34 lines · Bob Liu
Quoted 33 lines · Damien Le Moal
Quoted 12 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned block device(ZBC) as a regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zones and the performance may be constrained.
By putting metadata(also buffering random writes) in separated device we can get more flexibility and potential performance improvement e.g by storing metadata in faster device like persistent memory.Quoted 8 lines
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separated metadata device based on md framework.For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this random write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Quoted 8 lines
Quoted 4 lines
Another approach worth exploring is stacking dm-zoned as is on top of a modified dm-linear with the ability to emulate conventional zones on top of a regular block device (you only need report zones method implemented).
Looks like the only way to do this emulation is in user space tool(dm-zoned-tools). Write metadata(which contains emulated zone information constructed by dm-zoned-tools) into regular block device.
User space tool will indeed need some modifications to allow the new format. But I would not put this as "doing the emulation" since at that level, zones are only an information checked for alignment of metadata space and overall capacity of the target. With a regular disk holding the metadata, all that needs to be done is assume that this drive is ion fact composed solely of conventional zones with the same size as the larger SRM disk backend. The total set of zones "assumed" + "real zones from SMR" consitute the set of zones that dmzadm will work with for determining the overall format, while currently it only uses the set of real zones.
Quoted 1 line
It's impossible to add code to every regular block device for emulating conventional zones.
There is no need to do that. dm-zoned can emulate fake conventional zones for the regular device (disk or ssd) holding the metadata. Since conventional zones do not have any IO restriction nor do they need any zone management command (no zone reset), dm-zoned only needs to create a set of struct dm_zone for the emulated zones of the regular disk and "manually" fill the zone information. This initialization is done in dmz_init_zones(). Some changes there to create these struct dm_zone and all the remaining metadata and write buffering code should not need any change at all (modulo the different bdev reference). Do you see the idea ?
The only place that will need some care is sync processing as 2 devices will need to be issued flushes instead of one. The reference to the different bdev depending on the zone being accessed will need some care in many places too, including reclaim. But dm-kcopy being used there, this should be fairly easy.
Adding a bdevid (an index) field to struct dm_zone, together with an array of bdev pointers in struct dmz_dev, should do the trick to simplify zone-to-bdev or block-to-bdev conversions (helper functions needed for that).
Thoughts ?
Quoted 4 lines
Thanks,
Bob
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 54 lines · Damien Le Moal
Quoted 34 lines · Bob Liu
Quoted 33 lines · Damien Le Moal
Quoted 12 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned block device(ZBC) as a regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zones and the performance may be constrained.
By putting metadata(also buffering random writes) in separated device we can get more flexibility and potential performance improvement e.g by storing metadata in faster device like persistent memory.Quoted 8 lines
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separated metadata device based on md framework.For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this random write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Quoted 8 lines
Quoted 4 lines
Another approach worth exploring is stacking dm-zoned as is on top of a modified dm-linear with the ability to emulate conventional zones on top of a regular block device (you only need report zones method implemented).
Looks like the only way to do this emulation is in user space tool(dm-zoned-tools). Write metadata(which contains emulated zone information constructed by dm-zoned-tools) into regular block device.
User space tool will indeed need some modifications to allow the new format. But I would not put this as "doing the emulation" since at that level, zones are only an information checked for alignment of metadata space and overall capacity of the target. With a regular disk holding the metadata, all that needs to be done is assume that this drive is ion fact composed solely of conventional zones with the same size as the larger SRM disk backend. The total set of zones "assumed" + "real zones from SMR" consitute the set of zones that dmzadm will work with for determining the overall format, while currently it only uses the set of real zones.
Quoted 3 lines
Quoted 1 line
It's impossible to add code to every regular block device for emulating conventional zones.
There is no need to do that. dm-zoned can emulate fake conventional zones
Oh, what I intend to say is it's impossible adding "BLKREPORTZONE" to regular block device driver. We have to construct fake zone information for regular device all by dmzadm, based on current information we can get from regular device.
$ dmzadm --format `regular device` `real zoned device` --force
Quoted 15 lines
for the regular device (disk or ssd) holding the metadata. Since conventional zones do not have any IO restriction nor do they need any zone management command (no zone reset), dm-zoned only needs to create a set of struct
dm_zonefor the emulated zones of the regular disk and "manually" fill the zone information. This initialization is done indmz_init_zones(). Some changes there to create these structdm_zoneand all the remaining metadata and write buffering code should not need any change at all (modulo the different bdev reference). Do you see the idea ?The only place that will need some care is sync processing as 2 devices will need to be issued flushes instead of one. The reference to the different bdev depending on the zone being accessed will need some care in many places too, including reclaim. But dm-kcopy being used there, this should be fairly easy.
Quoted 6 lines
Adding a bdevid (an index) field to struct
dm_zone, together with an array of bdev pointers in structdmz_dev, should do the trick to simplify zone-to-bdev or block-to-bdev conversions (helper functions needed for that).Thoughts ?
Thank you for all these suggestions.
Regards,
Bob
Quoted 55 lines · Bob Liu
Quoted 54 lines · Damien Le Moal
Quoted 34 lines · Bob Liu
Quoted 33 lines · Damien Le Moal
Quoted 12 lines · Nobody
From: Bob Liu <[email protected]>
Motivation:
Now the dm-zoned device mapper target exposes a zoned block device(ZBC) as a regular block device by storing metadata and buffering random writes in conventional zones.
This way is not very flexible, there must be enough conventional zones and the performance may be constrained.
By putting metadata(also buffering random writes) in separated device we can get more flexibility and potential performance improvement e.g by storing metadata in faster device like persistent memory.Quoted 8 lines
This patch try to split the metadata of dm-zoned to an extra block device instead of zoned block device itself.
(Buffering random writes also in the todo list.)Patch is at the very early stage, just want to receive some feedback about this extension.
Another option is to create an new md-zoned device with separated metadata device based on md framework.For metadata only, it should not be hard at all to move to another conventional zone device. It will however be a little more tricky for conventional zones used for data since dm-zoned assumes that this random write space is also zoned. Moving this space to a conventional device requires implementing a zone emulation (fake zones) for the regular drive, using a zone size that matches the size of sequential zones.
Beyond this, dm-zoned also needs to be changed to accept partial drives and the dm core code to accept mixing of regular and zoned disks (that is forbidden now).
Quoted 8 lines
Quoted 4 lines
Another approach worth exploring is stacking dm-zoned as is on top of a modified dm-linear with the ability to emulate conventional zones on top of a regular block device (you only need report zones method implemented).
Looks like the only way to do this emulation is in user space tool(dm-zoned-tools). Write metadata(which contains emulated zone information constructed by dm-zoned-tools) into regular block device.
User space tool will indeed need some modifications to allow the new format. But I would not put this as "doing the emulation" since at that level, zones are only an information checked for alignment of metadata space and overall capacity of the target. With a regular disk holding the metadata, all that needs to be done is assume that this drive is ion fact composed solely of conventional zones with the same size as the larger SRM disk backend. The total set of zones "assumed" + "real zones from SMR" consitute the set of zones that dmzadm will work with for determining the overall format, while currently it only uses the set of real zones.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
It's impossible to add code to every regular block device for emulating conventional zones.
There is no need to do that. dm-zoned can emulate fake conventional zones
Oh, what I intend to say is it's impossible adding "BLKREPORTZONE" to regular block device driver. We have to construct fake zone information for regular device all by dmzadm, based on current information we can get from regular device.
OK. We are in sync. I misunderstood you. Yes, there is no need to emulate completely a zone disk at the driver level. dmzadm (and dm-zoned module) can generate a list of fake conventional zones very easily for the regular drive.
Quoted 33 lines
$ dmzadm --format `regular device` `real zoned device` --forceQuoted 15 lines
for the regular device (disk or ssd) holding the metadata. Since conventional zones do not have any IO restriction nor do they need any zone management command (no zone reset), dm-zoned only needs to create a set of struct
dm_zonefor the emulated zones of the regular disk and "manually" fill the zone information. This initialization is done indmz_init_zones(). Some changes there to create these structdm_zoneand all the remaining metadata and write buffering code should not need any change at all (modulo the different bdev reference). Do you see the idea ?The only place that will need some care is sync processing as 2 devices will need to be issued flushes instead of one. The reference to the different bdev depending on the zone being accessed will need some care in many places too, including reclaim. But dm-kcopy being used there, this should be fairly easy.
Quoted 6 lines
Adding a bdevid (an index) field to struct
dm_zone, together with an array of bdev pointers in structdmz_dev, should do the trick to simplify zone-to-bdev or block-to-bdev conversions (helper functions needed for that).Thoughts ?
Thank you for all these suggestions.
Regards,
Bob
Signature · 2 lines
Damien Le Moal Western Digital Research