@@ -188,14 +188,6 @@ int sb_min_blocksize(struct super_block *sb, int size)
EXPORT_SYMBOL(sb_min_blocksize);
-int sync_blockdev_nowait(struct block_device *bdev)
-{
- if (!bdev)
- return 0;
- 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
* device via its mapping. Does not take the superblock lock.
@@ -1945,7 +1945,7 @@ int fat_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2)
if (!ret && i2)
ret = writeback_inode(i2);
if (!ret)
- ret = sync_blockdev_nowait(sb->s_bdev);
+ ret = filemap_flush(sb->s_bdev_file->f_mapping);
return ret;
}
EXPORT_SYMBOL_GPL(fat_flush_inodes);
@@ -1081,7 +1081,7 @@ int ntfs_flush_inodes(struct super_block *sb, struct inode *i1,
if (!ret && i2)
ret = writeback_inode(i2);
if (!ret)
- ret = sync_blockdev_nowait(sb->s_bdev);
+ ret = filemap_flush(sb->s_bdev_file->f_mapping);
return ret;
}
@@ -57,9 +57,12 @@ int sync_filesystem(struct super_block *sb)
if (ret)
return ret;
}
- ret = sync_blockdev_nowait(sb->s_bdev);
- if (ret)
- return ret;
+
+ if (sb->s_bdev_file) {
+ ret = filemap_flush(sb->s_bdev_file->f_mapping);
+ if (ret)
+ return ret;
+ }
sync_inodes_sb(sb);
if (sb->s_op->sync_fs) {
@@ -1533,7 +1533,6 @@ unsigned int block_size(struct block_device *bdev);
void invalidate_bdev(struct block_device *bdev);
int sync_blockdev(struct block_device *bdev);
int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend);
-int sync_blockdev_nowait(struct block_device *bdev);
void sync_bdevs(bool wait);
void bdev_statx_dioalign(struct inode *inode, struct kstat *stat);
void printk_all_partitions(void);
@@ -1546,10 +1545,6 @@ static inline int sync_blockdev(struct block_device *bdev)
{
return 0;
}
-static inline int sync_blockdev_nowait(struct block_device *bdev)
-{
- return 0;
-}
static inline void sync_bdevs(bool wait)
{
}