public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ilya Loginov <isloginov@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] mtd: fix mtd_blkdevs problem with caches on some architectures (2.6.31)
Date: Wed, 18 Nov 2009 17:08:10 +0300	[thread overview]
Message-ID: <20091118170810.2bb9cd54.isloginov@gmail.com> (raw)

	Mtdblock driver doesn't call flush_dcache_page for pages in request.
	This may cause problem on architectures where icache doesn't fill from
dcache or with dcache aliases.
	This patch resolves this issue.

Signed-off-by: Ilya Loginov <isloginov@gmail.com>
---
mtd_blkdevs.c |    7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 7baba40..59d5d25 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -46,6 +46,8 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
 {
 	unsigned long block, nsect;
 	char *buf;
+	struct req_iterator iter;
+	struct bio_vec *bvec;
 
 	block = blk_rq_pos(req) << 9 >> tr->blkshift;
 	nsect = blk_rq_cur_bytes(req) >> tr->blkshift;
@@ -68,12 +70,17 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
 		for (; nsect > 0; nsect--, block++, buf += tr->blksize)
 			if (tr->readsect(dev, block, buf))
 				return -EIO;
+		rq_for_each_segment(bvec, req, iter)
+			flush_dcache_page(bvec->bv_page);
 		return 0;
 
 	case WRITE:
 		if (!tr->writesect)
 			return -EIO;
 
+		rq_for_each_segment(bvec, req, iter)
+			flush_dcache_page(bvec->bv_page);
+		
 		for (; nsect > 0; nsect--, block++, buf += tr->blksize)
 			if (tr->writesect(dev, block, buf))
 				return -EIO;

             reply	other threads:[~2009-11-18 14:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-18 14:08 Ilya Loginov [this message]
2009-11-21  0:37 ` [PATCH] mtd: fix mtd_blkdevs problem with caches on some architectures (2.6.31) Andrew Morton
2009-11-21 14:04   ` Ilya Loginov
2009-11-21 17:54     ` Andrew Morton
2009-11-21 23:11       ` Ilya Loginov
2009-11-21 23:26         ` Andrew Morton
2009-11-21 23:36           ` Ilya Loginov
2009-11-22  9:46           ` Ilya Loginov
2009-11-22  9:53             ` David Woodhouse
2009-11-22 18:49               ` Ilya Loginov
2009-11-22 13:29             ` Ingo Molnar
2009-11-22 13:55               ` Ilya Loginov
2009-11-22 18:48                 ` Andrew Morton
2009-11-22 19:18                   ` Ilya Loginov
2009-11-22 19:51                     ` Andrew Morton
2009-11-22 20:55                       ` Ilya Loginov
2009-11-24 20:48                         ` Andrew Morton
2009-11-25  1:01                           ` Ilya Loginov

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=20091118170810.2bb9cd54.isloginov@gmail.com \
    --to=isloginov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.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