[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1218631402.2977.288.camel@pmac.infradead.org>
Date: Wed, 13 Aug 2008 13:43:22 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: Geert Uytterhoeven <Geert.Uytterhoeven@...ycom.com>
Cc: Jens Axboe <jens.axboe@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ric Wheeler <ricwheeler@...il.com>,
linux-fsdevel@...r.kernel.org, gilad@...efidence.com,
matthew@....cx, FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
Linux Kernel Development <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/7] Kill REQ_TYPE_FLUSH
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@...el.com Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists