From: Kent Overstreet <kmo@daterainc.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Hugh Dickins <hughd@google.com>, Jens Axboe <axboe@kernel.dk>,
Shaohua Li <shli@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: next bio iters break discard?
Date: Tue, 14 Jan 2014 14:24:24 -0800 [thread overview]
Message-ID: <20140114222424.GA7333@moria.home.lan> (raw)
In-Reply-To: <yq1ob3el3mr.fsf@sermon.lab.mkp.net>
On Tue, Jan 14, 2014 at 03:17:32PM -0500, Martin K. Petersen wrote:
> >>>>> "Kent" == Kent Overstreet <kmo@daterainc.com> writes:
>
> >> IOW, DISCARD, WRITE SAME and the impending COPY requests do not have
> >> a 1:1 mapping between the block range worked on and the size of any
> >> bvecs attached. Your recent changes must have changed the way we
> >> handled that in the past.
>
> Kent> Yeah - but with WRITE_SAME bios, wouldn't we at least have to
> Kent> check that they're writing the same data to merge them?
>
> We do. Check blk_write_same_mergeable().
Aha, I missed that.
Side note, one of the things on my todo list/wishlist is make a separate
enum for bio type - bare flush, normal read/write, scsi command, discard
and write same. In particular with bi_size meaning different things
depending on the type of the command, I think having an enum we can
switch off of where appropriate instead of a bunch of random flags will
make things a hell of a lot saner.
Looking more at this code, I'm not sure it did what we wanted before for
REQ_DISCARD and REQ_WRITE_SAME bios/requests - I suspect for
REQ_WRITE_SAME requests that had been merged it overcounted.
There's also that horrible hack in the scsi (?) code Christoph added for
discards - where the driver adds a page to the bio - if the driver is
counting the number of segments _after_ that god only knows what is
supposed to happen.
Does the below patch look like what we want? I'm assuming that if
multiple WRITE_SAME bios are merged, since they're all writing the same
data we can consider the entire request to be a single segment.
commit 1755e7ffc5745591d37b8956ce2512f4052a104a
Author: Kent Overstreet <kmo@daterainc.com>
Date: Tue Jan 14 14:22:01 2014 -0800
block: Explicitly handle discard/write same when counting segments
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 8f8adaa..7d977f8 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -21,6 +21,12 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
if (!bio)
return 0;
+ if (bio->bi_rw & REQ_DISCARD)
+ return 0;
+
+ if (bio->bi_rw & REQ_WRITE_SAME)
+ return 1;
+
fbio = bio;
cluster = blk_queue_cluster(q);
seg_size = 0;
next prev parent reply other threads:[~2014-01-14 22:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 3:52 Hugh Dickins
2014-01-14 2:33 ` Kent Overstreet
2014-01-14 4:06 ` Martin K. Petersen
2014-01-14 4:48 ` Kent Overstreet
2014-01-14 20:17 ` Martin K. Petersen
2014-01-14 22:24 ` Kent Overstreet [this message]
2014-01-16 1:39 ` Martin K. Petersen
2014-01-16 20:21 ` Hugh Dickins
2014-01-17 1:06 ` Kent Overstreet
2014-01-17 1:21 ` Kent Overstreet
2014-01-31 17:17 ` Hugh Dickins
2014-01-31 21:58 ` Jens Axboe
2014-02-04 10:17 ` [PATCH] block: Explicitly handle discard/write same segments Kent Overstreet
2014-02-04 12:25 ` Hugh Dickins
2014-02-04 12:35 ` Kent Overstreet
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=20140114222424.GA7333@moria.home.lan \
--to=kmo@daterainc.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=shli@kernel.org \
/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
all inboxes | Powered by JetHome®