Skip to content

Commit 357deb9

Browse files
bvanasschekawasaki
authored andcommitted
null_blk: Add the preserves_write_order attribute
Support configuring the BLK_FEAT_ORDERED_HWQ flag in the null_blk driver to make it easier to test support for this feature flag. Cc: Damien Le Moal <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Bart Van Assche <[email protected]>
1 parent 1d63de8 commit 357deb9

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/block/null_blk/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ NULLB_DEVICE_ATTR(fua, bool, NULL);
475475
NULLB_DEVICE_ATTR(rotational, bool, NULL);
476476
NULLB_DEVICE_ATTR(badblocks_once, bool, NULL);
477477
NULLB_DEVICE_ATTR(badblocks_partial_io, bool, NULL);
478+
NULLB_DEVICE_ATTR(preserves_write_order, bool, NULL);
478479

479480
static ssize_t nullb_device_power_show(struct config_item *item, char *page)
480481
{
@@ -613,6 +614,7 @@ static struct configfs_attribute *nullb_device_attrs[] = {
613614
&nullb_device_attr_no_sched,
614615
&nullb_device_attr_poll_queues,
615616
&nullb_device_attr_power,
617+
&nullb_device_attr_preserves_write_order,
616618
&nullb_device_attr_queue_mode,
617619
&nullb_device_attr_rotational,
618620
&nullb_device_attr_shared_tag_bitmap,
@@ -1979,6 +1981,8 @@ static int null_add_dev(struct nullb_device *dev)
19791981
if (dev->virt_boundary)
19801982
lim.virt_boundary_mask = PAGE_SIZE - 1;
19811983
null_config_discard(nullb, &lim);
1984+
if (dev->preserves_write_order)
1985+
lim.features |= BLK_FEAT_ORDERED_HWQ;
19821986
if (dev->zoned) {
19831987
rv = null_init_zoned_dev(dev, &lim);
19841988
if (rv)

drivers/block/null_blk/null_blk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ struct nullb_device {
110110
bool shared_tag_bitmap; /* use hostwide shared tags */
111111
bool fua; /* Support FUA */
112112
bool rotational; /* Fake rotational device */
113+
bool preserves_write_order;
113114
};
114115

115116
struct nullb {

0 commit comments

Comments
 (0)