[PATCH] Avoid unnecessary ide-cd cache flushes
Only issue a cdrom cache flush if we've done write to the drive. The
->media_written() flag keeps track of that.
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 9deca49..beaa561 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -645,7 +645,7 @@
ret = cdrom_mrw_bgformat_susp(cdi, 0);
}
- if (!ret)
+ if (!ret && cdi->media_written)
ret = cdrom_flush_cache(cdi);
return ret;