@@ -475,6 +475,7 @@ NULLB_DEVICE_ATTR(fua, bool, NULL);
NULLB_DEVICE_ATTR(rotational, bool, NULL);
NULLB_DEVICE_ATTR(badblocks_once, bool, NULL);
NULLB_DEVICE_ATTR(badblocks_partial_io, bool, NULL);
+NULLB_DEVICE_ATTR(preserves_write_order, bool, NULL);
static ssize_t nullb_device_power_show(struct config_item *item, char *page)
{
@@ -613,6 +614,7 @@ static struct configfs_attribute *nullb_device_attrs[] = {
&nullb_device_attr_no_sched,
&nullb_device_attr_poll_queues,
&nullb_device_attr_power,
+ &nullb_device_attr_preserves_write_order,
&nullb_device_attr_queue_mode,
&nullb_device_attr_rotational,
&nullb_device_attr_shared_tag_bitmap,
@@ -1979,6 +1981,7 @@ static int null_add_dev(struct nullb_device *dev)
if (dev->virt_boundary)
lim.virt_boundary_mask = PAGE_SIZE - 1;
null_config_discard(nullb, &lim);
+ lim.driver_preserves_write_order = dev->preserves_write_order;
if (dev->zoned) {
rv = null_init_zoned_dev(dev, &lim);
if (rv)
@@ -110,6 +110,7 @@ struct nullb_device {
bool shared_tag_bitmap; /* use hostwide shared tags */
bool fua; /* Support FUA */
bool rotational; /* Fake rotational device */
+ bool preserves_write_order;
};
struct nullb {
Support configuring the preserves_write_order in the null_blk driver to make it easier to test support for this attribute. Cc: Christoph Hellwig <hch@lst.de> Cc: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/block/null_blk/main.c | 3 +++ drivers/block/null_blk/null_blk.h | 1 + 2 files changed, 4 insertions(+)