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

fs: pass exact type of data dirties to ->dirty_inode

Tell the filesystem if we just updated timestamp (I_DIRTY_SYNC) or
anything else, so that the filesystem can track internally if it
needs to push out a transaction for fdatasync or not.

This is just the prototype change with no user for it yet.  I plan
to push large XFS changes for the next merge window, and getting
this trivial infrastructure in this window would help a lot to avoid
tree interdependencies.

Also remove incorrect comments that ->dirty_inode can't block.  That
has been changed a long time ago, and many implementations rely on it.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d6e9bd25
...@@ -104,7 +104,7 @@ of the locking scheme for directory operations. ...@@ -104,7 +104,7 @@ of the locking scheme for directory operations.
prototypes: prototypes:
struct inode *(*alloc_inode)(struct super_block *sb); struct inode *(*alloc_inode)(struct super_block *sb);
void (*destroy_inode)(struct inode *); void (*destroy_inode)(struct inode *);
void (*dirty_inode) (struct inode *); void (*dirty_inode) (struct inode *, int flags);
int (*write_inode) (struct inode *, struct writeback_control *wbc); int (*write_inode) (struct inode *, struct writeback_control *wbc);
int (*drop_inode) (struct inode *); int (*drop_inode) (struct inode *);
void (*evict_inode) (struct inode *); void (*evict_inode) (struct inode *);
...@@ -126,7 +126,7 @@ locking rules: ...@@ -126,7 +126,7 @@ locking rules:
s_umount s_umount
alloc_inode: alloc_inode:
destroy_inode: destroy_inode:
dirty_inode: (must not sleep) dirty_inode:
write_inode: write_inode:
drop_inode: !!!inode->i_lock!!! drop_inode: !!!inode->i_lock!!!
evict_inode: evict_inode:
......
...@@ -211,7 +211,7 @@ struct super_operations { ...@@ -211,7 +211,7 @@ struct super_operations {
struct inode *(*alloc_inode)(struct super_block *sb); struct inode *(*alloc_inode)(struct super_block *sb);
void (*destroy_inode)(struct inode *); void (*destroy_inode)(struct inode *);
void (*dirty_inode) (struct inode *); void (*dirty_inode) (struct inode *, int flags);
int (*write_inode) (struct inode *, int); int (*write_inode) (struct inode *, int);
void (*drop_inode) (struct inode *); void (*drop_inode) (struct inode *);
void (*delete_inode) (struct inode *); void (*delete_inode) (struct inode *);
......
...@@ -2522,7 +2522,7 @@ int btrfs_readpage(struct file *file, struct page *page); ...@@ -2522,7 +2522,7 @@ int btrfs_readpage(struct file *file, struct page *page);
void btrfs_evict_inode(struct inode *inode); void btrfs_evict_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, struct writeback_control *wbc); 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, int flags);
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);
int btrfs_drop_inode(struct inode *inode); int btrfs_drop_inode(struct inode *inode);
......
...@@ -4396,7 +4396,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc) ...@@ -4396,7 +4396,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
* FIXME, needs more benchmarking...there are no reasons other than performance * FIXME, needs more benchmarking...there are no reasons other than performance
* to keep or drop this code. * to keep or drop this code.
*/ */
void btrfs_dirty_inode(struct inode *inode) void btrfs_dirty_inode(struct inode *inode, int flags)
{ {
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;
......
...@@ -3392,7 +3392,7 @@ int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode) ...@@ -3392,7 +3392,7 @@ int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode)
* so would cause a commit on atime updates, which we don't bother doing. * so would cause a commit on atime updates, which we don't bother doing.
* We handle synchronous inodes at the highest possible level. * We handle synchronous inodes at the highest possible level.
*/ */
void ext3_dirty_inode(struct inode *inode) void ext3_dirty_inode(struct inode *inode, int flags)
{ {
handle_t *current_handle = ext3_journal_current_handle(); handle_t *current_handle = ext3_journal_current_handle();
handle_t *handle; handle_t *handle;
......
...@@ -1813,7 +1813,7 @@ extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, ...@@ -1813,7 +1813,7 @@ extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
extern void ext4_evict_inode(struct inode *); extern void ext4_evict_inode(struct inode *);
extern void ext4_clear_inode(struct inode *); extern void ext4_clear_inode(struct inode *);
extern int ext4_sync_inode(handle_t *, struct inode *); extern int ext4_sync_inode(handle_t *, struct inode *);
extern void ext4_dirty_inode(struct inode *); extern void ext4_dirty_inode(struct inode *, int);
extern int ext4_change_inode_journal_flag(struct inode *, int); extern int ext4_change_inode_journal_flag(struct inode *, int);
extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
extern int ext4_can_truncate(struct inode *inode); extern int ext4_can_truncate(struct inode *inode);
......
...@@ -5733,7 +5733,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) ...@@ -5733,7 +5733,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
* so would cause a commit on atime updates, which we don't bother doing. * so would cause a commit on atime updates, which we don't bother doing.
* We handle synchronous inodes at the highest possible level. * We handle synchronous inodes at the highest possible level.
*/ */
void ext4_dirty_inode(struct inode *inode) void ext4_dirty_inode(struct inode *inode, int flags)
{ {
handle_t *handle; handle_t *handle;
......
...@@ -1007,9 +1007,6 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode) ...@@ -1007,9 +1007,6 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode)
* In short, make sure you hash any inodes _before_ you start marking * In short, make sure you hash any inodes _before_ you start marking
* them dirty. * them dirty.
* *
* This function *must* be atomic for the I_DIRTY_PAGES case -
* set_page_dirty() is called under spinlock in several places.
*
* Note that for blockdevs, inode->dirtied_when represents the dirtying time of * Note that for blockdevs, inode->dirtied_when represents the dirtying time of
* the block-special inode (/dev/hda1) itself. And the ->dirtied_when field of * the block-special inode (/dev/hda1) itself. And the ->dirtied_when field of
* the kernel-internal blockdev inode represents the dirtying time of the * the kernel-internal blockdev inode represents the dirtying time of the
...@@ -1028,7 +1025,7 @@ void __mark_inode_dirty(struct inode *inode, int flags) ...@@ -1028,7 +1025,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
*/ */
if (flags & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) { if (flags & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
if (sb->s_op->dirty_inode) if (sb->s_op->dirty_inode)
sb->s_op->dirty_inode(inode); sb->s_op->dirty_inode(inode, flags);
} }
/* /*
......
...@@ -357,7 +357,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) ...@@ -357,7 +357,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
return ERR_PTR(ret); return ERR_PTR(ret);
} }
void jffs2_dirty_inode(struct inode *inode) void jffs2_dirty_inode(struct inode *inode, int flags)
{ {
struct iattr iattr; struct iattr iattr;
......
...@@ -172,7 +172,7 @@ int jffs2_setattr (struct dentry *, struct iattr *); ...@@ -172,7 +172,7 @@ int jffs2_setattr (struct dentry *, struct iattr *);
int jffs2_do_setattr (struct inode *, struct iattr *); int jffs2_do_setattr (struct inode *, struct iattr *);
struct inode *jffs2_iget(struct super_block *, unsigned long); struct inode *jffs2_iget(struct super_block *, unsigned long);
void jffs2_evict_inode (struct inode *); void jffs2_evict_inode (struct inode *);
void jffs2_dirty_inode(struct inode *inode); void jffs2_dirty_inode(struct inode *inode, int flags);
struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct inode *jffs2_new_inode (struct inode *dir_i, int mode,
struct jffs2_raw_inode *ri); struct jffs2_raw_inode *ri);
int jffs2_statfs (struct dentry *, struct kstatfs *); int jffs2_statfs (struct dentry *, struct kstatfs *);
......
...@@ -173,7 +173,7 @@ void jfs_evict_inode(struct inode *inode) ...@@ -173,7 +173,7 @@ void jfs_evict_inode(struct inode *inode)
dquot_drop(inode); dquot_drop(inode);
} }
void jfs_dirty_inode(struct inode *inode) void jfs_dirty_inode(struct inode *inode, int flags)
{ {
static int noisy = 5; static int noisy = 5;
......
...@@ -28,7 +28,7 @@ extern struct inode *jfs_iget(struct super_block *, unsigned long); ...@@ -28,7 +28,7 @@ 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 *, struct writeback_control *); extern int jfs_write_inode(struct inode *, struct writeback_control *);
extern void jfs_evict_inode(struct inode *); extern void jfs_evict_inode(struct inode *);
extern void jfs_dirty_inode(struct inode *); extern void jfs_dirty_inode(struct inode *, int);
extern void jfs_truncate(struct inode *); extern void jfs_truncate(struct inode *);
extern void jfs_truncate_nolock(struct inode *, loff_t); extern void jfs_truncate_nolock(struct inode *, loff_t);
extern void jfs_free_zero_link(struct inode *); extern void jfs_free_zero_link(struct inode *);
......
...@@ -917,7 +917,7 @@ int nilfs_mark_inode_dirty(struct inode *inode) ...@@ -917,7 +917,7 @@ int nilfs_mark_inode_dirty(struct inode *inode)
* construction. This function can be called both as a single operation * construction. This function can be called both as a single operation
* and as a part of indivisible file operations. * and as a part of indivisible file operations.
*/ */
void nilfs_dirty_inode(struct inode *inode) void nilfs_dirty_inode(struct inode *inode, int flags)
{ {
struct nilfs_transaction_info ti; struct nilfs_transaction_info ti;
struct nilfs_mdt_info *mdi = NILFS_MDT(inode); struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
......
...@@ -269,7 +269,7 @@ int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh); ...@@ -269,7 +269,7 @@ int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh);
extern int nilfs_inode_dirty(struct inode *); extern int nilfs_inode_dirty(struct inode *);
int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty); int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty);
extern int nilfs_mark_inode_dirty(struct inode *); extern int nilfs_mark_inode_dirty(struct inode *);
extern void nilfs_dirty_inode(struct inode *); extern void nilfs_dirty_inode(struct inode *, int flags);
int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len); __u64 start, __u64 len);
......
...@@ -568,7 +568,7 @@ static void destroy_inodecache(void) ...@@ -568,7 +568,7 @@ static void destroy_inodecache(void)
} }
/* we don't mark inodes dirty, we just log them */ /* we don't mark inodes dirty, we just log them */
static void reiserfs_dirty_inode(struct inode *inode) static void reiserfs_dirty_inode(struct inode *inode, int flags)
{ {
struct reiserfs_transaction_handle th; struct reiserfs_transaction_handle th;
......
...@@ -382,7 +382,7 @@ static void ubifs_evict_inode(struct inode *inode) ...@@ -382,7 +382,7 @@ static void ubifs_evict_inode(struct inode *inode)
end_writeback(inode); end_writeback(inode);
} }
static void ubifs_dirty_inode(struct inode *inode) static void ubifs_dirty_inode(struct inode *inode, int flags)
{ {
struct ubifs_inode *ui = ubifs_inode(inode); struct ubifs_inode *ui = ubifs_inode(inode);
......
...@@ -925,7 +925,8 @@ xfs_fs_inode_init_once( ...@@ -925,7 +925,8 @@ xfs_fs_inode_init_once(
*/ */
STATIC void STATIC void
xfs_fs_dirty_inode( xfs_fs_dirty_inode(
struct inode *inode) struct inode *inode,
int flags)
{ {
barrier(); barrier();
XFS_I(inode)->i_update_core = 1; XFS_I(inode)->i_update_core = 1;
......
...@@ -909,7 +909,7 @@ extern int ext3_setattr (struct dentry *, struct iattr *); ...@@ -909,7 +909,7 @@ extern int ext3_setattr (struct dentry *, struct iattr *);
extern void ext3_evict_inode (struct inode *); extern void ext3_evict_inode (struct inode *);
extern int ext3_sync_inode (handle_t *, struct inode *); extern int ext3_sync_inode (handle_t *, struct inode *);
extern void ext3_discard_reservation (struct inode *); extern void ext3_discard_reservation (struct inode *);
extern void ext3_dirty_inode(struct inode *); extern void ext3_dirty_inode(struct inode *, int);
extern int ext3_change_inode_journal_flag(struct inode *, int); extern int ext3_change_inode_journal_flag(struct inode *, int);
extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *); extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *);
extern int ext3_can_truncate(struct inode *inode); extern int ext3_can_truncate(struct inode *inode);
......
...@@ -1618,7 +1618,7 @@ struct super_operations { ...@@ -1618,7 +1618,7 @@ struct super_operations {
struct inode *(*alloc_inode)(struct super_block *sb); struct inode *(*alloc_inode)(struct super_block *sb);
void (*destroy_inode)(struct inode *); void (*destroy_inode)(struct inode *);
void (*dirty_inode) (struct inode *); void (*dirty_inode) (struct inode *, int flags);
int (*write_inode) (struct inode *, struct writeback_control *wbc); int (*write_inode) (struct inode *, struct writeback_control *wbc);
int (*drop_inode) (struct inode *); int (*drop_inode) (struct inode *);
void (*evict_inode) (struct inode *); void (*evict_inode) (struct inode *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment