remove REQ_OP_WRITE_SAME v2
Subsystems (9)
Now that we are using REQ_OP_WRITE_ZEROES for all zeroing needs in the kernel there is very little use left for REQ_OP_WRITE_SAME. We only have two callers left, and both just export optional protocol features to remote systems: DRBD and the target code.
For the target code the only real use case was zeroing offload, which is kept with this series, and for DRBD I suspect the same based on the usage.
git://git.infradead.org/users/hch/block.git delete-write-same
Gitweb:
http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/delete-write-same
Changes since v2:
- split up
- rebased ontop of five years of kernel change, including the totally pointless addition of REQ_OP_WRITE_SAME in rnbd
Changes from RFC:
- add zeroing offload for the SCSI target.
Diffstat:
block/blk-core.c | 13 ----- block/blk-lib.c | 91 ------------------------------------- block/blk-merge.c | 40 ---------------- block/blk-settings.c | 16 ------ block/blk-sysfs.c | 8 --- block/blk-zoned.c | 1 block/blk.h | 1 block/bounce.c | 3 - drivers/block/drbd/drbd_main.c | 31 +----------- drivers/block/drbd/drbd_nl.c | 72 ----------------------------- drivers/block/drbd/drbd_receiver.c | 47 ++----------------- drivers/block/drbd/drbd_req.c | 1 drivers/block/drbd/drbd_worker.c | 5 -- drivers/block/rnbd/rnbd-clt.c | 7 -- drivers/block/rnbd/rnbd-clt.h | 1 drivers/block/rnbd/rnbd-proto.h | 6 -- drivers/block/rnbd/rnbd-srv.c | 3 - drivers/md/dm-core.h | 1 drivers/md/dm-crypt.c | 1 drivers/md/dm-ebs-target.c | 1 drivers/md/dm-io.c | 22 -------- drivers/md/dm-linear.c | 1 drivers/md/dm-mpath.c | 1 drivers/md/dm-rq.c | 3 - drivers/md/dm-stripe.c | 4 - drivers/md/dm-table.c | 29 ----------- drivers/md/dm-zone.c | 4 - drivers/md/dm.c | 15 ------ drivers/md/md-linear.c | 1 drivers/md/md-multipath.c | 1 drivers/md/md.h | 7 -- drivers/md/raid0.c | 2 drivers/md/raid1.c | 4 - drivers/md/raid10.c | 1 drivers/md/raid5.c | 1 drivers/scsi/cxlflash/vlun.c | 4 - drivers/scsi/sd.c | 75 ++---------------------------- drivers/scsi/sd_zbc.c | 2 include/linux/bio.h | 3 - include/linux/blk_types.h | 2 include/linux/blkdev.h | 19 ------- include/linux/device-mapper.h | 6 -- kernel/trace/blktrace.c | 1 43 files changed, 30 insertions(+), 527 deletions(-)
PATCH 1/7 cxlflash: query write_zeroes limit for zeroing
The write_same and write_zeroes limits for SCSI are effectively the same, so the current code works just fine. But we plan to remove REQ_OP_WRITE_SAME support, so switch to quering the write zeroes limit for a zeroing WRITE SAME operation.
--- drivers/scsi/cxlflash/vlun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/cxlflash/vlun.c +2 -2
@@ -430,8 +430,8 @@ static int write_same16(struct scsi_device *sdev,struct device *dev = &cfg->dev->dev;const u32 s =ilog2 (sdev->sector_size) -9 ;const u32 to = sdev->request_queue->rq_timeout; -const u32 ws_limit =blk_queue_get_max_sectors (sdev->request_queue, -REQ_OP_WRITE_SAME ) >> s; +const u32 ws_limit = + sdev->request_queue->limits.max_write_zeroes_sectors >> s; cmd_buf =kzalloc (CMD_BUFSIZE ,GFP_KERNEL ); scsi_cmd =kzalloc (MAX_COMMAND_SIZE ,GFP_KERNEL );
Signature · 1 line
2.30.2
Re: [PATCH 1/7] cxlflash: query write_zeroes limit for zeroing
Quoted 7 lines · Christoph Hellwig
The
write_sameandwrite_zeroeslimits for SCSI are effectively the same, so the current code works just fine. But we plan to removeREQ_OP_WRITE_SAMEsupport, so switch to quering the write zeroes limit for a zeroing WRITE SAME operation.Signed-off-by Christoph Hellwig <[email protected]>---
Looks good.
PATCH 2/7 drbd: drop REQ_OP_WRITE_SAME support
In reply to Christoph HellwigREQ_OP_WRITE_SAME was only ever submitted by the legacy Linux zeroing code, which has switched to use REQ_OP_WRITE_ZEROES long ago.
--- drivers/block/drbd/drbd_main.c | 31 ++----------- drivers/block/drbd/drbd_nl.c | 72 +----------------------------- drivers/block/drbd/drbd_receiver.c | 47 +++---------------- drivers/block/drbd/drbd_req.c | 1 - drivers/block/drbd/drbd_worker.c | 5 --- 5 files changed, 13 insertions(+), 143 deletions(-)
drivers/block/drbd/drbd_main.c +4 -27
@@ -912,7 +912,7 @@ assign_p_sizes_qlim(struct drbd_device *device, struct p_sizes *p, p->qlim->io_min =cpu_to_be32 (queue_io_min (q)); p->qlim->io_opt =cpu_to_be32 (queue_io_opt (q)); p->qlim->discard_enabled =blk_queue_discard (q); - p->qlim->write_same_capable = !!q->limits.max_write_same_sectors; + p->qlim->write_same_capable =0 ; }else { q = device->rq_queue; p->qlim->physical_block_size =cpu_to_be32 (queue_physical_block_size (q));
@@ -1591,9 +1591,6 @@ static int _drbd_send_bio(struct drbd_peer_device *peer_device, struct bio *bio) ? 0 : MSG_MORE);if (err)return err; -/* REQ_OP_WRITE_SAME has only one segment */ -if (bio_op (bio) ==REQ_OP_WRITE_SAME ) -break ; }return 0 ; }
@@ -1612,9 +1609,6 @@ static int _drbd_send_zc_bio(struct drbd_peer_device *peer_device, struct bio *b bio_iter_last(bvec, iter) ? 0 : MSG_MORE);if (err)return err; -/* REQ_OP_WRITE_SAME has only one segment */ -if (bio_op (bio) ==REQ_OP_WRITE_SAME ) -break ; }return 0 ; }
@@ -1646,7 +1640,6 @@ static u32 bio_flags_to_wire(struct drbd_connection *connection,return (bio->bi_opf &REQ_SYNC ?DP_RW_SYNC :0 ) | (bio->bi_opf &REQ_FUA ?DP_FUA :0 ) | (bio->bi_opf &REQ_PREFLUSH ?DP_FLUSH :0 ) | - (bio_op (bio) ==REQ_OP_WRITE_SAME ?DP_WSAME :0 ) | (bio_op(bio) == REQ_OP_DISCARD ? DP_DISCARD : 0) | (bio_op(bio) == REQ_OP_WRITE_ZEROES ? ((connection->agreed_features & DRBD_FF_WZEROES) ?
@@ -1665,7 +1658,6 @@ int drbd_send_dblock(struct drbd_peer_device *peer_device, struct drbd_request *struct drbd_device *device = peer_device->device;struct drbd_socket *sock;struct p_data *p; -struct p_wsame *wsame =NULL ;void *digest_out;unsigned int dp_flags =0 ;int digest_size;
@@ -1703,29 +1695,14 @@ int drbd_send_dblock(struct drbd_peer_device *peer_device, struct drbd_request * err =__send_command (peer_device->connection, device->vnr, sock, cmd,sizeof (*t),NULL ,0 ); goto out; } -if (dp_flags &DP_WSAME ) { -/* this will only work if DRBD_FF_WSAME is set AND the -* handshake agreed that all nodes and backend devices are -* WRITE_SAME capable and agree on logical_block_size */ - wsame = (struct p_wsame *)p; - digest_out = wsame +1 ; - wsame->size =cpu_to_be32 (req->i.size); - }else - digest_out = p +1 ; + digest_out = p +1 ;/* our digest is still only over the payload. * TRIM does not carry any payload. */ if (digest_size)drbd_csum_bio (peer_device->connection->integrity_tfm, req->master_bio, digest_out); -if (wsame) { - err = -__send_command (peer_device->connection, device->vnr, sock,P_WSAME , -sizeof (*wsame) + digest_size,NULL , -bio_iovec (req->master_bio).bv_len); - }else - err = -__send_command (peer_device->connection, device->vnr, sock,P_DATA , -sizeof (*p) + digest_size,NULL , req->i.size); + err =__send_command (peer_device->connection, device->vnr, sock,P_DATA , +sizeof (*p) + digest_size,NULL , req->i.size);if (!err) {/* For protocol A, we have to memcpy the payload into * socket buffers, as we may complete right away
drivers/block/drbd/drbd_nl.c +2 -70
102 lines not on this page · raw message
drivers/block/drbd/drbd_receiver.c +7 -40
114 lines not on this page · raw message
drivers/block/drbd/drbd_req.c +0 -1
@@ -36,7 +36,6 @@ static struct drbd_request *drbd_req_new(struct drbd_device *device, struct bio req->private_bio->bi_end_io = drbd_request_endio; req->rq_state = (bio_data_dir (bio_src) ==WRITE ?RQ_WRITE :0 ) - | (bio_op (bio_src) ==REQ_OP_WRITE_SAME ?RQ_WSAME :0 ) | (bio_op (bio_src) ==REQ_OP_WRITE_ZEROES ?RQ_ZEROES :0 ) | (bio_op (bio_src) ==REQ_OP_DISCARD ?RQ_UNMAP :0 ); req->device = device;
drivers/block/drbd/drbd_worker.c +0 -5
@@ -329,11 +329,6 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest) src =kmap_atomic (bvec.bv_page);crypto_shash_update (desc, src + bvec.bv_offset, bvec.bv_len);kunmap_atomic (src); - -/* REQ_OP_WRITE_SAME has only one segment, -* checksum the payload only once. */ -if (bio_op (bio) ==REQ_OP_WRITE_SAME ) -break ; }crypto_shash_final (desc, digest);shash_desc_zero (desc);
Signature · 1 line
2.30.2
PATCH 3/7 rnbd: drop WRITE_SAME support
In reply to Christoph HellwigREQ_OP_WRITE_SAME was only ever submitted by the legacy Linux zeroing code, which has switched to use REQ_OP_WRITE_ZEROES long before rnbd was even merged.
--- drivers/block/rnbd/rnbd-clt.c | 7 ++----- drivers/block/rnbd/rnbd-clt.h | 1 - drivers/block/rnbd/rnbd-proto.h | 6 ------ drivers/block/rnbd/rnbd-srv.c | 3 +-- 4 files changed, 3 insertions(+), 14 deletions(-)
drivers/block/rnbd/rnbd-clt.c +2 -5
@@ -82,7 +82,6 @@ static int rnbd_clt_set_dev_attr(struct rnbd_clt_dev *dev, dev->nsectors =le64_to_cpu (rsp->nsectors); dev->logical_block_size =le16_to_cpu (rsp->logical_block_size); dev->physical_block_size =le16_to_cpu (rsp->physical_block_size); - dev->max_write_same_sectors =le32_to_cpu (rsp->max_write_same_sectors); dev->max_discard_sectors =le32_to_cpu (rsp->max_discard_sectors); dev->discard_granularity =le32_to_cpu (rsp->discard_granularity); dev->discard_alignment =le32_to_cpu (rsp->discard_alignment);
@@ -1359,8 +1358,6 @@ static void setup_request_queue(struct rnbd_clt_dev *dev)blk_queue_logical_block_size (dev->queue, dev->logical_block_size);blk_queue_physical_block_size (dev->queue, dev->physical_block_size);blk_queue_max_hw_sectors (dev->queue, dev->max_hw_sectors); -blk_queue_max_write_same_sectors (dev->queue, - dev->max_write_same_sectors);/* * we don't support discards to "discontiguous" segments
@@ -1610,10 +1607,10 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname, }rnbd_clt_info (dev, -"map_device: Device mapped as %s (nsectors: %zu, logical_block_size: %d, physical_block_size: %d, max_write_same_sectors: %d, max_discard_sectors: %d, discard_granularity: %d, discard_alignment: %d, secure_discard: %d, max_segments: %d, max_hw_sectors: %d, rotational: %d, wc: %d, fua: %d)\n" , +"map_device: Device mapped as %s (nsectors: %zu, logical_block_size: %d, physical_block_size: %d, max_discard_sectors: %d, discard_granularity: %d, discard_alignment: %d, secure_discard: %d, max_segments: %d, max_hw_sectors: %d, rotational: %d, wc: %d, fua: %d)\n" , dev->gd->disk_name, dev->nsectors, dev->logical_block_size, dev->physical_block_size, - dev->max_write_same_sectors, dev->max_discard_sectors, + dev->max_discard_sectors, dev->discard_granularity, dev->discard_alignment, dev->secure_discard, dev->max_segments, dev->max_hw_sectors, dev->rotational, dev->wc, dev->fua);
drivers/block/rnbd/rnbd-clt.h +0 -1
@@ -122,7 +122,6 @@ struct rnbd_clt_dev {bool wc;bool fua;u32 max_hw_sectors; -u32 max_write_same_sectors;u32 max_discard_sectors;u32 discard_granularity;u32 discard_alignment;
drivers/block/rnbd/rnbd-proto.h +0 -6
@@ -249,9 +249,6 @@ static inline u32 rnbd_to_bio_flags(u32 rnbd_opf)case RNBD_OP_SECURE_ERASE : bio_opf =REQ_OP_SECURE_ERASE ;break ; -case RNBD_OP_WRITE_SAME : - bio_opf =REQ_OP_WRITE_SAME ; -break ;default :WARN (1 ,"Unknown RNBD type: %d (flags %d)\n" ,rnbd_op (rnbd_opf), rnbd_opf);
@@ -284,9 +281,6 @@ static inline u32 rq_to_rnbd_flags(struct request *rq)case REQ_OP_SECURE_ERASE : rnbd_opf =RNBD_OP_SECURE_ERASE ;break ; -case REQ_OP_WRITE_SAME : - rnbd_opf =RNBD_OP_WRITE_SAME ; -break ;case REQ_OP_FLUSH : rnbd_opf =RNBD_OP_FLUSH ;break ;
drivers/block/rnbd/rnbd-srv.c +1 -2
@@ -548,8 +548,7 @@ static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp,cpu_to_le16 (rnbd_dev_get_max_segs (rnbd_dev)); rsp->max_hw_sectors =cpu_to_le32 (rnbd_dev_get_max_hw_sects (rnbd_dev)); - rsp->max_write_same_sectors = -cpu_to_le32 (bdev_write_same (rnbd_dev->bdev)); + rsp->max_write_same_sectors =0 ; rsp->max_discard_sectors =cpu_to_le32 (rnbd_dev_get_max_discard_sects (rnbd_dev)); rsp->discard_granularity =
Signature · 1 line
2.30.2
Re: [PATCH 3/7] rnbd: drop WRITE_SAME support
Quoted 5 lines · Christoph Hellwig
REQ_OP_WRITE_SAMEwas only ever submitted by the legacy Linux zeroing code, which has switched to useREQ_OP_WRITE_ZEROESlong before rnbd was even merged.Signed-off-by Christoph Hellwig <[email protected]>
Looks good.
Re: [PATCH 3/7] rnbd: drop WRITE_SAME support
In reply to Christoph HellwigQuoted 51 lines · Christoph Hellwig
REQ_OP_WRITE_SAMEwas only ever submitted by the legacy Linux zeroing code, which has switched to useREQ_OP_WRITE_ZEROESlong before rnbd was even merged.Signed-off-by Christoph Hellwig<[email protected]>--- drivers/block/rnbd/rnbd-clt.c | 7 ++----- drivers/block/rnbd/rnbd-clt.h | 1 - drivers/block/rnbd/rnbd-proto.h | 6 ------ drivers/block/rnbd/rnbd-srv.c | 3 +-- 4 files changed, 3 insertions(+), 14 deletions(-)drivers/block/rnbd/rnbd-clt.c +2
-5@@ -82,7 +82,6 @@ static int rnbd_clt_set_dev_attr(struct rnbd_clt_dev *dev, dev->nsectors =le64_to_cpu (rsp->nsectors); dev->logical_block_size =le16_to_cpu (rsp->logical_block_size); dev->physical_block_size =le16_to_cpu (rsp->physical_block_size); - dev->max_write_same_sectors =le32_to_cpu (rsp->max_write_same_sectors); dev->max_discard_sectors =le32_to_cpu (rsp->max_discard_sectors); dev->discard_granularity =le32_to_cpu (rsp->discard_granularity); dev->discard_alignment =le32_to_cpu (rsp->discard_alignment);@@ -1359,8 +1358,6 @@ static void setup_request_queue(struct rnbd_clt_dev *dev)blk_queue_logical_block_size (dev->queue, dev->logical_block_size);blk_queue_physical_block_size (dev->queue, dev->physical_block_size);blk_queue_max_hw_sectors (dev->queue, dev->max_hw_sectors); -blk_queue_max_write_same_sectors (dev->queue, - dev->max_write_same_sectors);/* * we don't support discards to "discontiguous" segments @@ -1610,10 +1607,10 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname, }rnbd_clt_info (dev, -"map_device: Device mapped as %s (nsectors: %zu, logical_block_size: %d, physical_block_size: %d, max_write_same_sectors: %d, max_discard_sectors: %d, discard_granularity: %d, discard_alignment: %d, secure_discard: %d, max_segments: %d, max_hw_sectors: %d, rotational: %d, wc: %d, fua: %d)\n" , +"map_device: Device mapped as %s (nsectors: %zu, logical_block_size: %d, physical_block_size: %d, max_discard_sectors: %d, discard_granularity: %d, discard_alignment: %d, secure_discard: %d, max_segments: %d, max_hw_sectors: %d, rotational: %d, wc: %d, fua: %d)\n" , dev->gd->disk_name, dev->nsectors, dev->logical_block_size, dev->physical_block_size, - dev->max_write_same_sectors, dev->max_discard_sectors, + dev->max_discard_sectors, dev->discard_granularity, dev->discard_alignment, dev->secure_discard, dev->max_segments, dev->max_hw_sectors, dev->rotational, dev->wc, dev->fua);drivers/block/rnbd/rnbd-clt.h +0
-0
drivers/block/rnbd/rnbd-clt.h struct rnbd_clt_dev { · line 127
Quoted 7 lines
drivers/block/rnbd/rnbd-clt.h +0
-1@@ -122,7 +122,6 @@ struct rnbd_clt_dev {bool wc;bool fua;u32 max_hw_sectors; -u32 max_write_same_sectors;u32 max_discard_sectors;u32 discard_granularity;u32 discard_alignment;
I am planning to remove more members inside struct rnbd_clt_dev.
Quoted 29 lines
drivers/block/rnbd/rnbd-proto.h +0
-6@@ -249,9 +249,6 @@ static inline u32 rnbd_to_bio_flags(u32 rnbd_opf)case RNBD_OP_SECURE_ERASE : bio_opf =REQ_OP_SECURE_ERASE ;break ; -case RNBD_OP_WRITE_SAME : - bio_opf =REQ_OP_WRITE_SAME ; -break ;default :WARN (1 ,"Unknown RNBD type: %d (flags %d)\n" ,rnbd_op (rnbd_opf), rnbd_opf);@@ -284,9 +281,6 @@ static inline u32 rq_to_rnbd_flags(struct request *rq)case REQ_OP_SECURE_ERASE : rnbd_opf =RNBD_OP_SECURE_ERASE ;break ; -case REQ_OP_WRITE_SAME : - rnbd_opf =RNBD_OP_WRITE_SAME ; -break ;case REQ_OP_FLUSH : rnbd_opf =RNBD_OP_FLUSH ;break ;drivers/block/rnbd/rnbd-srv.c +0
-0
drivers/block/rnbd/rnbd-srv.c static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp, · line 551
Quoted 6 lines
drivers/block/rnbd/rnbd-srv.c +1
-2@@ -548,8 +548,7 @@ static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp,cpu_to_le16 (rnbd_dev_get_max_segs (rnbd_dev)); rsp->max_hw_sectors =cpu_to_le32 (rnbd_dev_get_max_hw_sects (rnbd_dev)); - rsp->max_write_same_sectors = -cpu_to_le32 (bdev_write_same (rnbd_dev->bdev)); + rsp->max_write_same_sectors =0 ;
IIUC, I think we can delete max_write_same_sectors from rsp as well given the earlier change in setup_request_queue and rnbd_clt_set_dev_attr.
Thanks,
Guoqing
Jinpu Wang
maintainerRe: [PATCH 3/7] rnbd: drop WRITE_SAME support
Quoted 95 lines · Guoqing Jiang
Quoted 51 lines · Christoph Hellwig
REQ_OP_WRITE_SAMEwas only ever submitted by the legacy Linux zeroing code, which has switched to useREQ_OP_WRITE_ZEROESlong before rnbd was even merged.Signed-off-by Christoph Hellwig<[email protected]>--- drivers/block/rnbd/rnbd-clt.c | 7 ++----- drivers/block/rnbd/rnbd-clt.h | 1 - drivers/block/rnbd/rnbd-proto.h | 6 ------ drivers/block/rnbd/rnbd-srv.c | 3 +-- 4 files changed, 3 insertions(+), 14 deletions(-)drivers/block/rnbd/rnbd-clt.c +2
-5@@ -82,7 +82,6 @@ static int rnbd_clt_set_dev_attr(struct rnbd_clt_dev *dev, dev->nsectors =le64_to_cpu (rsp->nsectors); dev->logical_block_size =le16_to_cpu (rsp->logical_block_size); dev->physical_block_size =le16_to_cpu (rsp->physical_block_size); - dev->max_write_same_sectors =le32_to_cpu (rsp->max_write_same_sectors); dev->max_discard_sectors =le32_to_cpu (rsp->max_discard_sectors); dev->discard_granularity =le32_to_cpu (rsp->discard_granularity); dev->discard_alignment =le32_to_cpu (rsp->discard_alignment);@@ -1359,8 +1358,6 @@ static void setup_request_queue(struct rnbd_clt_dev *dev)blk_queue_logical_block_size (dev->queue, dev->logical_block_size);blk_queue_physical_block_size (dev->queue, dev->physical_block_size);blk_queue_max_hw_sectors (dev->queue, dev->max_hw_sectors); -blk_queue_max_write_same_sectors (dev->queue, - dev->max_write_same_sectors);/* * we don't support discards to "discontiguous" segments @@ -1610,10 +1607,10 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname, }rnbd_clt_info (dev, -"map_device: Device mapped as %s (nsectors: %zu, logical_block_size: %d, physical_block_size: %d, max_write_same_sectors: %d, max_discard_sectors: %d, discard_granularity: %d, discard_alignment: %d, secure_discard: %d, max_segments: %d, max_hw_sectors: %d, rotational: %d, wc: %d, fua: %d)\n" , +"map_device: Device mapped as %s (nsectors: %zu, logical_block_size: %d, physical_block_size: %d, max_discard_sectors: %d, discard_granularity: %d, discard_alignment: %d, secure_discard: %d, max_segments: %d, max_hw_sectors: %d, rotational: %d, wc: %d, fua: %d)\n" , dev->gd->disk_name, dev->nsectors, dev->logical_block_size, dev->physical_block_size, - dev->max_write_same_sectors, dev->max_discard_sectors, + dev->max_discard_sectors, dev->discard_granularity, dev->discard_alignment, dev->secure_discard, dev->max_segments, dev->max_hw_sectors, dev->rotational, dev->wc, dev->fua);drivers/block/rnbd/rnbd-clt.h +0
-0drivers/block/rnbd/rnbd-clt.h struct rnbd_clt_dev { · line 127
Quoted 7 lines
drivers/block/rnbd/rnbd-clt.h +0
-1@@ -122,7 +122,6 @@ struct rnbd_clt_dev {bool wc;bool fua;u32 max_hw_sectors; -u32 max_write_same_sectors;u32 max_discard_sectors;u32 discard_granularity;u32 discard_alignment;I am planning to remove more members inside struct
rnbd_clt_dev.Quoted 30 lines
drivers/block/rnbd/rnbd-proto.h +0
-6@@ -249,9 +249,6 @@ static inline u32 rnbd_to_bio_flags(u32 rnbd_opf)case RNBD_OP_SECURE_ERASE : bio_opf =REQ_OP_SECURE_ERASE ;break ; -case RNBD_OP_WRITE_SAME : - bio_opf =REQ_OP_WRITE_SAME ; -break ;default :WARN (1 ,"Unknown RNBD type: %d (flags %d)\n" ,rnbd_op (rnbd_opf), rnbd_opf);@@ -284,9 +281,6 @@ static inline u32 rq_to_rnbd_flags(struct request *rq)case REQ_OP_SECURE_ERASE : rnbd_opf =RNBD_OP_SECURE_ERASE ;break ; -case REQ_OP_WRITE_SAME : - rnbd_opf =RNBD_OP_WRITE_SAME ; -break ;case REQ_OP_FLUSH : rnbd_opf =RNBD_OP_FLUSH ;break ;drivers/block/rnbd/rnbd-srv.c +0
-0@@ -548,8 +548,7 @@ static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp,cpu_to_le16 (rnbd_dev_get_max_segs (rnbd_dev));
Quoted 8 lines
drivers/block/rnbd/rnbd-srv.c static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp, · line 551
Quoted 5 lines
drivers/block/rnbd/rnbd-srv.c +1
-2rsp->max_hw_sectors =cpu_to_le32 (rnbd_dev_get_max_hw_sects (rnbd_dev)); - rsp->max_write_same_sectors = -cpu_to_le32 (bdev_write_same (rnbd_dev->bdev)); + rsp->max_write_same_sectors =0 ;IIUC, I think we can delete
max_write_same_sectorsfrom rsp as well given the earlier change insetup_request_queueandrnbd_clt_set_dev_attr.
No, I don't think it's a good idea, we need to keep the protocol compatible, so client for old kernel version
won't be confused.
The patch looks good to me, but I want to run a regression test before give an acked.
Thanks!
Jinpu
Quoted 3 lines
Thanks,
Guoqing
Re: [PATCH 3/7] rnbd: drop WRITE_SAME support
Quoted 11 lines · Jinpu Wang
Quoted 11 lines
drivers/block/rnbd/rnbd-srv.c static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp, · line 551
Quoted 9 lines
drivers/block/rnbd/rnbd-srv.c +1
-2@@ -548,8 +548,7 @@ static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp,cpu_to_le16 (rnbd_dev_get_max_segs (rnbd_dev)); rsp->max_hw_sectors =cpu_to_le32 (rnbd_dev_get_max_hw_sects (rnbd_dev)); - rsp->max_write_same_sectors = -cpu_to_le32 (bdev_write_same (rnbd_dev->bdev)); + rsp->max_write_same_sectors =0 ;IIUC, I think we can delete
max_write_same_sectorsfrom rsp as well given the earlier change insetup_request_queueandrnbd_clt_set_dev_attr.
Quoted 3 lines
No, I don't think it's a good idea, we need to keep the protocol compatible, so client for old kernel version
won't be confused.
Fair enough. Then I guess it is better to add obsolete_ prefix like obsolete_rotational.
Thanks,
Guoqing
Jinpu Wang
maintainerRe: [PATCH 3/7] rnbd: drop WRITE_SAME support
In reply to Christoph HellwigHi Christoph,
Quoted 4 lines · Christoph Hellwig
REQ_OP_WRITE_SAMEwas only ever submitted by the legacy Linux zeroing code, which has switched to useREQ_OP_WRITE_ZEROESlong before rnbd was even merged.
Do you think if it makes sense to instead of removing REQ_OP_WRITE_SAME, simply convert it to REQ_OP_WRITE_ZEROES?
Thanks!
Quoted 96 lines
Signed-off-by Christoph Hellwig <[email protected]>--- drivers/block/rnbd/rnbd-clt.c | 7 ++----- drivers/block/rnbd/rnbd-clt.h | 1 - drivers/block/rnbd/rnbd-proto.h | 6 ------ drivers/block/rnbd/rnbd-srv.c | 3 +-- 4 files changed, 3 insertions(+), 14 deletions(-)drivers/block/rnbd/rnbd-clt.c +2
-5@@ -82,7 +82,6 @@ static int rnbd_clt_set_dev_attr(struct rnbd_clt_dev *dev, dev->nsectors =le64_to_cpu (rsp->nsectors); dev->logical_block_size =le16_to_cpu (rsp->logical_block_size); dev->physical_block_size =le16_to_cpu (rsp->physical_block_size); - dev->max_write_same_sectors =le32_to_cpu (rsp->max_write_same_sectors); dev->max_discard_sectors =le32_to_cpu (rsp->max_discard_sectors); dev->discard_granularity =le32_to_cpu (rsp->discard_granularity); dev->discard_alignment =le32_to_cpu (rsp->discard_alignment);@@ -1359,8 +1358,6 @@ static void setup_request_queue(struct rnbd_clt_dev *dev)blk_queue_logical_block_size (dev->queue, dev->logical_block_size);blk_queue_physical_block_size (dev->queue, dev->physical_block_size);blk_queue_max_hw_sectors (dev->queue, dev->max_hw_sectors); -blk_queue_max_write_same_sectors (dev->queue, - dev->max_write_same_sectors);/* * we don't support discards to "discontiguous" segments @@ -1610,10 +1607,10 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname, }rnbd_clt_info (dev, -"map_device: Device mapped as %s (nsectors: %zu, logical_block_size: %d, physical_block_size: %d, max_write_same_sectors: %d, max_discard_sectors: %d, discard_granularity: %d, discard_alignment: %d, secure_discard: %d, max_segments: %d, max_hw_sectors: %d, rotational: %d, wc: %d, fua: %d)\n" , +"map_device: Device mapped as %s (nsectors: %zu, logical_block_size: %d, physical_block_size: %d, max_discard_sectors: %d, discard_granularity: %d, discard_alignment: %d, secure_discard: %d, max_segments: %d, max_hw_sectors: %d, rotational: %d, wc: %d, fua: %d)\n" , dev->gd->disk_name, dev->nsectors, dev->logical_block_size, dev->physical_block_size, - dev->max_write_same_sectors, dev->max_discard_sectors, + dev->max_discard_sectors, dev->discard_granularity, dev->discard_alignment, dev->secure_discard, dev->max_segments, dev->max_hw_sectors, dev->rotational, dev->wc, dev->fua);drivers/block/rnbd/rnbd-clt.h +0
-1@@ -122,7 +122,6 @@ struct rnbd_clt_dev {bool wc;bool fua;u32 max_hw_sectors; -u32 max_write_same_sectors;u32 max_discard_sectors;u32 discard_granularity;u32 discard_alignment;drivers/block/rnbd/rnbd-proto.h +0
-6@@ -249,9 +249,6 @@ static inline u32 rnbd_to_bio_flags(u32 rnbd_opf)case RNBD_OP_SECURE_ERASE : bio_opf =REQ_OP_SECURE_ERASE ;break ; -case RNBD_OP_WRITE_SAME : - bio_opf =REQ_OP_WRITE_SAME ; -break ;default :WARN (1 ,"Unknown RNBD type: %d (flags %d)\n" ,rnbd_op (rnbd_opf), rnbd_opf);@@ -284,9 +281,6 @@ static inline u32 rq_to_rnbd_flags(struct request *rq)case REQ_OP_SECURE_ERASE : rnbd_opf =RNBD_OP_SECURE_ERASE ;break ; -case REQ_OP_WRITE_SAME : - rnbd_opf =RNBD_OP_WRITE_SAME ; -break ;case REQ_OP_FLUSH : rnbd_opf =RNBD_OP_FLUSH ;break ;drivers/block/rnbd/rnbd-srv.c +1
-3@@ -548,8 +548,7 @@ static void rnbd_srv_fill_msg_open_rsp(struct rnbd_msg_open_rsp *rsp,cpu_to_le16 (rnbd_dev_get_max_segs (rnbd_dev)); rsp->max_hw_sectors =cpu_to_le32 (rnbd_dev_get_max_hw_sects (rnbd_dev)); - rsp->max_write_same_sectors = -cpu_to_le32 (bdev_write_same (rnbd_dev->bdev)); + rsp->max_write_same_sectors =0 ; rsp->max_discard_sectors =cpu_to_le32 (rnbd_dev_get_max_discard_sects (rnbd_dev)); rsp->discard_granularity = --2.30.2
Re: [PATCH 3/7] rnbd: drop WRITE_SAME support
Quoted 11 lines · Jinpu Wang
Hi Christoph,
Quoted 4 lines · Christoph Hellwig
REQ_OP_WRITE_SAMEwas only ever submitted by the legacy Linux zeroing code, which has switched to useREQ_OP_WRITE_ZEROESlong before rnbd was even merged.Do you think if it makes sense to instead of removing
REQ_OP_WRITE_SAME, simply convert it toREQ_OP_WRITE_ZEROES?
Well, they have different semantics, so you can't just "convert" it. But it might make sense to add REQ_OP_WRITE_ZEROES.
Re: [PATCH 3/7] rnbd: drop WRITE_SAME support
Quoted 11 lines · Christoph Hellwig
Quoted 9 lines · Jinpu Wang
Hi Christoph,
Quoted 4 lines · Christoph Hellwig
REQ_OP_WRITE_SAMEwas only ever submitted by the legacy Linux zeroing code, which has switched to useREQ_OP_WRITE_ZEROESlong before rnbd was even merged.
Quoted 5 lines
Quoted 2 lines
Do you think if it makes sense to instead of removing
REQ_OP_WRITE_SAME, simply convert it toREQ_OP_WRITE_ZEROES?Well, they have different semantics, so you can't just "convert" it. But it might make sense to add
REQ_OP_WRITE_ZEROES.
Thanks, we will add support for REQ_OP_WRITE_ZEROES later.
For this patch, I've run internal tests, works fine.
Thanks!
PATCH 4/7 sd: remove write same support
In reply to Christoph HellwigThere are no more end-users of REQ_OP_WRITE_SAME left, so we can start deleting it.
--- drivers/scsi/sd.c | 75 ++++--------------------------------------- drivers/scsi/sd_zbc.c | 2 -- 2 files changed, 7 insertions(+), 70 deletions(-)
drivers/scsi/sd.c +7 -68
@@ -1034,13 +1034,13 @@ static void sd_config_write_same(struct scsi_disk *sdkp)* Reporting a maximum number of blocks that is not aligned * on the device physical size would cause a large write same * request to be split into physically unaligned chunks by -* __blkdev_issue_write_zeroes() and __blkdev_issue_write_same() -* even if the caller of these functions took care to align the -* large request. So make sure the maximum reported is aligned -* to the device physical block size. This is only an optional -* optimization for regular disks, but this is mandatory to -* avoid failure of large write same requests directed at -* sequential write required zones of host-managed ZBC disks. +* __blkdev_issue_write_zeroes() even if the caller of this +* functions took care to align the large request. So make sure +* the maximum reported is aligned to the device physical block +* size. This is only an optional optimization for regular +* disks, but this is mandatory to avoid failure of large write +* same requests directed at sequential write required zones of +* host-managed ZBC disks. */ sdkp->max_ws_blocks = round_down(sdkp->max_ws_blocks,
@@ -1049,68 +1049,10 @@ static void sd_config_write_same(struct scsi_disk *sdkp) } out: -blk_queue_max_write_same_sectors (q, sdkp->max_ws_blocks * - (logical_block_size >>9 ));blk_queue_max_write_zeroes_sectors (q, sdkp->max_ws_blocks * (logical_block_size >>9 )); } -/** -* sd_setup_write_same_cmnd - write the same data to multiple blocks -* @cmd: command to prepare -* -* Will set up either WRITE SAME(10) or WRITE SAME(16) depending on -* the preference indicated by the target device. -**/ -static blk_status_t sd_setup_write_same_cmnd (struct scsi_cmnd *cmd) -{ -struct request *rq =scsi_cmd_to_rq (cmd); -struct scsi_device *sdp = cmd->device; -struct scsi_disk *sdkp =scsi_disk (rq->q->disk); -struct bio *bio = rq->bio; -u64 lba =sectors_to_logical (sdp,blk_rq_pos (rq)); -u32 nr_blocks =sectors_to_logical (sdp,blk_rq_sectors (rq)); -blk_status_t ret; - -if (sdkp->device->no_write_same) -return BLK_STS_TARGET ; - -BUG_ON (bio_offset (bio) ||bio_iovec (bio).bv_len != sdp->sector_size); - - rq->timeout =SD_WRITE_SAME_TIMEOUT ; - -if (sdkp->ws16 || lba >0xffffffff || nr_blocks >0xffff ) { - cmd->cmd_len =16 ; - cmd->cmnd[0 ] =WRITE_SAME_16 ; -put_unaligned_be64 (lba, &cmd->cmnd[2 ]); -put_unaligned_be32 (nr_blocks, &cmd->cmnd[10 ]); - }else { - cmd->cmd_len =10 ; - cmd->cmnd[0 ] =WRITE_SAME ; -put_unaligned_be32 (lba, &cmd->cmnd[2 ]); -put_unaligned_be16 (nr_blocks, &cmd->cmnd[7 ]); - } - - cmd->transfersize = sdp->sector_size; - cmd->allowed = sdkp->max_retries; - -/* -* For WRITE SAME the data transferred via the DATA OUT buffer is -* different from the amount of data actually written to the target. -* -* We set up __data_len to the amount of data transferred via the -* DATA OUT buffer so that blk_rq_map_sg sets up the proper S/G list -* to transfer a single sector of data first, but then reset it to -* the amount of data to be written right after so that the I/O path -* knows how much to actually write. -*/ - rq->__data_len = sdp->sector_size; - ret =scsi_alloc_sgtables (cmd); - rq->__data_len =blk_rq_bytes (rq); - -return ret; -} -static blk_status_t sd_setup_flush_cmnd (struct scsi_cmnd *cmd) {struct request *rq =scsi_cmd_to_rq (cmd);
@@ -1343,8 +1285,6 @@ static blk_status_t sd_init_command(struct scsi_cmnd *cmd) }case REQ_OP_WRITE_ZEROES :return sd_setup_write_zeroes_cmnd (cmd); -case REQ_OP_WRITE_SAME : -return sd_setup_write_same_cmnd (cmd);case REQ_OP_FLUSH :return sd_setup_flush_cmnd (cmd);case REQ_OP_READ :
@@ -2039,7 +1979,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)switch (req_op (req)) {case REQ_OP_DISCARD :case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :case REQ_OP_ZONE_RESET :case REQ_OP_ZONE_RESET_ALL :case REQ_OP_ZONE_OPEN :
drivers/scsi/sd_zbc.c +0 -2
@@ -423,7 +423,6 @@ static bool sd_zbc_need_zone_wp_update(struct request *rq)return true;case REQ_OP_WRITE :case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :return blk_rq_zone_is_seq (rq);default :return false;
@@ -477,7 +476,6 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd, rq->__sector += sdkp->zones_wp_offset[zno]; fallthrough;case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :case REQ_OP_WRITE :if (sdkp->zones_wp_offset[zno] <sd_zbc_zone_sectors (sdkp)) sdkp->zones_wp_offset[zno] +=
Signature · 1 line
2.30.2
Re: [PATCH 4/7] sd: remove write same support
Quoted 5 lines · Christoph Hellwig
There are no more end-users of
REQ_OP_WRITE_SAMEleft, so we can start deleting it.Signed-off-by Christoph Hellwig <[email protected]>---
Looks good.
PATCH 5/7 md: drop WRITE_SAME support
In reply to Christoph HellwigThere are no more end-users of REQ_OP_WRITE_SAME left, so we can start deleting it.
--- drivers/md/md-linear.c | 1 - drivers/md/md-multipath.c | 1 - drivers/md/md.h | 7 ------- drivers/md/raid0.c | 2 -- drivers/md/raid1.c | 4 +--- drivers/md/raid10.c | 1 - drivers/md/raid5.c | 1 - 7 files changed, 1 insertion(+), 16 deletions(-)
drivers/md/md-linear.c +0 -1
@@ -259,7 +259,6 @@ static bool linear_make_request(struct mddev *mddev, struct bio *bio)if (mddev->gendisk)trace_block_bio_remap (bio,disk_devt (mddev->gendisk), bio_sector); -mddev_check_writesame (mddev, bio);mddev_check_write_zeroes (mddev, bio);submit_bio_noacct (bio); }
drivers/md/md-multipath.c +0 -1
@@ -127,7 +127,6 @@ static bool multipath_make_request(struct mddev *mddev, struct bio * bio) mp_bh->bio.bi_opf |=REQ_FAILFAST_TRANSPORT ; mp_bh->bio.bi_end_io = multipath_end_request; mp_bh->bio.bi_private = mp_bh; -mddev_check_writesame (mddev, &mp_bh->bio);mddev_check_write_zeroes (mddev, &mp_bh->bio);submit_bio_noacct (&mp_bh->bio);return true;
drivers/md/md.h +0 -7
@@ -797,13 +797,6 @@ static inline void mddev_clear_unsupported_flags(struct mddev *mddev, mddev->flags &= ~unsupported_flags; } -static inline void mddev_check_writesame (struct mddev *mddev,struct bio *bio) -{ -if (bio_op (bio) ==REQ_OP_WRITE_SAME && - !bio->bi_bdev->bd_disk->queue->limits.max_write_same_sectors) - mddev->queue->limits.max_write_same_sectors =0 ; -} -static inline void mddev_check_write_zeroes (struct mddev *mddev,struct bio *bio) { if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&
drivers/md/raid0.c +0 -2
@@ -402,7 +402,6 @@ static int raid0_run(struct mddev *mddev)bool discard_supported = false;blk_queue_max_hw_sectors (mddev->queue, mddev->chunk_sectors); -blk_queue_max_write_same_sectors (mddev->queue, mddev->chunk_sectors);blk_queue_max_write_zeroes_sectors (mddev->queue, mddev->chunk_sectors);blk_queue_max_discard_sectors (mddev->queue,UINT_MAX );
@@ -594,7 +593,6 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio)if (mddev->gendisk)trace_block_bio_remap (bio,disk_devt (mddev->gendisk), bio_sector); -mddev_check_writesame (mddev, bio);mddev_check_write_zeroes (mddev, bio);submit_bio_noacct (bio);return true;
drivers/md/raid1.c +1 -3
@@ -3147,10 +3147,8 @@ static int raid1_run(struct mddev *mddev)if (IS_ERR (conf))return PTR_ERR (conf); -if (mddev->queue) { -blk_queue_max_write_same_sectors (mddev->queue,0 ); +if (mddev->queue)blk_queue_max_write_zeroes_sectors (mddev->queue,0 ); - }rdev_for_each (rdev, mddev) {if (!mddev->gendisk)
drivers/md/raid10.c +0 -1
@@ -4113,7 +4113,6 @@ static int raid10_run(struct mddev *mddev)if (mddev->queue) {blk_queue_max_discard_sectors (mddev->queue,UINT_MAX ); -blk_queue_max_write_same_sectors (mddev->queue,0 );blk_queue_max_write_zeroes_sectors (mddev->queue,0 );blk_queue_io_min (mddev->queue, mddev->chunk_sectors <<9 );raid10_set_io_opt (conf);
drivers/md/raid5.c +0 -1
@@ -7767,7 +7767,6 @@ static int raid5_run(struct mddev *mddev) mddev->queue->limits.discard_alignment = stripe; mddev->queue->limits.discard_granularity = stripe; -blk_queue_max_write_same_sectors (mddev->queue,0 );blk_queue_max_write_zeroes_sectors (mddev->queue,0 );rdev_for_each (rdev, mddev) {
Signature · 1 line
2.30.2
PATCH 6/7 dm: remove write same support
In reply to Christoph HellwigThere are no more end-users of REQ_OP_WRITE_SAME left, so we can start deleting it.
--- drivers/md/dm-core.h | 1 - drivers/md/dm-crypt.c | 1 - drivers/md/dm-ebs-target.c | 1 - drivers/md/dm-io.c | 22 ++-------------------- drivers/md/dm-linear.c | 1 - drivers/md/dm-mpath.c | 1 - drivers/md/dm-rq.c | 3 --- drivers/md/dm-stripe.c | 4 +--- drivers/md/dm-table.c | 29 ----------------------------- drivers/md/dm-zone.c | 4 ---- drivers/md/dm.c | 15 --------------- include/linux/device-mapper.h | 6 ------ 12 files changed, 3 insertions(+), 85 deletions(-)
drivers/md/dm-core.h +0 -1
@@ -140,7 +140,6 @@ struct mapped_device {#define DMF_EMULATE_ZONE_APPEND 9void disable_discard (struct mapped_device *md); -void disable_write_same (struct mapped_device *md);void disable_write_zeroes (struct mapped_device *md);static inline sector_t dm_get_size (struct mapped_device *md)
drivers/md/dm-crypt.c +0 -1
@@ -1996,7 +1996,6 @@ static bool kcryptd_crypt_write_inline(struct crypt_config *cc,*/ switch (bio_op (ctx->bio_in)) {case REQ_OP_WRITE : -case REQ_OP_WRITE_SAME :case REQ_OP_WRITE_ZEROES :return true;default :
drivers/md/dm-ebs-target.c +0 -1
@@ -335,7 +335,6 @@ static int ebs_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->num_flush_bios =1 ; ti->num_discard_bios =1 ; ti->num_secure_erase_bios =0 ; - ti->num_write_same_bios =0 ; ti->num_write_zeroes_bios =0 ;return 0 ; bad:
drivers/md/dm-io.c +2 -20
@@ -304,7 +304,6 @@ static void do_region(int op, int op_flags, unsigned region,unsigned num_bvecs;sector_t remaining = where->count;struct request_queue *q =bdev_get_queue (where->bdev); -unsigned short logical_block_size =queue_logical_block_size (q);sector_t num_sectors;unsigned int special_cmd_max_sectors;
@@ -315,10 +314,8 @@ static void do_region(int op, int op_flags, unsigned region, special_cmd_max_sectors = q->limits.max_discard_sectors; else if (op == REQ_OP_WRITE_ZEROES) special_cmd_max_sectors = q->limits.max_write_zeroes_sectors; - else if (op == REQ_OP_WRITE_SAME) - special_cmd_max_sectors = q->limits.max_write_same_sectors; -if ((op ==REQ_OP_DISCARD || op ==REQ_OP_WRITE_ZEROES || - op ==REQ_OP_WRITE_SAME ) && special_cmd_max_sectors ==0 ) { +if ((op ==REQ_OP_DISCARD || op ==REQ_OP_WRITE_ZEROES ) && + special_cmd_max_sectors ==0 ) {atomic_inc (&io->count);dec_count (io, region,BLK_STS_NOTSUPP );return ;
@@ -337,9 +334,6 @@ static void do_region(int op, int op_flags, unsigned region,case REQ_OP_WRITE_ZEROES : num_bvecs =0 ;break ; -case REQ_OP_WRITE_SAME : - num_bvecs =1 ; -break ;default : num_bvecs =bio_max_segs (dm_sector_div_up (remaining, (PAGE_SIZE >>SECTOR_SHIFT )));
@@ -355,18 +349,6 @@ static void do_region(int op, int op_flags, unsigned region, num_sectors =min_t (sector_t, special_cmd_max_sectors, remaining); bio->bi_iter.bi_size = num_sectors <<SECTOR_SHIFT ; remaining -= num_sectors; - }else if (op ==REQ_OP_WRITE_SAME ) { -/* -* WRITE SAME only uses a single page. -*/ - dp->get_page (dp, &page, &len, &offset); -bio_add_page (bio, page, logical_block_size, offset); - num_sectors =min_t (sector_t, special_cmd_max_sectors, remaining); - bio->bi_iter.bi_size = num_sectors <<SECTOR_SHIFT ; - - offset =0 ; - remaining -= num_sectors; - dp->next_page (dp); }else while (remaining) {/* * Try and add as many pages as possible.
drivers/md/dm-linear.c +0 -1
@@ -60,7 +60,6 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->num_flush_bios =1 ; ti->num_discard_bios =1 ; ti->num_secure_erase_bios =1 ; - ti->num_write_same_bios =1 ; ti->num_write_zeroes_bios =1 ; ti->private = lc;return 0 ;
drivers/md/dm-mpath.c +0 -1
@@ -1252,7 +1252,6 @@ static int multipath_ctr(struct dm_target *ti, unsigned argc, char **argv) ti->num_flush_bios =1 ; ti->num_discard_bios =1 ; - ti->num_write_same_bios =1 ; ti->num_write_zeroes_bios =1 ;if (m->queue_mode ==DM_TYPE_BIO_BASED ) ti->per_io_data_size =multipath_per_bio_data_size ();
drivers/md/dm-rq.c +0 -3
@@ -217,9 +217,6 @@ static void dm_done(struct request *clone, blk_status_t error, bool mapped)if (req_op (clone) ==REQ_OP_DISCARD && !clone->q->limits.max_discard_sectors)disable_discard (tio->md); -else if (req_op (clone) ==REQ_OP_WRITE_SAME && - !clone->q->limits.max_write_same_sectors) -disable_write_same (tio->md);else if (req_op (clone) ==REQ_OP_WRITE_ZEROES && !clone->q->limits.max_write_zeroes_sectors)disable_write_zeroes (tio->md);
drivers/md/dm-stripe.c +1 -3
@@ -157,7 +157,6 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->num_flush_bios = stripes; ti->num_discard_bios = stripes; ti->num_secure_erase_bios = stripes; - ti->num_write_same_bios = stripes; ti->num_write_zeroes_bios = stripes; sc->chunk_size = chunk_size;
@@ -284,8 +283,7 @@ static int stripe_map(struct dm_target *ti, struct bio *bio) }if (unlikely (bio_op (bio) ==REQ_OP_DISCARD ) ||unlikely (bio_op (bio) ==REQ_OP_SECURE_ERASE ) || -unlikely (bio_op (bio) ==REQ_OP_WRITE_ZEROES ) || -unlikely (bio_op (bio) ==REQ_OP_WRITE_SAME )) { +unlikely (bio_op (bio) ==REQ_OP_WRITE_ZEROES )) { target_bio_nr =dm_bio_get_target_bio_nr (bio);BUG_ON (target_bio_nr >= sc->stripes);return stripe_map_range (sc, bio, target_bio_nr);
drivers/md/dm-table.c +0 -29
@@ -1822,33 +1822,6 @@ static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev,return !blk_queue_add_random (q); } -static int device_not_write_same_capable (struct dm_target *ti,struct dm_dev *dev, -sector_t start,sector_t len,void *data) -{ -struct request_queue *q =bdev_get_queue (dev->bdev); - -return !q->limits.max_write_same_sectors; -} - -static bool dm_table_supports_write_same (struct dm_table *t) -{ -struct dm_target *ti; -unsigned i; - -for (i =0 ; i <dm_table_get_num_targets (t); i++) { - ti =dm_table_get_target (t, i); - -if (!ti->num_write_same_bios) -return false; - -if (!ti->type->iterate_devices || - ti->type->iterate_devices (ti, device_not_write_same_capable,NULL )) -return false; - } - -return true; -} -static int device_not_write_zeroes_capable (struct dm_target *ti,struct dm_dev *dev,sector_t start,sector_t len,void *data) {
@@ -2027,8 +2000,6 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,else blk_queue_flag_set (QUEUE_FLAG_NONROT , q); -if (!dm_table_supports_write_same (t)) - q->limits.max_write_same_sectors =0 ;if (!dm_table_supports_write_zeroes (t)) q->limits.max_write_zeroes_sectors =0 ;
drivers/md/dm-zone.c +0 -4
@@ -130,7 +130,6 @@ bool dm_is_zone_write(struct mapped_device *md, struct bio *bio)switch (bio_op (bio)) {case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :case REQ_OP_WRITE :return !op_is_flush (bio->bi_opf) &&bio_sectors (bio);default :
@@ -390,7 +389,6 @@ static bool dm_zone_map_bio_begin(struct mapped_device *md,case REQ_OP_ZONE_FINISH :return true;case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :case REQ_OP_WRITE :/* Writes must be aligned to the zone write pointer */ if ((clone->bi_iter.bi_sector & (zsectors -1 )) != zwp_offset)
@@ -446,7 +444,6 @@ static blk_status_t dm_zone_map_bio_end(struct mapped_device *md, blk_queue_zone_sectors(md->queue));return BLK_STS_OK ;case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :case REQ_OP_WRITE :WRITE_ONCE (md->zwp_offset[zno], zwp_offset + nr_sectors);return BLK_STS_OK ;
@@ -503,7 +500,6 @@ static bool dm_need_zone_wp_tracking(struct bio *orig_bio)return false;switch (bio_op (orig_bio)) {case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :case REQ_OP_WRITE :case REQ_OP_ZONE_RESET :case REQ_OP_ZONE_FINISH :
drivers/md/dm.c +0 -15
@@ -856,14 +856,6 @@ void disable_discard(struct mapped_device *md)blk_queue_flag_clear (QUEUE_FLAG_DISCARD , md->queue); } -void disable_write_same (struct mapped_device *md) -{ -struct queue_limits *limits =dm_get_queue_limits (md); - -/* device doesn't really support WRITE SAME, disable it */ - limits->max_write_same_sectors =0 ; -} -void disable_write_zeroes (struct mapped_device *md) {struct queue_limits *limits =dm_get_queue_limits (md);
@@ -890,9 +882,6 @@ static void clone_endio(struct bio *bio)if (bio_op (bio) ==REQ_OP_DISCARD && !q->limits.max_discard_sectors)disable_discard (md); -else if (bio_op (bio) ==REQ_OP_WRITE_SAME && - !q->limits.max_write_same_sectors) -disable_write_same (md);else if (bio_op (bio) ==REQ_OP_WRITE_ZEROES && !q->limits.max_write_zeroes_sectors)disable_write_zeroes (md);
@@ -1320,7 +1309,6 @@ static bool is_abnormal_io(struct bio *bio)switch (bio_op (bio)) {case REQ_OP_DISCARD :case REQ_OP_SECURE_ERASE : -case REQ_OP_WRITE_SAME :case REQ_OP_WRITE_ZEROES : r = true;break ;
@@ -1342,9 +1330,6 @@ static bool __process_abnormal_io(struct clone_info *ci, struct dm_target *ti,case REQ_OP_SECURE_ERASE : num_bios = ti->num_secure_erase_bios;break ; -case REQ_OP_WRITE_SAME : - num_bios = ti->num_write_same_bios; -break ;case REQ_OP_WRITE_ZEROES : num_bios = ti->num_write_zeroes_bios;break ;
include/linux/device-mapper.h +0 -6
@@ -316,12 +316,6 @@ struct dm_target {*/ unsigned num_secure_erase_bios; -/* -* The number of WRITE SAME bios that will be submitted to the target. -* The bio number can be accessed with dm_bio_get_target_bio_nr. -*/ -unsigned num_write_same_bios; -/* * The number of WRITE ZEROES bios that will be submitted to the target. * The bio number can be accessed with dm_bio_get_target_bio_nr.
Signature · 1 line
2.30.2
Re: [PATCH 6/7] dm: remove write same support
Quoted 4 lines · Christoph Hellwig
There are no more end-users of
REQ_OP_WRITE_SAMEleft, so we can start deleting it.Signed-off-by Christoph Hellwig <[email protected]>
Thanks.
PATCH 7/7 block: remove REQ_OP_WRITE_SAME support
In reply to Christoph HellwigNo more users of REQ_OP_WRITE_SAME or drivers implementing it are left, so remove the infrastructure.
--- block/blk-core.c | 13 +----- block/blk-lib.c | 91 --------------------------------------- block/blk-merge.c | 40 ----------------- block/blk-settings.c | 16 ------- block/blk-sysfs.c | 8 ---- block/blk-zoned.c | 1 - block/blk.h | 1 - block/bounce.c | 3 -- include/linux/bio.h | 3 -- include/linux/blk_types.h | 2 - include/linux/blkdev.h | 19 -------- kernel/trace/blktrace.c | 1 - 12 files changed, 1 insertion(+), 197 deletions(-)
block/blk-core.c +1 -12
@@ -122,7 +122,6 @@ static const char *const blk_op_name[] = {REQ_OP_NAME (ZONE_CLOSE ),REQ_OP_NAME (ZONE_FINISH ),REQ_OP_NAME (ZONE_APPEND ), -REQ_OP_NAME (WRITE_SAME ),REQ_OP_NAME (WRITE_ZEROES ),REQ_OP_NAME (DRV_IN ), REQ_OP_NAME(DRV_OUT),
@@ -735,10 +734,6 @@ noinline_for_stack bool submit_bio_checks(struct bio *bio)if (!blk_queue_secure_erase (q)) goto not_supported;break ; -case REQ_OP_WRITE_SAME : -if (!q->limits.max_write_same_sectors) - goto not_supported; -break ;case REQ_OP_ZONE_APPEND : status =blk_check_zone_append (q, bio);if (status !=BLK_STS_OK )
@@ -934,13 +929,7 @@ void submit_bio(struct bio *bio)* go through the normal accounting stuff before submission. */ if (bio_has_data (bio)) { -unsigned int count; - -if (unlikely (bio_op (bio) ==REQ_OP_WRITE_SAME )) - count =queue_logical_block_size ( -bdev_get_queue (bio->bi_bdev)) >>9 ; -else - count =bio_sectors (bio); +unsigned int count =bio_sectors (bio);if (op_is_write (bio_op (bio))) {count_vm_events (PGPGOUT , count);
block/blk-lib.c +0 -91
97 lines not on this page · raw message
block/blk-merge.c +0 -40
@@ -152,22 +152,6 @@ static struct bio *blk_bio_write_zeroes_split(struct request_queue *q,return bio_split (bio, q->limits.max_write_zeroes_sectors,GFP_NOIO , bs); } -static struct bio *blk_bio_write_same_split (struct request_queue *q, -struct bio *bio, -struct bio_set *bs, -unsigned *nsegs) -{ - *nsegs =1 ; - -if (!q->limits.max_write_same_sectors) -return NULL ; - -if (bio_sectors (bio) <= q->limits.max_write_same_sectors) -return NULL ; - -return bio_split (bio, q->limits.max_write_same_sectors,GFP_NOIO , bs); -} -/* * Return the maximum number of sectors from the start of a bio that may be * submitted as a single request to a block device. If enough sectors remain,
@@ -351,10 +335,6 @@ void __blk_queue_split(struct request_queue *q, struct bio **bio, split =blk_bio_write_zeroes_split (q, *bio, &q->bio_split, nr_segs);break ; -case REQ_OP_WRITE_SAME : - split =blk_bio_write_same_split (q, *bio, &q->bio_split, - nr_segs); -break ;default : split =blk_bio_segment_split (q, *bio, &q->bio_split, nr_segs);break ;
@@ -416,8 +396,6 @@ unsigned int blk_recalc_rq_segments(struct request *rq)return 1 ;case REQ_OP_WRITE_ZEROES :return 0 ; -case REQ_OP_WRITE_SAME : -return 1 ; }rq_for_each_bvec (bv, rq, iter)
@@ -555,8 +533,6 @@ int __blk_rq_map_sg(struct request_queue *q, struct request *rq,if (rq->rq_flags &RQF_SPECIAL_PAYLOAD ) nsegs =__blk_bvec_map_sg (rq->special_vec, sglist, last_sg); -else if (rq->bio &&bio_op (rq->bio) ==REQ_OP_WRITE_SAME ) - nsegs =__blk_bvec_map_sg (bio_iovec (rq->bio), sglist, last_sg);else if (rq->bio) nsegs =__blk_bios_map_sg (q, rq->bio, sglist, last_sg);
@@ -757,13 +733,6 @@ static enum elv_merge blk_try_req_merge(struct request *req,return ELEVATOR_NO_MERGE ; } -static inline bool blk_write_same_mergeable (struct bio *a,struct bio *b) -{ -if (bio_page (a) ==bio_page (b) &&bio_offset (a) ==bio_offset (b)) -return true; -return false; -} -/* * For non-mq, this has to be called with the request spinlock acquired. * For mq with scheduling, the appropriate queue wide lock should be held.
@@ -780,10 +749,6 @@ static struct request *attempt_merge(struct request_queue *q,if (rq_data_dir (req) !=rq_data_dir (next))return NULL ; -if (req_op (req) ==REQ_OP_WRITE_SAME && - !blk_write_same_mergeable (req->bio, next->bio)) -return NULL ; -/* * Don't allow merge of different write hints, or for a hint with * non-hint IO.
@@ -912,11 +877,6 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)if (!bio_crypt_rq_ctx_compatible (rq, bio))return false; -/* must be using the same buffer */ -if (req_op (rq) ==REQ_OP_WRITE_SAME && - !blk_write_same_mergeable (rq->bio, bio)) -return false; -/* * Don't allow merge of different write hints, or for a hint with * non-hint IO.
block/blk-settings.c +0 -16
@@ -42,7 +42,6 @@ void blk_set_default_limits(struct queue_limits *lim) lim->max_sectors = lim->max_hw_sectors =BLK_SAFE_MAX_SECTORS ; lim->max_dev_sectors =0 ; lim->chunk_sectors =0 ; - lim->max_write_same_sectors =0 ; lim->max_write_zeroes_sectors =0 ; lim->max_zone_append_sectors =0 ; lim->max_discard_sectors =0 ;
@@ -79,7 +78,6 @@ void blk_set_stacking_limits(struct queue_limits *lim) lim->max_segment_size =UINT_MAX ; lim->max_sectors =UINT_MAX ; lim->max_dev_sectors =UINT_MAX ; - lim->max_write_same_sectors =UINT_MAX ; lim->max_write_zeroes_sectors =UINT_MAX ; lim->max_zone_append_sectors =UINT_MAX ; }
@@ -178,18 +176,6 @@ void blk_queue_max_discard_sectors(struct request_queue *q, }EXPORT_SYMBOL (blk_queue_max_discard_sectors); -/** -* blk_queue_max_write_same_sectors - set max sectors for a single write same -* @q: the request queue for the device -* @max_write_same_sectors: maximum number of sectors to write per command -**/ -void blk_queue_max_write_same_sectors (struct request_queue *q, -unsigned int max_write_same_sectors) -{ - q->limits.max_write_same_sectors = max_write_same_sectors; -} -EXPORT_SYMBOL (blk_queue_max_write_same_sectors); -/** * blk_queue_max_write_zeroes_sectors - set max sectors for a single * write zeroes
@@ -519,8 +505,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, t->max_sectors =min_not_zero (t->max_sectors, b->max_sectors); t->max_hw_sectors =min_not_zero (t->max_hw_sectors, b->max_hw_sectors); t->max_dev_sectors =min_not_zero (t->max_dev_sectors, b->max_dev_sectors); - t->max_write_same_sectors =min (t->max_write_same_sectors, - b->max_write_same_sectors); t->max_write_zeroes_sectors =min (t->max_write_zeroes_sectors, b->max_write_zeroes_sectors); t->max_zone_append_sectors = min(t->max_zone_append_sectors,
block/blk-sysfs.c +0 -8
@@ -212,12 +212,6 @@ static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *pagreturn queue_var_show (0 , page); } -static ssize_t queue_write_same_max_show (struct request_queue *q,char *page) -{ -return sprintf (page,"%llu\n" , - (unsigned long long )q->limits.max_write_same_sectors <<9 ); -} -static ssize_t queue_write_zeroes_max_show (struct request_queue *q,char *page) { return sprintf(page, "%llu\n",
@@ -587,7 +581,6 @@ QUEUE_RO_ENTRY(queue_discard_max_hw, "discard_max_hw_bytes");QUEUE_RW_ENTRY (queue_discard_max,"discard_max_bytes" );QUEUE_RO_ENTRY (queue_discard_zeroes_data,"discard_zeroes_data" ); -QUEUE_RO_ENTRY (queue_write_same_max,"write_same_max_bytes" );QUEUE_RO_ENTRY (queue_write_zeroes_max,"write_zeroes_max_bytes" );QUEUE_RO_ENTRY (queue_zone_append_max,"zone_append_max_bytes" );QUEUE_RO_ENTRY (queue_zone_write_granularity,"zone_write_granularity" );
@@ -643,7 +636,6 @@ static struct attribute *queue_attrs[] = { &queue_discard_max_entry.attr, &queue_discard_max_hw_entry.attr, &queue_discard_zeroes_data_entry.attr, - &queue_write_same_max_entry.attr, &queue_write_zeroes_max_entry.attr, &queue_zone_append_max_entry.attr, &queue_zone_write_granularity_entry.attr,
block/blk-zoned.c +0 -1
@@ -65,7 +65,6 @@ bool blk_req_needs_zone_write_lock(struct request *rq)switch (req_op (rq)) {case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :case REQ_OP_WRITE :return blk_rq_zone_is_seq (rq);default :
block/blk.h +0 -1
@@ -286,7 +286,6 @@ static inline bool blk_may_split(struct request_queue *q, struct bio *bio)case REQ_OP_DISCARD :case REQ_OP_SECURE_ERASE :case REQ_OP_WRITE_ZEROES : -case REQ_OP_WRITE_SAME :return true;/* non-trivial splitting decisions */ default :break ;
block/bounce.c +0 -3
@@ -178,9 +178,6 @@ static struct bio *bounce_clone_bio(struct bio *bio_src)case REQ_OP_SECURE_ERASE :case REQ_OP_WRITE_ZEROES :break ; -case REQ_OP_WRITE_SAME : - bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0 ]; -break ;default :bio_for_each_segment (bv, bio_src, iter) bio->bi_io_vec[bio->bi_vcnt++] = bv;
include/linux/bio.h +0 -3
@@ -65,7 +65,6 @@ static inline bool bio_no_advance_iter(const struct bio *bio) {return bio_op (bio) ==REQ_OP_DISCARD ||bio_op (bio) ==REQ_OP_SECURE_ERASE || -bio_op (bio) ==REQ_OP_WRITE_SAME ||bio_op (bio) ==REQ_OP_WRITE_ZEROES ; }
@@ -186,8 +185,6 @@ static inline unsigned bio_segments(struct bio *bio)case REQ_OP_SECURE_ERASE :case REQ_OP_WRITE_ZEROES :return 0 ; -case REQ_OP_WRITE_SAME : -return 1 ;default :break ; }
include/linux/blk_types.h +0 -2
@@ -361,8 +361,6 @@ enum req_opf {REQ_OP_DISCARD =3 ,/* securely erase sectors */ REQ_OP_SECURE_ERASE =5 , -/* write the same sector many times */ -REQ_OP_WRITE_SAME =7 ,/* write the zero filled sector many times */ REQ_OP_WRITE_ZEROES = 9,/* Open a zone */
include/linux/blkdev.h +0 -19
@@ -247,7 +247,6 @@ struct queue_limits {unsigned int io_opt;unsigned int max_discard_sectors;unsigned int max_hw_discard_sectors; -unsigned int max_write_same_sectors;unsigned int max_write_zeroes_sectors;unsigned int max_zone_append_sectors;unsigned int discard_granularity;
@@ -913,9 +912,6 @@ static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,return min (q->limits.max_discard_sectors,UINT_MAX >>SECTOR_SHIFT ); -if (unlikely (op ==REQ_OP_WRITE_SAME )) -return q->limits.max_write_same_sectors; -if (unlikely (op ==REQ_OP_WRITE_ZEROES ))return q->limits.max_write_zeroes_sectors;
@@ -958,8 +954,6 @@ extern void blk_queue_max_discard_segments(struct request_queue *,extern void blk_queue_max_segment_size (struct request_queue *,unsigned int );extern void blk_queue_max_discard_sectors (struct request_queue *q,unsigned int max_discard_sectors); -extern void blk_queue_max_write_same_sectors (struct request_queue *q, -unsigned int max_write_same_sectors);extern void blk_queue_max_write_zeroes_sectors (struct request_queue *q,unsigned int max_write_same_sectors);extern void blk_queue_logical_block_size (struct request_queue *,unsigned int );
@@ -1096,9 +1090,6 @@ static inline long nr_blockdev_pages(void)extern void blk_io_schedule (void ); -extern int blkdev_issue_write_same (struct block_device *bdev,sector_t sector, -sector_t nr_sects,gfp_t gfp_mask,struct page *page); -#define BLKDEV_DISCARD_SECURE (1 << 0)/* issue a secure erase */ extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
@@ -1325,16 +1316,6 @@ static inline int bdev_discard_alignment(struct block_device *bdev)return q->limits.discard_alignment; } -static inline unsigned int bdev_write_same (struct block_device *bdev) -{ -struct request_queue *q =bdev_get_queue (bdev); - -if (q) -return q->limits.max_write_same_sectors; - -return 0 ; -} -static inline unsigned int bdev_write_zeroes_sectors (struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev);
kernel/trace/blktrace.c +0 -1
@@ -1892,7 +1892,6 @@ void blk_fill_rwbs(char *rwbs, unsigned int op)switch (op &REQ_OP_MASK ) {case REQ_OP_WRITE : -case REQ_OP_WRITE_SAME : rwbs[i++] ='W' ;break ;case REQ_OP_DISCARD :
Signature · 1 line
2.30.2
Re: [PATCH 7/7] block: remove REQ_OP_WRITE_SAME support
Quoted 4 lines · Christoph Hellwig
No more users of
REQ_OP_WRITE_SAMEor drivers implementing it are left, so remove the infrastructure.Signed-off-by Christoph Hellwig <[email protected]>
Looks good.
Re: [PATCH 7/7] block: remove REQ_OP_WRITE_SAME support
In reply to Christoph HellwigChristoph,
Quoted 5 lines
block/blk-sysfs.c +0
-0
block/blk-sysfs.c static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *pag · line 220
Quoted 9 lines
block/blk-sysfs.c +0
-6@@ -212,12 +212,6 @@ static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *pagreturn queue_var_show (0 , page); } -static ssize_t queue_write_same_max_show (struct request_queue *q,char *page) -{ -return sprintf (page,"%llu\n" , - (unsigned long long )q->limits.max_write_same_sectors <<9 ); -} -
This tripped one of my test scripts. We should probably return 0 here like we did for discard_zeroes_data and leave the sysfs entry in place.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 7/7] block: remove REQ_OP_WRITE_SAME support
Quoted 9 lines · Martin K. Petersen
Review
Quoted 6 lines
(quoted diff) +0
-6-static ssize_t queue_write_same_max_show(struct request_queue *q, char *page) -{ - return sprintf(page, "%llu\n", - (unsigned long long)q->limits.max_write_same_sectors << 9); -} -This tripped one of my test scripts. We should probably return 0 here like we did for
discard_zeroes_dataand leave the sysfs entry in place.
The maybe fold this in?
---
From eae8e9b8cff5ee8522b00430a4aabd01ebc7c55a Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <[email protected]>
Date: Tue, 22 Feb 2022 08:35:59 +0100
Subject: block: restore the write_same_max sysfs attribute
Some userspace breaks if this attribute is gone. Restore it and always return 0.
--- block/blk-sysfs.c | 7 +++++++ 1 file changed, 7 insertions(+)
block/blk-sysfs.c +7 -0
@@ -212,6 +212,11 @@ static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *pagreturn queue_var_show (0 , page); } +static ssize_t queue_write_same_max_show (struct request_queue *q,char *page) +{ +return sprintf (page,"%llu\n" ,0ULL ); +} +static ssize_t queue_write_zeroes_max_show (struct request_queue *q,char *page) { return sprintf(page, "%llu\n",
@@ -581,6 +586,7 @@ QUEUE_RO_ENTRY(queue_discard_max_hw, "discard_max_hw_bytes");QUEUE_RW_ENTRY (queue_discard_max,"discard_max_bytes" );QUEUE_RO_ENTRY (queue_discard_zeroes_data,"discard_zeroes_data" ); +QUEUE_RO_ENTRY (queue_write_same_max,"write_same_max_bytes" );QUEUE_RO_ENTRY (queue_write_zeroes_max,"write_zeroes_max_bytes" );QUEUE_RO_ENTRY (queue_zone_append_max,"zone_append_max_bytes" );QUEUE_RO_ENTRY (queue_zone_write_granularity,"zone_write_granularity" );
@@ -636,6 +642,7 @@ static struct attribute *queue_attrs[] = { &queue_discard_max_entry.attr, &queue_discard_max_hw_entry.attr, &queue_discard_zeroes_data_entry.attr, + &queue_write_same_max_entry.attr, &queue_write_zeroes_max_entry.attr, &queue_zone_append_max_entry.attr, &queue_zone_write_granularity_entry.attr,
Signature · 1 line
2.30.2
Re: [PATCH 7/7] block: remove REQ_OP_WRITE_SAME support
Christoph,
Quoted 1 line
The maybe fold this in?
Done, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 11 lines · Christoph Hellwig
Now that we are using
REQ_OP_WRITE_ZEROESfor all zeroing needs in the kernel there is very little use left forREQ_OP_WRITE_SAME. We only have two callers left, and both just export optional protocol features to remote systems: DRBD and the target code.For the target code the only real use case was zeroing offload, which is kept with this series, and for DRBD I suspect the same based on the usage.
git://git.infradead.org/users/hch/block.gitdelete-write-same
Quoted 9 lines
Gitweb:
http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/delete-write-same
Changes since v2:
- split up
- rebased ontop of five years of kernel change, including the totally pointless addition ofREQ_OP_WRITE_SAMEin rnbd
Thanks a lot for doing this, much less code to test and review in blk-lib.c now ...
-ck
Christoph,
Quoted 4 lines
Now that we are using
REQ_OP_WRITE_ZEROESfor all zeroing needs in the kernel there is very little use left forREQ_OP_WRITE_SAME. We only have two callers left, and both just export optional protocol features to remote systems: DRBD and the target code.
No particular objections from me. I had a half-baked series to do the same thing.
One thing I would like is to either pull this series through SCSI or do the block pieces in a post merge branch because I'm about to post my discard/zeroing rework and that's going to clash with your changes.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 8 lines · Martin K. Petersen
Christoph,
Quoted 4 lines
Now that we are using
REQ_OP_WRITE_ZEROESfor all zeroing needs in the kernel there is very little use left forREQ_OP_WRITE_SAME. We only have two callers left, and both just export optional protocol features to remote systems: DRBD and the target code.
Quoted 6 lines
No particular objections from me. I had a half-baked series to do the same thing.
One thing I would like is to either pull this series through SCSI or do the block pieces in a post merge branch because I'm about to post my discard/zeroing rework and that's going to clash with your changes.
I'd be fine with taking this through the SCSI tree. Or we can wait another merge window to make your life easier.
Jens Axboe
maintainerQuoted 12 lines · Christoph Hellwig
Quoted 11 lines · Martin K. Petersen
Christoph,
Quoted 4 lines
Now that we are using
REQ_OP_WRITE_ZEROESfor all zeroing needs in the kernel there is very little use left forREQ_OP_WRITE_SAME. We only have two callers left, and both just export optional protocol features to remote systems: DRBD and the target code.No particular objections from me. I had a half-baked series to do the same thing.
Quoted 6 lines
Quoted 3 lines
One thing I would like is to either pull this series through SCSI or do the block pieces in a post merge branch because I'm about to post my discard/zeroing rework and that's going to clash with your changes.
I'd be fine with taking this through the SCSI tree. Or we can wait another merge window to make your life easier.
Let's just use the SCSI tree - I didn't check if it throws any conflicts right now, so probably something to check upfront...
If things pan out, you can add my Acked-by to the series.
Signature · 1 line
Jens Axboe
Quoted 2 lines · Jens Axboe
Let's just use the SCSI tree - I didn't check if it throws any conflicts right now, so probably something to check upfront...
There is a minor conflict because the __blkdev_issue_write_same function removed by this series is affected by the blk_next_bio calling convention change in the block tree, but the fixup is trivial.
Martin: do you want to fix that up when applying, or do you want me to resend? If you have your discard rework ready you can also send that now and I'll rebase on top of that.
Christoph,
Quoted 7 lines
There is a minor conflict because the
__blkdev_issue_write_samefunction removed by this series is affected by theblk_next_biocalling convention change in the block tree, but the fixup is trivial.Martin: do you want to fix that up when applying, or do you want me to resend? If you have your discard rework ready you can also send that now and I'll rebase on top of that.
I'll fix it up when applying. Will get this queued up tomorrow.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedChristoph,
Quoted 4 lines
Now that we are using
REQ_OP_WRITE_ZEROESfor all zeroing needs in the kernel there is very little use left forREQ_OP_WRITE_SAME. We only have two callers left, and both just export optional protocol features to remote systems: DRBD and the target code.
Applied to 5.18/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 10 lines · Christoph Hellwig
Now that we are using
REQ_OP_WRITE_ZEROESfor all zeroing needs in the kernel there is very little use left forREQ_OP_WRITE_SAME. We only have two callers left, and both just export optional protocol features to remote systems: DRBD and the target code.For the target code the only real use case was zeroing offload, which is kept with this series, and for DRBD I suspect the same based on the usage.
[...]
Applied to 5.18/scsi-queue, thanks!
[1/7] cxlflash: query write_zeroes limit for zeroing
https://git.kernel.org/mkp/scsi/c/898cd34607eb [2/7] drbd: drop REQ_OP_WRITE_SAME support https://git.kernel.org/mkp/scsi/c/a34592ff6b78 [3/7] rnbd: drop WRITE_SAME support https://git.kernel.org/mkp/scsi/c/ebd04737637b [4/7] sd: remove write same support https://git.kernel.org/mkp/scsi/c/e383e16e84e9 [5/7] md: drop WRITE_SAME support https://git.kernel.org/mkp/scsi/c/10fa225c33a9 [6/7] dm: remove write same support https://git.kernel.org/mkp/scsi/c/a773187e37fa [7/7] block: remove REQ_OP_WRITE_SAME support https://git.kernel.org/mkp/scsi/c/73bd66d9c834
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering