* [PATCH 0/2] block atomic writes tidy-ups/fix
@ 2024-08-05 11:33 John Garry
2024-08-05 11:33 ` [PATCH 1/2] scsi: sd: Don't check if a write for REQ_ATOMIC John Garry
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: John Garry @ 2024-08-05 11:33 UTC (permalink / raw)
To: axboe, James.Bottomley, martin.petersen
Cc: linux-block, linux-kernel, linux-scsi, John Garry
These two minor patches are tidy-ups for atomic write support.
Both are related to ignoring that REQ_ATOMIC can only be set for writes.
The block change could be considered a fix, as we are needlessly
checking for REQ_ATOMIC in fastpath.
Both changes can be picked up independently.
Thanks!
John Garry (2):
scsi: sd: Don't check if a write for REQ_ATOMIC
block: Don't check REQ_ATOMIC for reads
block/blk-core.c | 1 +
drivers/scsi/sd.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] scsi: sd: Don't check if a write for REQ_ATOMIC
2024-08-05 11:33 [PATCH 0/2] block atomic writes tidy-ups/fix John Garry
@ 2024-08-05 11:33 ` John Garry
2024-08-06 12:12 ` Kanchan Joshi
2024-08-05 11:33 ` [PATCH 2/2] block: Don't check REQ_ATOMIC for reads John Garry
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: John Garry @ 2024-08-05 11:33 UTC (permalink / raw)
To: axboe, James.Bottomley, martin.petersen
Cc: linux-block, linux-kernel, linux-scsi, John Garry
Flag REQ_ATOMIC can only be set for writes, so don't check if the operation
is also a write in sd_setup_read_write_cmnd().
Fixes: bf4ae8f2e640 ("scsi: sd: Atomic write support")
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
drivers/scsi/sd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8bb3a3611851..2ab47fb50c75 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1382,7 +1382,7 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
if (protect && sdkp->protection_type == T10_PI_TYPE2_PROTECTION) {
ret = sd_setup_rw32_cmnd(cmd, write, lba, nr_blocks,
protect | fua, dld);
- } else if (rq->cmd_flags & REQ_ATOMIC && write) {
+ } else if (rq->cmd_flags & REQ_ATOMIC) {
ret = sd_setup_atomic_cmnd(cmd, lba, nr_blocks,
sdkp->use_atomic_write_boundary,
protect | fua);
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] block: Don't check REQ_ATOMIC for reads
2024-08-05 11:33 [PATCH 0/2] block atomic writes tidy-ups/fix John Garry
2024-08-05 11:33 ` [PATCH 1/2] scsi: sd: Don't check if a write for REQ_ATOMIC John Garry
@ 2024-08-05 11:33 ` John Garry
2024-08-06 12:10 ` Kanchan Joshi
2024-08-12 22:03 ` [PATCH 0/2] block atomic writes tidy-ups/fix Martin K. Petersen
2024-08-17 1:35 ` Martin K. Petersen
3 siblings, 1 reply; 7+ messages in thread
From: John Garry @ 2024-08-05 11:33 UTC (permalink / raw)
To: axboe, James.Bottomley, martin.petersen
Cc: linux-block, linux-kernel, linux-scsi, John Garry
We check in submit_bio_noacct() if flag REQ_ATOMIC is set for both read and
write operations, and then validate the atomic operation if set. Flag
REQ_ATOMIC can only be set for writes, so don't bother checking for reads.
Fixes: 9da3d1e912f3 ("block: Add core atomic write support")
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
block/blk-core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/blk-core.c b/block/blk-core.c
index 1217c2cd66dd..bc5e8c5eaac9 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -799,6 +799,7 @@ void submit_bio_noacct(struct bio *bio)
switch (bio_op(bio)) {
case REQ_OP_READ:
+ break;
case REQ_OP_WRITE:
if (bio->bi_opf & REQ_ATOMIC) {
status = blk_validate_atomic_write_op_size(q, bio);
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] block: Don't check REQ_ATOMIC for reads
2024-08-05 11:33 ` [PATCH 2/2] block: Don't check REQ_ATOMIC for reads John Garry
@ 2024-08-06 12:10 ` Kanchan Joshi
0 siblings, 0 replies; 7+ messages in thread
From: Kanchan Joshi @ 2024-08-06 12:10 UTC (permalink / raw)
To: John Garry, axboe, James.Bottomley, martin.petersen
Cc: linux-block, linux-kernel, linux-scsi
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] scsi: sd: Don't check if a write for REQ_ATOMIC
2024-08-05 11:33 ` [PATCH 1/2] scsi: sd: Don't check if a write for REQ_ATOMIC John Garry
@ 2024-08-06 12:12 ` Kanchan Joshi
0 siblings, 0 replies; 7+ messages in thread
From: Kanchan Joshi @ 2024-08-06 12:12 UTC (permalink / raw)
To: John Garry, axboe, James.Bottomley, martin.petersen
Cc: linux-block, linux-kernel, linux-scsi
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] block atomic writes tidy-ups/fix
2024-08-05 11:33 [PATCH 0/2] block atomic writes tidy-ups/fix John Garry
2024-08-05 11:33 ` [PATCH 1/2] scsi: sd: Don't check if a write for REQ_ATOMIC John Garry
2024-08-05 11:33 ` [PATCH 2/2] block: Don't check REQ_ATOMIC for reads John Garry
@ 2024-08-12 22:03 ` Martin K. Petersen
2024-08-17 1:35 ` Martin K. Petersen
3 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2024-08-12 22:03 UTC (permalink / raw)
To: John Garry
Cc: axboe, James.Bottomley, martin.petersen, linux-block,
linux-kernel, linux-scsi
John,
> These two minor patches are tidy-ups for atomic write support.
Applied to 6.12/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] block atomic writes tidy-ups/fix
2024-08-05 11:33 [PATCH 0/2] block atomic writes tidy-ups/fix John Garry
` (2 preceding siblings ...)
2024-08-12 22:03 ` [PATCH 0/2] block atomic writes tidy-ups/fix Martin K. Petersen
@ 2024-08-17 1:35 ` Martin K. Petersen
3 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2024-08-17 1:35 UTC (permalink / raw)
To: axboe, James.Bottomley, John Garry
Cc: Martin K . Petersen, linux-block, linux-kernel, linux-scsi
On Mon, 05 Aug 2024 11:33:13 +0000, John Garry wrote:
> These two minor patches are tidy-ups for atomic write support.
>
> Both are related to ignoring that REQ_ATOMIC can only be set for writes.
>
> The block change could be considered a fix, as we are needlessly
> checking for REQ_ATOMIC in fastpath.
>
> [...]
Applied to 6.12/scsi-queue, thanks!
[1/2] scsi: sd: Don't check if a write for REQ_ATOMIC
https://git.kernel.org/mkp/scsi/c/0c150b30d3d5
[2/2] block: Don't check REQ_ATOMIC for reads
https://git.kernel.org/mkp/scsi/c/ea6787c695ab
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-08-17 1:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-05 11:33 [PATCH 0/2] block atomic writes tidy-ups/fix John Garry
2024-08-05 11:33 ` [PATCH 1/2] scsi: sd: Don't check if a write for REQ_ATOMIC John Garry
2024-08-06 12:12 ` Kanchan Joshi
2024-08-05 11:33 ` [PATCH 2/2] block: Don't check REQ_ATOMIC for reads John Garry
2024-08-06 12:10 ` Kanchan Joshi
2024-08-12 22:03 ` [PATCH 0/2] block atomic writes tidy-ups/fix Martin K. Petersen
2024-08-17 1:35 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®