public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: axboe@kernel.dk, agk@redhat.com, mpatocka@redhat.com, hch@lst.de
Cc: song@kernel.org, yukuai3@huawei.com, kbusch@kernel.org,
	sagi@grimberg.me, James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com, linux-block@vger.kernel.org,
	dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org,
	linux-scsi@vger.kernel.org, John Garry <john.g.garry@oracle.com>
Subject: [PATCH RFC v2 2/8] block: Don't trim an atomic write
Date: Thu, 16 Jan 2025 17:02:55 +0000	[thread overview]
Message-ID: <20250116170301.474130-3-john.g.garry@oracle.com> (raw)
In-Reply-To: <20250116170301.474130-1-john.g.garry@oracle.com>

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@oracle.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



  parent reply	other threads:[~2025-01-16 17:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-16 17:02 [PATCH RFC v2 0/8] device mapper atomic write support John Garry
2025-01-16 17:02 ` [PATCH RFC v2 1/8] block: Add common atomic writes enable flag John Garry
2025-01-16 17:02 ` John Garry [this message]
2025-01-16 17:02 ` [PATCH RFC v2 3/8] dm-table: atomic writes support John Garry
2025-01-16 17:02 ` [PATCH RFC v2 4/8] dm: Ensure cloned bio is same length for atomic write John Garry
2025-01-16 17:02 ` [PATCH RFC v2 5/8] dm-linear: Enable atomic writes John Garry
2025-01-16 17:02 ` [PATCH RFC v2 6/8] dm-stripe: " John Garry
2025-01-16 17:03 ` [PATCH RFC v2 7/8] dm-io: Warn on creating multiple atomic write bios for a region John Garry
2025-01-16 17:03 ` [PATCH RFC v2 8/8] dm-mirror: Support atomic writes John Garry
2025-01-17 20:09 ` [PATCH RFC v2 0/8] device mapper atomic write support Mike Snitzer
2025-01-17 20:12   ` Jens Axboe
2025-01-17 21:27   ` Mikulas Patocka
2025-01-17 21:51     ` Mike Snitzer
2025-01-17 20:17 ` (subset) " Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250116170301.474130-3-john.g.garry@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mpatocka@redhat.com \
    --cc=sagi@grimberg.me \
    --cc=song@kernel.org \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox