Skip to contentSkip to conversation

target/iblock: Convert WRITE_SAME to blkdev_issue_zeroout

PATCH In review Nicholas A. Bellinger 2 participants 2 messages Jun 1, 2017 – Jun 3, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 target/iblock: Convert WRITE_SAME to blkdev_issue_zeroout

From: Nicholas Bellinger <[email protected]>

The people who are actively using iblock_execute_write_same_direct() are doing so in the context of ESX VAAI BlockZero, together with EXTENDED_COPY and COMPARE_AND_WRITE primitives.

In practice though I've not seen any users of IBLOCK WRITE_SAME for anything other than VAAI BlockZero, so just using blkdev_issue_zeroout() when available, and falling back to iblock_execute_write_same() if the WRITE_SAME buffer contains anything other than zeros should be OK.

(Hook up max_write_zeroes_sectors to signal LBPRZ feature bit in
target_configure_unmap_from_queue - nab)

Cc Christoph Hellwig <[email protected]>
Cc Mike Christie <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Martin K. Petersen <[email protected]>
Cc Jens Axboe <[email protected]>
---
 drivers/target/target_core_device.c |  2 +-
 drivers/target/target_core_iblock.c | 44 +++++++++++++++++++++++--------------
 2 files changed, 28 insertions(+), 18 deletions(-)
drivers/target/target_core_device.c +1 -1
index 8add07f38..a5762e6 100644
@@ -851,7 +851,7 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
 	attrib->unmap_granularity = q->limits.discard_granularity / block_size;
 	attrib->unmap_granularity_alignment = q->limits.discard_alignment /
 								block_size;
-	attrib->unmap_zeroes_data = 0;
+	attrib->unmap_zeroes_data = (q->limits.max_write_zeroes_sectors);
 	return true;
 }
 EXPORT_SYMBOL(target_configure_unmap_from_queue);
drivers/target/target_core_iblock.c +27 -17

76 lines not on this page · raw message

Signature · 1 line
1.9.1
Reviewed-by on v2 1/1
#1 lore raw

Nicholas,

Quoted 4 lines

The people who are actively using iblock_execute_write_same_direct() are doing so in the context of ESX VAAI BlockZero, together with EXTENDED_COPY and COMPARE_AND_WRITE primitives.

Quoted 8 lines

In practice though I've not seen any users of IBLOCK WRITE_SAME for anything other than VAAI BlockZero, so just using blkdev_issue_zeroout() when available, and falling back to iblock_execute_write_same() if the WRITE_SAME buffer contains anything other than zeros should be OK.

(Hook up max_write_zeroes_sectors to signal LBPRZ feature bit in
target_configure_unmap_from_queue - nab)

Looks reasonable.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering