From 2d9d230089d0a5088bb3b37b01dfddc6527740a6 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 4 Jul 2014 09:07:24 +0200 Subject: block: Add flush callback Some block devices need an explicit callback for flushing written blocks. Add this callback. Signed-off-by: Sascha Hauer --- common/block.c | 3 +++ include/block.h | 1 + 2 files changed, 4 insertions(+) diff --git a/common/block.c b/common/block.c index e522ee425a..0edc8619ef 100644 --- a/common/block.c +++ b/common/block.c @@ -55,6 +55,9 @@ static int writebuffer_flush(struct block_device *blk) } } + if (blk->ops->flush) + return blk->ops->flush(blk); + return 0; } diff --git a/include/block.h b/include/block.h index 872a4c1bba..91377679b0 100644 --- a/include/block.h +++ b/include/block.h @@ -9,6 +9,7 @@ struct block_device; struct block_device_ops { int (*read)(struct block_device *, void *buf, int block, int num_blocks); int (*write)(struct block_device *, const void *buf, int block, int num_blocks); + int (*flush)(struct block_device *); }; struct chunk; -- cgit v1.2.3