[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250116170301.474130-3-john.g.garry@oracle.com>
Date: Thu, 16 Jan 2025 17:02:55 +0000
From: John Garry <john.g.garry@...cle.com>
To: axboe@...nel.dk, agk@...hat.com, mpatocka@...hat.com, hch@....de
Cc: song@...nel.org, yukuai3@...wei.com, kbusch@...nel.org, sagi@...mberg.me,
James.Bottomley@...senPartnership.com, martin.petersen@...cle.com,
linux-block@...r.kernel.org, dm-devel@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
linux-nvme@...ts.infradead.org, linux-scsi@...r.kernel.org,
John Garry <john.g.garry@...cle.com>
Subject: [PATCH RFC v2 2/8] block: Don't trim an atomic write
This is disallowed.
This check will now be relevant since the device mapper personalities
will start to support atomic writes, and they use this function.
Signed-off-by: John Garry <john.g.garry@...cle.com>
---
block/bio.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/bio.c b/block/bio.c
index 4e1a27d312c9..f0c416e5931d 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1610,6 +1610,10 @@ EXPORT_SYMBOL(bio_split);
*/
void bio_trim(struct bio *bio, sector_t offset, sector_t size)
{
+ /* We should never trim an atomic write */
+ if (WARN_ON_ONCE(bio->bi_opf & REQ_ATOMIC && size))
+ return;
+
if (WARN_ON_ONCE(offset > BIO_MAX_SECTORS || size > BIO_MAX_SECTORS ||
offset + size > bio_sectors(bio)))
return;
--
2.31.1
Powered by blists - more mailing lists