mtd: mtd_blkdevs: handle REQ_FLUSH request and do explicit flush of writeback buffer
authorRoman Peniaev <r.peniaev@gmail.com>
Sat, 8 Mar 2014 12:59:14 +0000 (21:59 +0900)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 16 Apr 2014 06:25:37 +0000 (23:25 -0700)
commit566c0d6a74169dc5cc9f353ff4a8d579d96a85ff
tree11e9a6727d03c958f40843454be9c810e5f70f7b
parent47570bb1f533b2a48e5222db8545b7842c229331
mtd: mtd_blkdevs: handle REQ_FLUSH request and do explicit flush of writeback buffer

mtd_blkdevs is device with volatile cache (writeback buffer), so it should support
REQ_FLUSH to do explicit flush.

Without this patch 'sync' does not guarantee that writeback buffer will be flushed
on disk in case of power off, e.g.:

  $ cp some_file /mnt
  $ sync

  ### POWER OFF

In case of this sequence writeback buffer will not be flushed on disk.

This patch fixes this behaviour and explicitly reports to block layer that flush
requests are being supported.

Signed-off-by: Roman Peniaev <r.peniaev@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/mtd_blkdevs.c