[PATCH] mtdchar, only call sync if opened RW.

Joakim Tjernlund joakim.tjernlund at transmode.se
Wed Jun 13 07:45:33 EDT 2007


Syncing can take alot of time so
don't do it needlessly.

>From 0dc6ed79711bbb839377b0033ca94a3718760620 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
Date: Wed, 13 Jun 2007 13:37:14 +0200
Subject: [PATCH] mtdchar, only call sync if opened RW.


Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
---
 drivers/mtd/mtdchar.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 3013d08..f4ca980 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -135,7 +135,8 @@ static int mtd_close(struct inode *inode, struct file *file)
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MTD_close\n");
 
-	if (mtd->sync)
+	/* Only sync if opened RW */
+	if ((file->f_mode & 2) && mtd->sync)
 		mtd->sync(mtd);
 
 	put_mtd_device(mtd);
-- 
1.5.2.1





More information about the linux-mtd mailing list