From: David Woodhouse <dwmw2@infradead.org>
To: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Jens Axboe <jens.axboe@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
Ric Wheeler <ricwheeler@gmail.com>,
linux-fsdevel@vger.kernel.org, gilad@codefidence.com,
matthew@wil.cx, FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 11/7] Kill REQ_TYPE_FLUSH
Date: Wed, 13 Aug 2008 13:43:22 +0100 [thread overview]
Message-ID: <1218631402.2977.288.camel@pmac.infradead.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0808131355170.27994@vixen.sonytel.be>
On Wed, 2008-08-13 at 13:58 +0200, Geert Uytterhoeven wrote:
> Note that REQ_LB_OP_FLUSH is also never used.
That can be fixed...
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 681d5ac..8663f3f 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -32,6 +32,13 @@ struct mtd_blkcore_priv {
spinlock_t queue_lock;
};
+static void blktrans_prepare_flush(struct request_queue *q,
+ struct request *req)
+{
+ req->cmd_type = REQ_TYPE_LINUX_BLOCK;
+ req->cmd[0] = REQ_LB_OP_FLUSH;
+}
+
static int blktrans_discard_request(struct request_queue *q,
struct request *req)
{
@@ -53,6 +60,14 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
buf = req->buffer;
if (req->cmd_type == REQ_TYPE_LINUX_BLOCK &&
+ req->cmd[0] == REQ_LB_OP_FLUSH) {
+ if (tr->flush)
+ return !tr->flush(dev);
+ else
+ return 1;
+ }
+
+ if (req->cmd_type == REQ_TYPE_LINUX_BLOCK &&
req->cmd[0] == REQ_LB_OP_DISCARD)
return !tr->discard(dev, block, nsect);
@@ -383,6 +398,9 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
blk_queue_set_discard(tr->blkcore_priv->rq,
blktrans_discard_request);
+ blk_queue_ordered(tr->blkcore_priv->rq, QUEUE_ORDERED_DRAIN_FLUSH,
+ blktrans_prepare_flush);
+
tr->blkshift = ffs(tr->blksize) - 1;
tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr,
> Actually its definition in include/linux/blkdev.h has:
>
> | enum {
> | /*
> | * just examples for now
> ^^^^^^^^^^^^^^^^^^^^^
> | */
> | REQ_LB_OP_EJECT = 0x40, /* eject request */
> | REQ_LB_OP_FLUSH = 0x41, /* flush device */
> | };
>
> which makes me a bit reluctant to make this change.
That can be fixed too...
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 293a71a..7ef582f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -76,11 +75,8 @@ enum rq_cmd_type_bits {
*
*/
enum {
- /*
- * just examples for now
- */
REQ_LB_OP_EJECT = 0x40, /* eject request */
- REQ_LB_OP_FLUSH = 0x41, /* flush device */
+ REQ_LB_OP_FLUSH = 0x41, /* flush request */
REQ_LB_OP_DISCARD = 0x42, /* discard sectors */
};
> BTW, how to test all this flushing behavior, if there are no real
> users?
btrfs uses it.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
prev parent reply other threads:[~2008-08-13 12:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1218299181.26926.88.camel@pmac.infradead.org>
[not found] ` <1218627594.2977.273.camel@pmac.infradead.org>
2008-08-13 11:58 ` Geert Uytterhoeven
2008-08-13 12:43 ` David Woodhouse [this message]
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=1218631402.2977.288.camel@pmac.infradead.org \
--to=dwmw2@infradead.org \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=akpm@linux-foundation.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=gilad@codefidence.com \
--cc=jens.axboe@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--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
all inboxes | Powered by JetHome®