All of lore.kernel.org
 help / color / mirror / Atom feed
* cleanup block device inode syncing
@ 2021-10-19  6:25 Christoph Hellwig
  2021-10-19  6:25 ` [PATCH 1/7] fs: remove __sync_filesystem Christoph Hellwig
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Christoph Hellwig @ 2021-10-19  6:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

Hi Jens,

this series refactors parts of the sync code so that we have and always
use proper helpers for syncing data cached in the block device inode.

Diffstat:
 block/bdev.c                       |   28 +++++++++++-----
 drivers/block/xen-blkback/xenbus.c |    2 -
 fs/btrfs/volumes.c                 |    2 -
 fs/fat/inode.c                     |    6 +--
 fs/internal.h                      |   11 ------
 fs/ntfs3/inode.c                   |    2 -
 fs/sync.c                          |   62 +++++++++++++------------------------
 include/linux/blkdev.h             |    9 +++++
 8 files changed, 56 insertions(+), 66 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/7] fs: remove __sync_filesystem
  2021-10-19  6:25 cleanup block device inode syncing Christoph Hellwig
@ 2021-10-19  6:25 ` Christoph Hellwig
  2021-10-19  6:33   ` Chaitanya Kulkarni
  2021-10-19  6:25 ` [PATCH 2/7] block: remove __sync_blockdev Christoph Hellwig
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2021-10-19  6:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

There is no clear benefit in having this helper vs just open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/sync.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/fs/sync.c b/fs/sync.c
index 1373a610dc784..0d6cdc507cb98 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -21,25 +21,6 @@
 #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \
 			SYNC_FILE_RANGE_WAIT_AFTER)
 
-/*
- * Do the filesystem syncing work. For simple filesystems
- * writeback_inodes_sb(sb) just dirties buffers with inodes so we have to
- * submit IO for these buffers via __sync_blockdev(). This also speeds up the
- * wait == 1 case since in that case write_inode() functions do
- * sync_dirty_buffer() and thus effectively write one block at a time.
- */
-static int __sync_filesystem(struct super_block *sb, int wait)
-{
-	if (wait)
-		sync_inodes_sb(sb);
-	else
-		writeback_inodes_sb(sb, WB_REASON_SYNC);
-
-	if (sb->s_op->sync_fs)
-		sb->s_op->sync_fs(sb, wait);
-	return __sync_blockdev(sb->s_bdev, wait);
-}
-
 /*
  * Write out and wait upon all dirty data associated with this
  * superblock.  Filesystem data as well as the underlying block
@@ -61,10 +42,25 @@ int sync_filesystem(struct super_block *sb)
 	if (sb_rdonly(sb))
 		return 0;
 
-	ret = __sync_filesystem(sb, 0);
+	/*
+	 * Do the filesystem syncing work.  For simple filesystems
+	 * writeback_inodes_sb(sb) just dirties buffers with inodes so we have
+	 * to submit I/O for these buffers via __sync_blockdev().  This also
+	 * speeds up the wait == 1 case since in that case write_inode()
+	 * methods call sync_dirty_buffer() and thus effectively write one block
+	 * at a time.
+	 */
+	writeback_inodes_sb(sb, WB_REASON_SYNC);
+	if (sb->s_op->sync_fs)
+		sb->s_op->sync_fs(sb, 0);
+	ret = __sync_blockdev(sb->s_bdev, 0);
 	if (ret < 0)
 		return ret;
-	return __sync_filesystem(sb, 1);
+
+	sync_inodes_sb(sb);
+	if (sb->s_op->sync_fs)
+		sb->s_op->sync_fs(sb, 1);
+	return __sync_blockdev(sb->s_bdev, 1);
 }
 EXPORT_SYMBOL(sync_filesystem);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/7] block: remove __sync_blockdev
  2021-10-19  6:25 cleanup block device inode syncing Christoph Hellwig
  2021-10-19  6:25 ` [PATCH 1/7] fs: remove __sync_filesystem Christoph Hellwig
@ 2021-10-19  6:25 ` Christoph Hellwig
  2021-10-19  6:25 ` [PATCH 3/7] xen-blkback: use sync_blockdev Christoph Hellwig
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2021-10-19  6:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

Instead offer a new sync_blockdev_nowait helper for the !wait case.
This new helper is exported as it will grow modular callers in a bit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bdev.c           | 11 ++++++-----
 fs/internal.h          |  5 -----
 fs/sync.c              |  7 ++++---
 include/linux/blkdev.h |  5 +++++
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/block/bdev.c b/block/bdev.c
index cff0bb3a4578f..fe91209881730 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -185,14 +185,13 @@ int sb_min_blocksize(struct super_block *sb, int size)
 
 EXPORT_SYMBOL(sb_min_blocksize);
 
-int __sync_blockdev(struct block_device *bdev, int wait)
+int sync_blockdev_nowait(struct block_device *bdev)
 {
 	if (!bdev)
 		return 0;
-	if (!wait)
-		return filemap_flush(bdev->bd_inode->i_mapping);
-	return filemap_write_and_wait(bdev->bd_inode->i_mapping);
+	return filemap_flush(bdev->bd_inode->i_mapping);
 }
+EXPORT_SYMBOL_GPL(sync_blockdev_nowait);
 
 /*
  * Write out and wait upon all the dirty data associated with a block
@@ -200,7 +199,9 @@ int __sync_blockdev(struct block_device *bdev, int wait)
  */
 int sync_blockdev(struct block_device *bdev)
 {
-	return __sync_blockdev(bdev, 1);
+	if (!bdev)
+		return 0;
+	return filemap_write_and_wait(bdev->bd_inode->i_mapping);
 }
 EXPORT_SYMBOL(sync_blockdev);
 
diff --git a/fs/internal.h b/fs/internal.h
index 3cd065c8a66b4..b5caa16f4645d 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -23,7 +23,6 @@ struct pipe_inode_info;
 #ifdef CONFIG_BLOCK
 extern void __init bdev_cache_init(void);
 
-extern int __sync_blockdev(struct block_device *bdev, int wait);
 void iterate_bdevs(void (*)(struct block_device *, void *), void *);
 void emergency_thaw_bdev(struct super_block *sb);
 #else
@@ -31,10 +30,6 @@ static inline void bdev_cache_init(void)
 {
 }
 
-static inline int __sync_blockdev(struct block_device *bdev, int wait)
-{
-	return 0;
-}
 static inline void iterate_bdevs(void (*f)(struct block_device *, void *),
 		void *arg)
 {
diff --git a/fs/sync.c b/fs/sync.c
index 0d6cdc507cb98..a621089eb07ee 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -3,6 +3,7 @@
  * High-level sync()-related operations
  */
 
+#include <linux/blkdev.h>
 #include <linux/kernel.h>
 #include <linux/file.h>
 #include <linux/fs.h>
@@ -45,7 +46,7 @@ int sync_filesystem(struct super_block *sb)
 	/*
 	 * Do the filesystem syncing work.  For simple filesystems
 	 * writeback_inodes_sb(sb) just dirties buffers with inodes so we have
-	 * to submit I/O for these buffers via __sync_blockdev().  This also
+	 * to submit I/O for these buffers via sync_blockdev().  This also
 	 * speeds up the wait == 1 case since in that case write_inode()
 	 * methods call sync_dirty_buffer() and thus effectively write one block
 	 * at a time.
@@ -53,14 +54,14 @@ int sync_filesystem(struct super_block *sb)
 	writeback_inodes_sb(sb, WB_REASON_SYNC);
 	if (sb->s_op->sync_fs)
 		sb->s_op->sync_fs(sb, 0);
-	ret = __sync_blockdev(sb->s_bdev, 0);
+	ret = sync_blockdev_nowait(sb->s_bdev);
 	if (ret < 0)
 		return ret;
 
 	sync_inodes_sb(sb);
 	if (sb->s_op->sync_fs)
 		sb->s_op->sync_fs(sb, 1);
-	return __sync_blockdev(sb->s_bdev, 1);
+	return sync_blockdev(sb->s_bdev);
 }
 EXPORT_SYMBOL(sync_filesystem);
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index fd9771a1da096..67a3b9e04233f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1285,6 +1285,7 @@ int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart,
 #ifdef CONFIG_BLOCK
 void invalidate_bdev(struct block_device *bdev);
 int sync_blockdev(struct block_device *bdev);
+int sync_blockdev_nowait(struct block_device *bdev);
 #else
 static inline void invalidate_bdev(struct block_device *bdev)
 {
@@ -1293,6 +1294,10 @@ static inline int sync_blockdev(struct block_device *bdev)
 {
 	return 0;
 }
+static inline int sync_blockdev_nowait(struct block_device *bdev)
+{
+	return 0;
+}
 #endif
 int fsync_bdev(struct block_device *bdev);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/7] xen-blkback: use sync_blockdev
  2021-10-19  6:25 cleanup block device inode syncing Christoph Hellwig
  2021-10-19  6:25 ` [PATCH 1/7] fs: remove __sync_filesystem Christoph Hellwig
  2021-10-19  6:25 ` [PATCH 2/7] block: remove __sync_blockdev Christoph Hellwig
@ 2021-10-19  6:25 ` Christoph Hellwig
  2021-10-19  6:33   ` Chaitanya Kulkarni
  2021-10-19  6:25 ` [PATCH 4/7] btrfs: " Christoph Hellwig
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2021-10-19  6:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

Use sync_blockdev instead of opencoding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/xen-blkback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 33eba3df4dd9a..914587aabca0c 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -98,7 +98,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif)
 		return;
 	}
 
-	err = filemap_write_and_wait(blkif->vbd.bdev->bd_inode->i_mapping);
+	err = sync_blockdev(blkif->vbd.bdev);
 	if (err) {
 		xenbus_dev_error(blkif->be->dev, err, "block flush");
 		return;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/7] btrfs: use sync_blockdev
  2021-10-19  6:25 cleanup block device inode syncing Christoph Hellwig
                   ` (2 preceding siblings ...)
  2021-10-19  6:25 ` [PATCH 3/7] xen-blkback: use sync_blockdev Christoph Hellwig
@ 2021-10-19  6:25 ` Christoph Hellwig
  2021-10-19  6:34   ` Chaitanya Kulkarni
  2021-10-19 13:54   ` David Sterba
  2021-10-19  6:25 ` [PATCH 5/7] fat: use sync_blockdev_nowait Christoph Hellwig
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 14+ messages in thread
From: Christoph Hellwig @ 2021-10-19  6:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

Use sync_blockdev instead of opencoding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 2ec3b8ac8fa35..b51e4b464103e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -508,7 +508,7 @@ btrfs_get_bdev_and_sb(const char *device_path, fmode_t flags, void *holder,
 	}
 
 	if (flush)
-		filemap_write_and_wait((*bdev)->bd_inode->i_mapping);
+		sync_blockdev(*bdev);
 	ret = set_blocksize(*bdev, BTRFS_BDEV_BLOCKSIZE);
 	if (ret) {
 		blkdev_put(*bdev, flags);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/7] fat: use sync_blockdev_nowait
  2021-10-19  6:25 cleanup block device inode syncing Christoph Hellwig
                   ` (3 preceding siblings ...)
  2021-10-19  6:25 ` [PATCH 4/7] btrfs: " Christoph Hellwig
@ 2021-10-19  6:25 ` Christoph Hellwig
  2021-10-19  6:34   ` Chaitanya Kulkarni
  2021-10-19  6:25 ` [PATCH 6/7] ntfs3: " Christoph Hellwig
  2021-10-19  6:25 ` [PATCH 7/7] block: simplify the block device syncing code Christoph Hellwig
  6 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2021-10-19  6:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

Use sync_blockdev_nowait instead of opencoding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/fat/inode.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index de0c9b013a851..2fd5bfddb6958 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1943,10 +1943,8 @@ int fat_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2)
 		ret = writeback_inode(i1);
 	if (!ret && i2)
 		ret = writeback_inode(i2);
-	if (!ret) {
-		struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
-		ret = filemap_flush(mapping);
-	}
+	if (!ret)
+		ret = sync_blockdev_nowait(sb->s_bdev);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(fat_flush_inodes);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/7] ntfs3: use sync_blockdev_nowait
  2021-10-19  6:25 cleanup block device inode syncing Christoph Hellwig
                   ` (4 preceding siblings ...)
  2021-10-19  6:25 ` [PATCH 5/7] fat: use sync_blockdev_nowait Christoph Hellwig
@ 2021-10-19  6:25 ` Christoph Hellwig
  2021-10-19  6:34   ` Chaitanya Kulkarni
  2021-10-19  6:25 ` [PATCH 7/7] block: simplify the block device syncing code Christoph Hellwig
  6 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2021-10-19  6:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

Use sync_blockdev_nowait instead of opencoding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/ntfs3/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 859951d785cb2..a87ab3ad3cd38 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -1046,7 +1046,7 @@ int ntfs_flush_inodes(struct super_block *sb, struct inode *i1,
 	if (!ret && i2)
 		ret = writeback_inode(i2);
 	if (!ret)
-		ret = filemap_flush(sb->s_bdev->bd_inode->i_mapping);
+		ret = sync_blockdev_nowait(sb->s_bdev);
 	return ret;
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 7/7] block: simplify the block device syncing code
  2021-10-19  6:25 cleanup block device inode syncing Christoph Hellwig
                   ` (5 preceding siblings ...)
  2021-10-19  6:25 ` [PATCH 6/7] ntfs3: " Christoph Hellwig
@ 2021-10-19  6:25 ` Christoph Hellwig
  6 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2021-10-19  6:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

Get rid of the indirections and just provide a sync_bdevs
helper for the generic sync code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bdev.c           | 17 ++++++++++++++---
 fs/internal.h          |  6 ------
 fs/sync.c              | 23 ++++-------------------
 include/linux/blkdev.h |  4 ++++
 4 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/block/bdev.c b/block/bdev.c
index fe91209881730..3a8a753f970bb 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -1019,7 +1019,7 @@ int __invalidate_device(struct block_device *bdev, bool kill_dirty)
 }
 EXPORT_SYMBOL(__invalidate_device);
 
-void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
+void sync_bdevs(bool wait)
 {
 	struct inode *inode, *old_inode = NULL;
 
@@ -1050,8 +1050,19 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
 		bdev = I_BDEV(inode);
 
 		mutex_lock(&bdev->bd_disk->open_mutex);
-		if (bdev->bd_openers)
-			func(bdev, arg);
+		if (!bdev->bd_openers) {
+			; /* skip */
+		} else if (wait) {
+			/*
+			 * We keep the error status of individual mapping so
+			 * that applications can catch the writeback error using
+			 * fsync(2). See filemap_fdatawait_keep_errors() for
+			 * details.
+			 */
+			filemap_fdatawait_keep_errors(inode->i_mapping);
+		} else {
+			filemap_fdatawrite(inode->i_mapping);
+		}
 		mutex_unlock(&bdev->bd_disk->open_mutex);
 
 		spin_lock(&blockdev_superblock->s_inode_list_lock);
diff --git a/fs/internal.h b/fs/internal.h
index b5caa16f4645d..cdd83d4899bb3 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -23,17 +23,11 @@ struct pipe_inode_info;
 #ifdef CONFIG_BLOCK
 extern void __init bdev_cache_init(void);
 
-void iterate_bdevs(void (*)(struct block_device *, void *), void *);
 void emergency_thaw_bdev(struct super_block *sb);
 #else
 static inline void bdev_cache_init(void)
 {
 }
-
-static inline void iterate_bdevs(void (*f)(struct block_device *, void *),
-		void *arg)
-{
-}
 static inline int emergency_thaw_bdev(struct super_block *sb)
 {
 	return 0;
diff --git a/fs/sync.c b/fs/sync.c
index a621089eb07ee..3ce8e2137f310 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -78,21 +78,6 @@ static void sync_fs_one_sb(struct super_block *sb, void *arg)
 		sb->s_op->sync_fs(sb, *(int *)arg);
 }
 
-static void fdatawrite_one_bdev(struct block_device *bdev, void *arg)
-{
-	filemap_fdatawrite(bdev->bd_inode->i_mapping);
-}
-
-static void fdatawait_one_bdev(struct block_device *bdev, void *arg)
-{
-	/*
-	 * We keep the error status of individual mapping so that
-	 * applications can catch the writeback error using fsync(2).
-	 * See filemap_fdatawait_keep_errors() for details.
-	 */
-	filemap_fdatawait_keep_errors(bdev->bd_inode->i_mapping);
-}
-
 /*
  * Sync everything. We start by waking flusher threads so that most of
  * writeback runs on all devices in parallel. Then we sync all inodes reliably
@@ -111,8 +96,8 @@ void ksys_sync(void)
 	iterate_supers(sync_inodes_one_sb, NULL);
 	iterate_supers(sync_fs_one_sb, &nowait);
 	iterate_supers(sync_fs_one_sb, &wait);
-	iterate_bdevs(fdatawrite_one_bdev, NULL);
-	iterate_bdevs(fdatawait_one_bdev, NULL);
+	sync_bdevs(false);
+	sync_bdevs(true);
 	if (unlikely(laptop_mode))
 		laptop_sync_completion();
 }
@@ -133,10 +118,10 @@ static void do_sync_work(struct work_struct *work)
 	 */
 	iterate_supers(sync_inodes_one_sb, &nowait);
 	iterate_supers(sync_fs_one_sb, &nowait);
-	iterate_bdevs(fdatawrite_one_bdev, NULL);
+	sync_bdevs(false);
 	iterate_supers(sync_inodes_one_sb, &nowait);
 	iterate_supers(sync_fs_one_sb, &nowait);
-	iterate_bdevs(fdatawrite_one_bdev, NULL);
+	sync_bdevs(false);
 	printk("Emergency Sync complete\n");
 	kfree(work);
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 67a3b9e04233f..4bb9c621e0ac3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1286,6 +1286,7 @@ int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart,
 void invalidate_bdev(struct block_device *bdev);
 int sync_blockdev(struct block_device *bdev);
 int sync_blockdev_nowait(struct block_device *bdev);
+void sync_bdevs(bool wait);
 #else
 static inline void invalidate_bdev(struct block_device *bdev)
 {
@@ -1298,6 +1299,9 @@ static inline int sync_blockdev_nowait(struct block_device *bdev)
 {
 	return 0;
 }
+static inline void sync_bdevs(bool wait)
+{
+}
 #endif
 int fsync_bdev(struct block_device *bdev);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/7] fs: remove __sync_filesystem
  2021-10-19  6:25 ` [PATCH 1/7] fs: remove __sync_filesystem Christoph Hellwig
@ 2021-10-19  6:33   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 14+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-19  6:33 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

On 10/18/2021 11:25 PM, Christoph Hellwig wrote:
> There is no clear benefit in having this helper vs just open coding it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Especially if there is only one caller.

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/7] xen-blkback: use sync_blockdev
  2021-10-19  6:25 ` [PATCH 3/7] xen-blkback: use sync_blockdev Christoph Hellwig
@ 2021-10-19  6:33   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 14+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-19  6:33 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

On 10/18/2021 11:25 PM, Christoph Hellwig wrote:
> Use sync_blockdev instead of opencoding it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/7] btrfs: use sync_blockdev
  2021-10-19  6:25 ` [PATCH 4/7] btrfs: " Christoph Hellwig
@ 2021-10-19  6:34   ` Chaitanya Kulkarni
  2021-10-19 13:54   ` David Sterba
  1 sibling, 0 replies; 14+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-19  6:34 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

On 10/18/2021 11:25 PM, Christoph Hellwig wrote:
> Use sync_blockdev instead of opencoding it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/7] fat: use sync_blockdev_nowait
  2021-10-19  6:25 ` [PATCH 5/7] fat: use sync_blockdev_nowait Christoph Hellwig
@ 2021-10-19  6:34   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 14+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-19  6:34 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

On 10/18/2021 11:25 PM, Christoph Hellwig wrote:
> Use sync_blockdev_nowait instead of opencoding it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 6/7] ntfs3: use sync_blockdev_nowait
  2021-10-19  6:25 ` [PATCH 6/7] ntfs3: " Christoph Hellwig
@ 2021-10-19  6:34   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 14+ messages in thread
From: Chaitanya Kulkarni @ 2021-10-19  6:34 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

On 10/18/2021 11:25 PM, Christoph Hellwig wrote:
> Use sync_blockdev_nowait instead of opencoding it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/7] btrfs: use sync_blockdev
  2021-10-19  6:25 ` [PATCH 4/7] btrfs: " Christoph Hellwig
  2021-10-19  6:34   ` Chaitanya Kulkarni
@ 2021-10-19 13:54   ` David Sterba
  1 sibling, 0 replies; 14+ messages in thread
From: David Sterba @ 2021-10-19 13:54 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Roger Pau Monné,
	Josef Bacik, David Sterba, OGAWA Hirofumi, Konstantin Komarov,
	linux-block, xen-devel, linux-btrfs, linux-fsdevel, ntfs3

On Tue, Oct 19, 2021 at 08:25:27AM +0200, Christoph Hellwig wrote:
> Use sync_blockdev instead of opencoding it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-10-19 13:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19  6:25 cleanup block device inode syncing Christoph Hellwig
2021-10-19  6:25 ` [PATCH 1/7] fs: remove __sync_filesystem Christoph Hellwig
2021-10-19  6:33   ` Chaitanya Kulkarni
2021-10-19  6:25 ` [PATCH 2/7] block: remove __sync_blockdev Christoph Hellwig
2021-10-19  6:25 ` [PATCH 3/7] xen-blkback: use sync_blockdev Christoph Hellwig
2021-10-19  6:33   ` Chaitanya Kulkarni
2021-10-19  6:25 ` [PATCH 4/7] btrfs: " Christoph Hellwig
2021-10-19  6:34   ` Chaitanya Kulkarni
2021-10-19 13:54   ` David Sterba
2021-10-19  6:25 ` [PATCH 5/7] fat: use sync_blockdev_nowait Christoph Hellwig
2021-10-19  6:34   ` Chaitanya Kulkarni
2021-10-19  6:25 ` [PATCH 6/7] ntfs3: " Christoph Hellwig
2021-10-19  6:34   ` Chaitanya Kulkarni
2021-10-19  6:25 ` [PATCH 7/7] block: simplify the block device syncing code Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.