lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 17 Jun 2020 19:59:43 +0800
From:   "zhangyi (F)" <yi.zhang@...wei.com>
To:     <linux-ext4@...r.kernel.org>, <tytso@....edu>, <jack@...e.cz>
CC:     <adilger.kernel@...ger.ca>, <zhangxiaoxu5@...wei.com>,
        <yi.zhang@...wei.com>, <linux-fsdevel@...r.kernel.org>
Subject: [PATCH v2 1/5] fs: add bdev writepage hook to block device

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@...wei.com>
---
 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

Powered by blists - more mailing lists