From: Mike Snitzer <snitzer@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk, dm-devel@redhat.com, martin.petersen@oracle.com
Subject: Re: [RFC PATCH 2/2] dm: add support for splitting discard requests
Date: Sun, 27 Jun 2010 09:59:00 -0400 [thread overview]
Message-ID: <20100627135853.GB3970@redhat.com> (raw)
In-Reply-To: <20100627094700.GE12016@lst.de>
On Sun, Jun 27 2010 at 5:47am -0400,
Christoph Hellwig <hch@lst.de> wrote:
> On Sat, Jun 26, 2010 at 04:31:25PM -0400, Mike Snitzer wrote:
> > Enable the striped target to support discard requests by splitting a
> > single discard into N discards on a stripe chunk size boundary.
> >
> > Follow on core block layer work to merge discards would be helpful.
> >
> > This work relies on DM's clone_bio() always having BIO_RW_BARRIER set
> > for discard requests. Without BIO_RW_BARRIER the block layer will spew
> > "blk: request botched" warnings for discards that were split by DM.
> > - this clearly needs further investigation!
>
> Btw, you can get discard requests from the upper layer that do not
> have BIO_RW_BARRIER set, currently from the BLKDISCARD ioctl used by
> various mkfs tools, and also from the not yet merged xfs discard
> support.
Yes, I'm aware of the BLKDISCARD ioctl. I added the 'else if' clause
which adds the BIO_RW_BARRIER flag specifically for that case. Testing
showed the mkfs.ext4 uses the BLKDISCARD ioctl and it would result in
"blk: request botched" when operated against a striped DM target (that
was performing the discrad splitting).
> Can I assume it works fine with those?
Yes it works, with or without DM adding the BIO_RW_BARRIER flag, but
without the flag it'll spew "blk: request botched" and the block layer
will fix things up with this at the end of blk_update_request():
/*
* If total number of sectors is less than the first segment
* size, something has gone terribly wrong.
*/
if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) {
printk(KERN_ERR "blk: request botched\n");
req->__data_len = blk_rq_cur_bytes(req);
}
Additional tracing showed blk_rq_bytes(req) was always 0 if DM didn't
set BIO_RW_BARRIER for split discard requests. It could be that if
BIO_RW_BARRIER is set we'll exit early from blk_update_request to
avoid its "blk: request botched"? I'll look closer.
> > - clone->bi_rw &= ~(1 << BIO_RW_BARRIER);
> > + if (!bio_rw_flagged(bio, BIO_RW_DISCARD))
> > + clone->bi_rw &= ~(1 << BIO_RW_BARRIER);
> > + else if (!bio_rw_flagged(bio, BIO_RW_BARRIER)) {
> > + /* discard w/o barrier results in "blk: request botched" */
> > + clone->bi_rw |= (1 << BIO_RW_BARRIER);
> > + }
>
> So previously we unconditionally cleared the BIO_RW_BARRIER bit in the clone.
Yes. I'd like to understand why from Mikulas.
> Maybe to make it clear reorder the if a bit and also just set the
> barrier bit unconditionally for discards, similar to how we
> unconditionally clear it otherwise:
>
> if (bio_rw_flagged(bio, BIO_RW_DISCARD)) {
> /* discard w/o barrier results in "blk: request botched" */
> clone->bi_rw |= (1 << BIO_RW_BARRIER);
> } else {
> clone->bi_rw &= ~(1 << BIO_RW_BARRIER);
> }
>
> maybe even with a slightly longer comment explaining what's actually
> going on here, and a FIXME.
OK, your reorder is clearer. As for a FIXME describing what's going on
here: I'll work to sort that out.. it is still unclear to me why the
BIO_RW_BARRIER flag silences the "blk: request botched" spew from
blk_update_request().
Thanks,
Mike
next prev parent reply other threads:[~2010-06-27 13:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-26 20:31 [PATCH 1/2 v2] dm: discard support for the linear target Mike Snitzer
2010-06-26 20:31 ` [RFC PATCH 2/2] dm: add support for splitting discard requests Mike Snitzer
2010-06-27 9:47 ` Christoph Hellwig
2010-06-27 13:59 ` Mike Snitzer [this message]
2010-06-27 9:49 ` [PATCH 1/2 v2] dm: discard support for the linear target Christoph Hellwig
2010-06-27 13:41 ` Mike Snitzer
2010-06-29 5:25 ` [PATCH 1/2 v3] " Mike Snitzer
2010-06-29 5:33 ` Mike Snitzer
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=20100627135853.GB3970@redhat.com \
--to=snitzer@redhat.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=hch@lst.de \
--cc=martin.petersen@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.