From: Jens Axboe Date: Sun, 1 May 2005 19:12:52 +0000 (-0700) Subject: [PATCH] Avoid unnecessary ide-cd cache flushes X-Git-Tag: firefly_0821_release~42725^2~75 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7da21a02b3587157bd43910ea6d4c76661228ebb;p=firefly-linux-kernel-4.4.55.git [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 Signed-off-by: Linus Torvalds --- diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 9deca49c71f0..beaa561f2ed8 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -645,7 +645,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi) ret = cdrom_mrw_bgformat_susp(cdi, 0); } - if (!ret) + if (!ret && cdi->media_written) ret = cdrom_flush_cache(cdi); return ret;