From: Jens Axboe <jens.axboe@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ric Wheeler <ricwheeler@gmail.com>,
linux-fsdevel@vger.kernel.org, gilad@codefidence.com
Subject: Re: [PATCH 1/5] [BLOCK] Add 'discard' request handling
Date: Fri, 8 Aug 2008 13:18:29 +0200 [thread overview]
Message-ID: <20080808111829.GP20055@kernel.dk> (raw)
In-Reply-To: <20080808110934.GO20055@kernel.dk>
On Fri, Aug 08 2008, Jens Axboe wrote:
> On Fri, Aug 08 2008, David Woodhouse wrote:
> > On Fri, 2008-08-08 at 12:30 +0200, Jens Axboe wrote:
> > > Not at all, please re-read that part. I objected to adding a strategy
> > > hook just for setting cmd type and flags for discard.
> >
> > Ah, now I understand what you were saying. And I vacillated about that
> > too -- I actually suggested to Gilad that we didn't want it, but then
> > went ahead and did it anyway.
> >
> > Adding the ->discard_fn hook provides two features:
> >
> > Firstly, it allows an early 'abort' of discard requests where the device
> > doesn't support them -- there's no point in allocating the request and
> > passing it down to the device to be discarded there, when we can just
> > notice that there's no ->discard_fn and return immediately from
> > blkdev_issue_discard().
> >
> > Secondly, it allows drivers to insert the appropriate command onto their
> > queue -- I expect that SCSI and ATA drives won't use REQ_TYPE_DISCARD,
> > just as they don't use REQ_TYPE_FLUSH. They'll use REQ_TYPE_BLOCK_PC
> > with whatever opcode is allocated for trim/punch.
> >
> > We _could_ address those two differently -- maybe we could add a
> > QUEUE_FLAG_DISCARDS in q->queue_flags to indicate that discard requests
> > are supported, and we could make the driver 'translate' from
> > REQ_TYPE_DISCARD to whatever it actually wants to do. But that seems
> > strangely different to how we handle flushes, which is what I was basing
> > my implementation on.
> >
>
> Given that discard requests may become quite often issued by drivers, it
> does make sense to optimize for the case where we don't support them as
> well. So perhaps the ->discard_fn() can be tolerated, though I'd rather
> get rid of the ->issue_flush_fn instead :-)
>
> For now, lets just go with the discard_fn, I'll update the patch again.
Actually, my memory is a bit shot, since I got rid of ->issue_flush_fn
in the 2.6.24 cycle. So it's already gone
So, instead, lets check for the appropriate queue flag in
blkdev_issue_flush() and in generic_make_request() when unrolling the
stack. The drive must then do the transformation in the ->prep_fn()
function.
--
Jens Axboe
next prev parent reply other threads:[~2008-08-08 11:18 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <488B7281.4020007@gmail.com>
[not found] ` <20080726130200.f541e604.akpm@linux-foundation.org>
2008-08-05 1:45 ` [RFC] 'discard sectors' block request David Woodhouse
2008-08-05 1:59 ` Andrew Morton
2008-08-05 9:01 ` David Woodhouse
2008-08-05 11:42 ` Jens Axboe
2008-08-05 13:32 ` David Woodhouse
2008-08-05 14:21 ` Ric Wheeler
2008-08-05 16:29 ` David Woodhouse
2008-08-05 17:25 ` David Woodhouse
2008-08-06 9:25 ` [PATCH 1/5] [BLOCK] Add 'discard' request handling David Woodhouse
2008-08-06 16:19 ` OGAWA Hirofumi
2008-08-06 18:18 ` David Woodhouse
2008-08-06 19:28 ` OGAWA Hirofumi
2008-08-07 16:32 ` [PATCH 1/5, v2] " David Woodhouse
2008-08-07 18:41 ` [PATCH 1/5] " Jens Axboe
2008-08-08 9:33 ` David Woodhouse
2008-08-08 10:30 ` Jens Axboe
2008-08-08 10:49 ` Jens Axboe
2008-08-08 11:04 ` David Woodhouse
2008-08-08 11:20 ` Jens Axboe
2008-08-08 10:52 ` David Woodhouse
2008-08-08 11:09 ` Jens Axboe
2008-08-08 11:18 ` Jens Axboe [this message]
2008-08-08 11:29 ` David Woodhouse
2008-08-08 11:44 ` Jens Axboe
2008-08-08 11:47 ` Jens Axboe
2008-08-08 12:05 ` David Woodhouse
2008-08-08 12:13 ` Jens Axboe
2008-08-08 12:32 ` David Woodhouse
2008-08-08 12:37 ` Jens Axboe
2008-08-08 12:49 ` David Woodhouse
2008-08-10 1:05 ` Jamie Lokier
2008-08-08 15:32 ` David Woodhouse
2008-08-08 14:22 ` Matthew Wilcox
2008-08-08 14:27 ` David Woodhouse
2008-08-08 14:34 ` Matthew Wilcox
2008-08-06 9:25 ` [PATCH 2/5] [FAT] Let the block device know when sectors can be discarded David Woodhouse
2008-08-06 16:40 ` OGAWA Hirofumi
2008-08-06 17:14 ` OGAWA Hirofumi
2008-08-06 18:11 ` David Woodhouse
2008-08-06 19:10 ` OGAWA Hirofumi
2008-08-06 19:50 ` OGAWA Hirofumi
2008-08-06 20:10 ` OGAWA Hirofumi
2008-08-06 21:37 ` David Woodhouse
2008-08-07 16:09 ` David Woodhouse
2008-08-07 16:33 ` [PATCH 2/5, v2] " David Woodhouse
2008-08-06 9:25 ` [PATCH 3/5] [MTD] Support 'discard sectors' operation in translation layer support core David Woodhouse
2008-08-06 9:25 ` [PATCH 4/5] [MTD] [FTL] Support 'discard sectors' operation David Woodhouse
2008-08-06 9:25 ` [PATCH 5/5] [BLOCK] Fix up comments about matching flags between bio and rq David Woodhouse
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=20080808111829.GP20055@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=gilad@codefidence.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ricwheeler@gmail.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;
as well as URLs for NNTP newsgroup(s).