Add a new bdev_write_page hook into struct super_operations and called by bdev_writepage(), which could be used by filesystem to propagate private handlers. Signed-off-by: zhangyi (F) <yi.zhang@xxxxxxxxxx> --- fs/block_dev.c | 5 +++++ include/linux/fs.h | 1 + 2 files changed, 6 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 47860e589388..46e25a4e3ebf 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -606,6 +606,11 @@ EXPORT_SYMBOL(thaw_bdev); static int blkdev_writepage(struct page *page, struct writeback_control *wbc) { + struct super_block *super = BDEV_I(page->mapping->host)->bdev.bd_super; + + if (super && super->s_op->bdev_write_page) + return super->s_op->bdev_write_page(page, blkdev_get_block, wbc); + return block_write_full_page(page, blkdev_get_block, wbc); } diff --git a/include/linux/fs.h b/include/linux/fs.h index cffc3619eed5..b87b784c6bc6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1983,6 +1983,7 @@ struct super_operations { struct dquot **(*get_dquots)(struct inode *); #endif int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); + int (*bdev_write_page)(struct page *, get_block_t *, struct writeback_control *); long (*nr_cached_objects)(struct super_block *, struct shrink_control *); long (*free_cached_objects)(struct super_block *, -- 2.25.4