Commit a9185b41 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

pass writeback_control to ->write_inode

This gives the filesystem more information about the writeback that
is happening.  Trond requested this for the NFS unstable write handling,
and other filesystems might benefit from this too by beeing able to
distinguish between the different callers in more detail.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 26821ed4
...@@ -121,7 +121,7 @@ struct adfs_discmap { ...@@ -121,7 +121,7 @@ struct adfs_discmap {
/* Inode stuff */ /* Inode stuff */
struct inode *adfs_iget(struct super_block *sb, struct object_info *obj); struct inode *adfs_iget(struct super_block *sb, struct object_info *obj);
int adfs_write_inode(struct inode *inode,int unused); int adfs_write_inode(struct inode *inode, struct writeback_control *wbc);
int adfs_notify_change(struct dentry *dentry, struct iattr *attr); int adfs_notify_change(struct dentry *dentry, struct iattr *attr);
/* map.c */ /* map.c */
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/writeback.h>
#include "adfs.h" #include "adfs.h"
/* /*
...@@ -360,7 +361,7 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr) ...@@ -360,7 +361,7 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr)
* The adfs-specific inode data has already been updated by * The adfs-specific inode data has already been updated by
* adfs_notify_change() * adfs_notify_change()
*/ */
int adfs_write_inode(struct inode *inode, int wait) int adfs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct object_info obj; struct object_info obj;
...@@ -375,7 +376,7 @@ int adfs_write_inode(struct inode *inode, int wait) ...@@ -375,7 +376,7 @@ int adfs_write_inode(struct inode *inode, int wait)
obj.attr = ADFS_I(inode)->attr; obj.attr = ADFS_I(inode)->attr;
obj.size = inode->i_size; obj.size = inode->i_size;
ret = adfs_dir_update(sb, &obj, wait); ret = adfs_dir_update(sb, &obj, wbc->sync_mode == WB_SYNC_ALL);
unlock_kernel(); unlock_kernel();
return ret; return ret;
} }
...@@ -175,7 +175,8 @@ extern void affs_delete_inode(struct inode *inode); ...@@ -175,7 +175,8 @@ extern void affs_delete_inode(struct inode *inode);
extern void affs_clear_inode(struct inode *inode); extern void affs_clear_inode(struct inode *inode);
extern struct inode *affs_iget(struct super_block *sb, extern struct inode *affs_iget(struct super_block *sb,
unsigned long ino); unsigned long ino);
extern int affs_write_inode(struct inode *inode, int); extern int affs_write_inode(struct inode *inode,
struct writeback_control *wbc);
extern int affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type); extern int affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type);
/* file.c */ /* file.c */
......
...@@ -166,7 +166,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) ...@@ -166,7 +166,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
} }
int int
affs_write_inode(struct inode *inode, int unused) affs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct buffer_head *bh; struct buffer_head *bh;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/vfs.h> #include <linux/vfs.h>
#include <linux/writeback.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "bfs.h" #include "bfs.h"
...@@ -98,7 +99,7 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino) ...@@ -98,7 +99,7 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
static int bfs_write_inode(struct inode *inode, int wait) static int bfs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
struct bfs_sb_info *info = BFS_SB(inode->i_sb); struct bfs_sb_info *info = BFS_SB(inode->i_sb);
unsigned int ino = (u16)inode->i_ino; unsigned int ino = (u16)inode->i_ino;
...@@ -147,7 +148,7 @@ static int bfs_write_inode(struct inode *inode, int wait) ...@@ -147,7 +148,7 @@ static int bfs_write_inode(struct inode *inode, int wait)
di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1); di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1);
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
if (wait) { if (wbc->sync_mode == WB_SYNC_ALL) {
sync_dirty_buffer(bh); sync_dirty_buffer(bh);
if (buffer_req(bh) && !buffer_uptodate(bh)) if (buffer_req(bh) && !buffer_uptodate(bh))
err = -EIO; err = -EIO;
......
...@@ -2326,7 +2326,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); ...@@ -2326,7 +2326,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
int btrfs_readpage(struct file *file, struct page *page); int btrfs_readpage(struct file *file, struct page *page);
void btrfs_delete_inode(struct inode *inode); void btrfs_delete_inode(struct inode *inode);
void btrfs_put_inode(struct inode *inode); void btrfs_put_inode(struct inode *inode);
int btrfs_write_inode(struct inode *inode, int wait); int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
void btrfs_dirty_inode(struct inode *inode); void btrfs_dirty_inode(struct inode *inode);
struct inode *btrfs_alloc_inode(struct super_block *sb); struct inode *btrfs_alloc_inode(struct super_block *sb);
void btrfs_destroy_inode(struct inode *inode); void btrfs_destroy_inode(struct inode *inode);
......
...@@ -3968,7 +3968,7 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, ...@@ -3968,7 +3968,7 @@ static int btrfs_real_readdir(struct file *filp, void *dirent,
return ret; return ret;
} }
int btrfs_write_inode(struct inode *inode, int wait) int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
...@@ -3977,7 +3977,7 @@ int btrfs_write_inode(struct inode *inode, int wait) ...@@ -3977,7 +3977,7 @@ int btrfs_write_inode(struct inode *inode, int wait)
if (root->fs_info->btree_inode == inode) if (root->fs_info->btree_inode == inode)
return 0; return 0;
if (wait) { if (wbc->sync_mode == WB_SYNC_ALL) {
trans = btrfs_join_transaction(root, 1); trans = btrfs_join_transaction(root, 1);
btrfs_set_trans_block_group(trans, inode); btrfs_set_trans_block_group(trans, inode);
ret = btrfs_commit_transaction(trans, root); ret = btrfs_commit_transaction(trans, root);
......
...@@ -261,7 +261,7 @@ int exofs_write_begin(struct file *file, struct address_space *mapping, ...@@ -261,7 +261,7 @@ int exofs_write_begin(struct file *file, struct address_space *mapping,
struct page **pagep, void **fsdata); struct page **pagep, void **fsdata);
extern struct inode *exofs_iget(struct super_block *, unsigned long); extern struct inode *exofs_iget(struct super_block *, unsigned long);
struct inode *exofs_new_inode(struct inode *, int); struct inode *exofs_new_inode(struct inode *, int);
extern int exofs_write_inode(struct inode *, int); extern int exofs_write_inode(struct inode *, struct writeback_control *wbc);
extern void exofs_delete_inode(struct inode *); extern void exofs_delete_inode(struct inode *);
/* dir.c: */ /* dir.c: */
......
...@@ -1280,9 +1280,9 @@ static int exofs_update_inode(struct inode *inode, int do_sync) ...@@ -1280,9 +1280,9 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
return ret; return ret;
} }
int exofs_write_inode(struct inode *inode, int wait) int exofs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
return exofs_update_inode(inode, wait); return exofs_update_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
} }
/* /*
......
...@@ -118,7 +118,7 @@ extern unsigned long ext2_count_free (struct buffer_head *, unsigned); ...@@ -118,7 +118,7 @@ extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
/* inode.c */ /* inode.c */
extern struct inode *ext2_iget (struct super_block *, unsigned long); extern struct inode *ext2_iget (struct super_block *, unsigned long);
extern int ext2_write_inode (struct inode *, int); extern int ext2_write_inode (struct inode *, struct writeback_control *);
extern void ext2_delete_inode (struct inode *); extern void ext2_delete_inode (struct inode *);
extern int ext2_sync_inode (struct inode *); extern int ext2_sync_inode (struct inode *);
extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int); extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
......
...@@ -41,6 +41,8 @@ MODULE_AUTHOR("Remy Card and others"); ...@@ -41,6 +41,8 @@ MODULE_AUTHOR("Remy Card and others");
MODULE_DESCRIPTION("Second Extended Filesystem"); MODULE_DESCRIPTION("Second Extended Filesystem");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int __ext2_write_inode(struct inode *inode, int do_sync);
/* /*
* Test whether an inode is a fast symlink. * Test whether an inode is a fast symlink.
*/ */
...@@ -64,7 +66,7 @@ void ext2_delete_inode (struct inode * inode) ...@@ -64,7 +66,7 @@ void ext2_delete_inode (struct inode * inode)
goto no_delete; goto no_delete;
EXT2_I(inode)->i_dtime = get_seconds(); EXT2_I(inode)->i_dtime = get_seconds();
mark_inode_dirty(inode); mark_inode_dirty(inode);
ext2_write_inode(inode, inode_needs_sync(inode)); __ext2_write_inode(inode, inode_needs_sync(inode));
inode->i_size = 0; inode->i_size = 0;
if (inode->i_blocks) if (inode->i_blocks)
...@@ -1335,7 +1337,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino) ...@@ -1335,7 +1337,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
return ERR_PTR(ret); return ERR_PTR(ret);
} }
int ext2_write_inode(struct inode *inode, int do_sync) static int __ext2_write_inode(struct inode *inode, int do_sync)
{ {
struct ext2_inode_info *ei = EXT2_I(inode); struct ext2_inode_info *ei = EXT2_I(inode);
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
...@@ -1440,6 +1442,11 @@ int ext2_write_inode(struct inode *inode, int do_sync) ...@@ -1440,6 +1442,11 @@ int ext2_write_inode(struct inode *inode, int do_sync)
return err; return err;
} }
int ext2_write_inode(struct inode *inode, struct writeback_control *wbc)
{
return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
}
int ext2_sync_inode(struct inode *inode) int ext2_sync_inode(struct inode *inode)
{ {
struct writeback_control wbc = { struct writeback_control wbc = {
......
...@@ -3096,7 +3096,7 @@ static int ext3_do_update_inode(handle_t *handle, ...@@ -3096,7 +3096,7 @@ static int ext3_do_update_inode(handle_t *handle,
* `stuff()' is running, and the new i_size will be lost. Plus the inode * `stuff()' is running, and the new i_size will be lost. Plus the inode
* will no longer be on the superblock's dirty inode list. * will no longer be on the superblock's dirty inode list.
*/ */
int ext3_write_inode(struct inode *inode, int wait) int ext3_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
if (current->flags & PF_MEMALLOC) if (current->flags & PF_MEMALLOC)
return 0; return 0;
...@@ -3107,7 +3107,7 @@ int ext3_write_inode(struct inode *inode, int wait) ...@@ -3107,7 +3107,7 @@ int ext3_write_inode(struct inode *inode, int wait)
return -EIO; return -EIO;
} }
if (!wait) if (wbc->sync_mode != WB_SYNC_ALL)
return 0; return 0;
return ext3_force_commit(inode->i_sb); return ext3_force_commit(inode->i_sb);
......
...@@ -1416,7 +1416,7 @@ int ext4_get_block(struct inode *inode, sector_t iblock, ...@@ -1416,7 +1416,7 @@ int ext4_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh_result, int create); struct buffer_head *bh_result, int create);
extern struct inode *ext4_iget(struct super_block *, unsigned long); extern struct inode *ext4_iget(struct super_block *, unsigned long);
extern int ext4_write_inode(struct inode *, int); extern int ext4_write_inode(struct inode *, struct writeback_control *);
extern int ext4_setattr(struct dentry *, struct iattr *); extern int ext4_setattr(struct dentry *, struct iattr *);
extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat); struct kstat *stat);
......
...@@ -5177,7 +5177,7 @@ static int ext4_do_update_inode(handle_t *handle, ...@@ -5177,7 +5177,7 @@ static int ext4_do_update_inode(handle_t *handle,
* `stuff()' is running, and the new i_size will be lost. Plus the inode * `stuff()' is running, and the new i_size will be lost. Plus the inode
* will no longer be on the superblock's dirty inode list. * will no longer be on the superblock's dirty inode list.
*/ */
int ext4_write_inode(struct inode *inode, int wait) int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
int err; int err;
...@@ -5191,7 +5191,7 @@ int ext4_write_inode(struct inode *inode, int wait) ...@@ -5191,7 +5191,7 @@ int ext4_write_inode(struct inode *inode, int wait)
return -EIO; return -EIO;
} }
if (!wait) if (wbc->sync_mode != WB_SYNC_ALL)
return 0; return 0;
err = ext4_force_commit(inode->i_sb); err = ext4_force_commit(inode->i_sb);
...@@ -5201,7 +5201,7 @@ int ext4_write_inode(struct inode *inode, int wait) ...@@ -5201,7 +5201,7 @@ int ext4_write_inode(struct inode *inode, int wait)
err = ext4_get_inode_loc(inode, &iloc); err = ext4_get_inode_loc(inode, &iloc);
if (err) if (err)
return err; return err;
if (wait) if (wbc->sync_mode == WB_SYNC_ALL)
sync_dirty_buffer(iloc.bh); sync_dirty_buffer(iloc.bh);
if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) { if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb, __func__,
......
...@@ -577,7 +577,7 @@ static inline loff_t fat_i_pos_read(struct msdos_sb_info *sbi, ...@@ -577,7 +577,7 @@ static inline loff_t fat_i_pos_read(struct msdos_sb_info *sbi,
return i_pos; return i_pos;
} }
static int fat_write_inode(struct inode *inode, int wait) static int __fat_write_inode(struct inode *inode, int wait)
{ {
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(sb); struct msdos_sb_info *sbi = MSDOS_SB(sb);
...@@ -634,9 +634,14 @@ static int fat_write_inode(struct inode *inode, int wait) ...@@ -634,9 +634,14 @@ static int fat_write_inode(struct inode *inode, int wait)
return err; return err;
} }
static int fat_write_inode(struct inode *inode, struct writeback_control *wbc)
{
return __fat_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
}
int fat_sync_inode(struct inode *inode) int fat_sync_inode(struct inode *inode)
{ {
return fat_write_inode(inode, 1); return __fat_write_inode(inode, 1);
} }
EXPORT_SYMBOL_GPL(fat_sync_inode); EXPORT_SYMBOL_GPL(fat_sync_inode);
......
...@@ -381,10 +381,10 @@ static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) ...@@ -381,10 +381,10 @@ static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this)
move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this); move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this);
} }
static int write_inode(struct inode *inode, int sync) static int write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
if (inode->i_sb->s_op->write_inode && !is_bad_inode(inode)) if (inode->i_sb->s_op->write_inode && !is_bad_inode(inode))
return inode->i_sb->s_op->write_inode(inode, sync); return inode->i_sb->s_op->write_inode(inode, wbc);
return 0; return 0;
} }
...@@ -421,7 +421,6 @@ static int ...@@ -421,7 +421,6 @@ static int
writeback_single_inode(struct inode *inode, struct writeback_control *wbc) writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
{ {
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
int wait = wbc->sync_mode == WB_SYNC_ALL;
unsigned dirty; unsigned dirty;
int ret; int ret;
...@@ -439,7 +438,7 @@ writeback_single_inode(struct inode *inode, struct writeback_control *wbc) ...@@ -439,7 +438,7 @@ writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
* We'll have another go at writing back this inode when we * We'll have another go at writing back this inode when we
* completed a full scan of b_io. * completed a full scan of b_io.
*/ */
if (!wait) { if (wbc->sync_mode != WB_SYNC_ALL) {
requeue_io(inode); requeue_io(inode);
return 0; return 0;
} }
...@@ -466,7 +465,7 @@ writeback_single_inode(struct inode *inode, struct writeback_control *wbc) ...@@ -466,7 +465,7 @@ writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
* This is important for filesystems that modify metadata on data * This is important for filesystems that modify metadata on data
* I/O completion. * I/O completion.
*/ */
if (wait) { if (wbc->sync_mode == WB_SYNC_ALL) {
int err = filemap_fdatawait(mapping); int err = filemap_fdatawait(mapping);
if (ret == 0) if (ret == 0)
ret = err; ret = err;
...@@ -474,7 +473,7 @@ writeback_single_inode(struct inode *inode, struct writeback_control *wbc) ...@@ -474,7 +473,7 @@ writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
/* Don't write the inode if only I_DIRTY_PAGES was set */ /* Don't write the inode if only I_DIRTY_PAGES was set */
if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) { if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
int err = write_inode(inode, wait); int err = write_inode(inode, wbc);
if (ret == 0) if (ret == 0)
ret = err; ret = err;
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/writeback.h>
#include "gfs2.h" #include "gfs2.h"
#include "incore.h" #include "incore.h"
...@@ -711,7 +712,7 @@ void gfs2_unfreeze_fs(struct gfs2_sbd *sdp) ...@@ -711,7 +712,7 @@ void gfs2_unfreeze_fs(struct gfs2_sbd *sdp)
* Returns: errno * Returns: errno
*/ */
static int gfs2_write_inode(struct inode *inode, int sync) static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
...@@ -745,7 +746,7 @@ static int gfs2_write_inode(struct inode *inode, int sync) ...@@ -745,7 +746,7 @@ static int gfs2_write_inode(struct inode *inode, int sync)
do_unlock: do_unlock:
gfs2_glock_dq_uninit(&gh); gfs2_glock_dq_uninit(&gh);
do_flush: do_flush:
if (sync != 0) if (wbc->sync_mode == WB_SYNC_ALL)
gfs2_log_flush(GFS2_SB(inode), ip->i_gl); gfs2_log_flush(GFS2_SB(inode), ip->i_gl);
return ret; return ret;
} }
......
...@@ -188,7 +188,7 @@ extern const struct address_space_operations hfs_btree_aops; ...@@ -188,7 +188,7 @@ extern const struct address_space_operations hfs_btree_aops;
extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int);
extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
extern int hfs_write_inode(struct inode *, int); extern int hfs_write_inode(struct inode *, struct writeback_control *);
extern int hfs_inode_setattr(struct dentry *, struct iattr *); extern int hfs_inode_setattr(struct dentry *, struct iattr *);
extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext, extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext,
__be32 log_size, __be32 phys_size, u32 clump_size); __be32 log_size, __be32 phys_size, u32 clump_size);
......
...@@ -381,7 +381,7 @@ void hfs_inode_write_fork(struct inode *inode, struct hfs_extent *ext, ...@@ -381,7 +381,7 @@ void hfs_inode_write_fork(struct inode *inode, struct hfs_extent *ext,
HFS_SB(inode->i_sb)->alloc_blksz); HFS_SB(inode->i_sb)->alloc_blksz);
} }
int hfs_write_inode(struct inode *inode, int unused) int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
struct inode *main_inode = inode; struct inode *main_inode = inode;
struct hfs_find_data fd; struct hfs_find_data fd;
......
...@@ -87,7 +87,8 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino) ...@@ -87,7 +87,8 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino)
return ERR_PTR(err); return ERR_PTR(err);
} }
static int hfsplus_write_inode(struct inode *inode, int unused) static int hfsplus_write_inode(struct inode *inode,
struct writeback_control *wbc)
{ {
struct hfsplus_vh *vhdr; struct hfsplus_vh *vhdr;
int ret = 0; int ret = 0;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/writeback.h>
#include "jfs_incore.h" #include "jfs_incore.h"
#include "jfs_inode.h" #include "jfs_inode.h"
#include "jfs_filsys.h" #include "jfs_filsys.h"
...@@ -120,8 +121,10 @@ int jfs_commit_inode(struct inode *inode, int wait) ...@@ -120,8 +121,10 @@ int jfs_commit_inode(struct inode *inode, int wait)
return rc; return rc;
} }
int jfs_write_inode(struct inode *inode, int wait) int jfs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
int wait = wbc->sync_mode == WB_SYNC_ALL;
if (test_cflag(COMMIT_Nolink, inode)) if (test_cflag(COMMIT_Nolink, inode))
return 0; return 0;
/* /*
......
...@@ -26,7 +26,7 @@ extern long jfs_ioctl(struct file *, unsigned int, unsigned long); ...@@ -26,7 +26,7 @@ extern long jfs_ioctl(struct file *, unsigned int, unsigned long);
extern long jfs_compat_ioctl(struct file *, unsigned int, unsigned long); extern long jfs_compat_ioctl(struct file *, unsigned int, unsigned long);
extern struct inode *jfs_iget(struct super_block *, unsigned long); extern struct inode *jfs_iget(struct super_block *, unsigned long);
extern int jfs_commit_inode(struct inode *, int); extern int jfs_commit_inode(struct inode *, int);
extern int jfs_write_inode(struct inode*, int); extern int jfs_write_inode(struct inode *, struct writeback_control *);
extern void jfs_delete_inode(struct inode *); extern void jfs_delete_inode(struct inode *);
extern void jfs_dirty_inode(struct inode *); extern void jfs_dirty_inode(struct inode *);
extern void jfs_truncate(struct inode *); extern void jfs_truncate(struct inode *);
......
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/highuid.h> #include <linux/highuid.h>
#include <linux/vfs.h> #include <linux/vfs.h>
#include <linux/writeback.h>
static int minix_write_inode(struct inode * inode, int wait); static int minix_write_inode(struct inode *inode,
struct writeback_control *wbc);
static int minix_statfs(struct dentry *dentry, struct kstatfs *buf); static int minix_statfs(struct dentry *dentry, struct kstatfs *buf);
static int minix_remount (struct super_block * sb, int * flags, char * data); static int minix_remount (struct super_block * sb, int * flags, char * data);
...@@ -552,7 +554,7 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode) ...@@ -552,7 +554,7 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
return bh; return bh;
} }
static int minix_write_inode(struct inode *inode, int wait) static int minix_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
int err = 0; int err = 0;
struct buffer_head *bh; struct buffer_head *bh;
...@@ -563,7 +565,7 @@ static int minix_write_inode(struct inode *inode, int wait) ...@@ -563,7 +565,7 @@ static int minix_write_inode(struct inode *inode, int wait)
bh = V2_minix_update_inode(inode); bh = V2_minix_update_inode(inode);
if (!bh) if (!bh)
return -EIO; return -EIO;
if (wait && buffer_dirty(bh)) { if (wbc->sync_mode == WB_SYNC_ALL && buffer_dirty(bh)) {
sync_dirty_buffer(bh); sync_dirty_buffer(bh);
if (buffer_req(bh) && !buffer_uptodate(bh)) { if (buffer_req(bh) && !buffer_uptodate(bh)) {
printk("IO error syncing minix inode [%s:%08lx]\n", printk("IO error syncing minix inode [%s:%08lx]\n",
......
...@@ -97,11 +97,12 @@ u64 nfs_compat_user_ino64(u64 fileid) ...@@ -97,11 +97,12 @@ u64 nfs_compat_user_ino64(u64 fileid)
return ino; return ino;
} }
int nfs_write_inode(struct inode *inode, int sync) int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
int ret; int ret;
ret = nfs_commit_inode(inode, sync ? FLUSH_SYNC : 0); ret = nfs_commit_inode(inode,
wbc->sync_mode == WB_SYNC_ALL ? FLUSH_SYNC : 0);
if (ret >= 0) if (ret >= 0)
return 0; return 0;
__mark_inode_dirty(inode, I_DIRTY_DATASYNC); __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
......
...@@ -211,7 +211,7 @@ extern int nfs_access_cache_shrinker(int nr_to_scan, gfp_t gfp_mask); ...@@ -211,7 +211,7 @@ extern int nfs_access_cache_shrinker(int nr_to_scan, gfp_t gfp_mask);
extern struct workqueue_struct *nfsiod_workqueue; extern struct workqueue_struct *nfsiod_workqueue;
extern struct inode *nfs_alloc_inode(struct super_block *sb); extern struct inode *nfs_alloc_inode(struct super_block *sb);
extern void nfs_destroy_inode(struct inode *); extern void nfs_destroy_inode(struct inode *);
extern int nfs_write_inode(struct inode *,int); extern int nfs_write_inode(struct inode *, struct writeback_control *);
extern void nfs_clear_inode(struct inode *); extern void nfs_clear_inode(struct inode *);
#ifdef CONFIG_NFS_V4 #ifdef CONFIG_NFS_V4
extern void nfs4_clear_inode(struct inode *); extern void nfs4_clear_inode(struct inode *);
......
...@@ -1545,7 +1545,7 @@ static int ntfs_dir_fsync(struct file *filp, struct dentry *dentry, ...@@ -1545,7 +1545,7 @@ static int ntfs_dir_fsync(struct file *filp, struct dentry *dentry,
write_inode_now(bmp_vi, !datasync); write_inode_now(bmp_vi, !datasync);
iput(bmp_vi); iput(bmp_vi);
} }
ret = ntfs_write_inode(vi, 1); ret = __ntfs_write_inode(vi, 1);
write_inode_now(vi, !datasync); write_inode_now(vi, !datasync);
err = sync_blockdev(vi->i_sb->s_bdev); err = sync_blockdev(vi->i_sb->s_bdev);
if (unlikely(err && !ret)) if (unlikely(err && !ret))
......
...@@ -2182,7 +2182,7 @@ static int ntfs_file_fsync(struct file *filp, struct dentry *dentry, ...@@ -2182,7 +2182,7 @@ static int ntfs_file_fsync(struct file *filp, struct dentry *dentry,
ntfs_debug("Entering for inode 0x%lx.", vi->i_ino); ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
BUG_ON(S_ISDIR(vi->i_mode)); BUG_ON(S_ISDIR(vi->i_mode));
if (!datasync || !NInoNonResident(NTFS_I(vi))) if (!datasync || !NInoNonResident(NTFS_I(vi)))
ret = ntfs_write_inode(vi, 1); ret = __ntfs_write_inode(vi, 1);
write_inode_now(vi, !datasync); write_inode_now(vi, !datasync);
/* /*
* NOTE: If we were to use mapping->private_list (see ext2 and * NOTE: If we were to use mapping->private_list (see ext2 and
......
...@@ -2957,7 +2957,7 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -2957,7 +2957,7 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
* *
* Return 0 on success and -errno on error. * Return 0 on success and -errno on error.
*/ */
int ntfs_write_inode(struct inode *vi, int sync) int __ntfs_write_inode(struct inode *vi, int sync)
{ {
sle64 nt; sle64 nt;
ntfs_inode *ni = NTFS_I(vi); ntfs_inode *ni = NTFS_I(vi);
......
...@@ -307,12 +307,12 @@ extern void ntfs_truncate_vfs(struct inode *vi); ...@@ -307,12 +307,12 @@ extern void ntfs_truncate_vfs(struct inode *vi);