--- linux-2.6.16-rc4/fs/ext2/ext2.h 2006-02-18 14:40:21 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext2/ext2.h 2006-02-17 23:26:32 +0100 @@ -162,6 +162,7 @@ extern struct file_operations ext2_xip_f extern struct address_space_operations ext2_aops; extern struct address_space_operations ext2_aops_xip; extern struct address_space_operations ext2_nobh_aops; +extern int ext2_sync_flags(struct inode *inode); /* namei.c */ extern struct inode_operations ext2_dir_inode_operations; --- linux-2.6.16-rc4/fs/ext2/file.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext2/file.c 2006-02-17 23:26:32 +0100 @@ -79,4 +80,5 @@ struct inode_operations ext2_file_inode_ #endif .setattr = ext2_setattr, .permission = ext2_permission, + .sync_flags = ext2_sync_flags, }; --- linux-2.6.16-rc4/fs/ext2/inode.c 2006-02-18 14:40:21 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext2/inode.c 2006-02-17 23:26:32 +0100 @@ -1067,6 +1082,42 @@ ***** inode->i_flags |= S_DIRSYNC; } +int ext2_sync_flags(struct inode *inode) +{ + unsigned int oldflags, newflags; + + oldflags = EXT2_I(inode)->i_flags; + newflags = oldflags & ~(EXT2_APPEND_FL | + EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL | + EXT2_BARRIER_FL | EXT2_NOATIME_FL | + EXT2_SYNC_FL | EXT2_DIRSYNC_FL); + + if (IS_APPEND(inode)) + newflags |= EXT2_APPEND_FL; + if (IS_IMMUTABLE(inode)) + newflags |= EXT2_IMMUTABLE_FL; + if (IS_IUNLINK(inode)) + newflags |= EXT2_IUNLINK_FL; + if (IS_BARRIER(inode)) + newflags |= EXT2_BARRIER_FL; + + /* we do not want to copy superblock flags */ + if (inode->i_flags & S_NOATIME) + newflags |= EXT2_NOATIME_FL; + if (inode->i_flags & S_SYNC) + newflags |= EXT2_SYNC_FL; + if (inode->i_flags & S_DIRSYNC) + newflags |= EXT2_DIRSYNC_FL; + + if (oldflags ^ newflags) { + EXT2_I(inode)->i_flags = newflags; + inode->i_ctime = CURRENT_TIME; + mark_inode_dirty(inode); + } + + return 0; +} + void ext2_read_inode (struct inode * inode) { struct ext2_inode_info *ei = EXT2_I(inode); --- linux-2.6.16-rc4/fs/ext2/namei.c 2006-02-18 14:40:21 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext2/namei.c 2006-02-17 23:26:32 +0100 @@ -407,6 +409,7 @@ struct inode_operations ext2_dir_inode_o #endif .setattr = ext2_setattr, .permission = ext2_permission, + .sync_flags = ext2_sync_flags, }; struct inode_operations ext2_special_inode_operations = { --- linux-2.6.16-rc4/fs/ext2/namei.c 2006-02-18 14:40:21 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext2/namei.c 2006-02-17 23:26:32 +0100 @@ -418,4 +421,5 @@ struct inode_operations ext2_special_ino #endif .setattr = ext2_setattr, .permission = ext2_permission, + .sync_flags = ext2_sync_flags, }; --- linux-2.6.16-rc4/fs/ext2/symlink.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext2/symlink.c 2006-02-17 23:26:32 +0100 @@ -38,6 +38,7 @@ struct inode_operations ext2_symlink_ino .listxattr = ext2_listxattr, .removexattr = generic_removexattr, #endif + .sync_flags = ext2_sync_flags, }; struct inode_operations ext2_fast_symlink_inode_operations = { --- linux-2.6.16-rc4/fs/ext2/symlink.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext2/symlink.c 2006-02-17 23:26:32 +0100 @@ -49,4 +50,5 @@ struct inode_operations ext2_fast_symlin .listxattr = ext2_listxattr, .removexattr = generic_removexattr, #endif + .sync_flags = ext2_sync_flags, }; --- linux-2.6.16-rc4/fs/ext3/file.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext3/file.c 2006-02-17 23:26:32 +0100 @@ -131,5 +132,6 @@ struct inode_operations ext3_file_inode_ .removexattr = generic_removexattr, #endif .permission = ext3_permission, + .sync_flags = ext3_sync_flags, }; --- linux-2.6.16-rc4/fs/ext3/inode.c 2006-02-18 14:40:22 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext3/inode.c 2006-02-17 23:26:32 +0100 @@ -2436,6 +2451,57 @@ ***** inode->i_flags |= S_DIRSYNC; } +int ext3_sync_flags(struct inode *inode) +{ + unsigned int oldflags, newflags; + int err = 0; + + oldflags = EXT3_I(inode)->i_flags; + newflags = oldflags & ~(EXT3_APPEND_FL | + EXT3_IMMUTABLE_FL | EXT3_IUNLINK_FL | + EXT3_BARRIER_FL | EXT3_NOATIME_FL | + EXT3_SYNC_FL | EXT3_DIRSYNC_FL); + + if (IS_APPEND(inode)) + newflags |= EXT3_APPEND_FL; + if (IS_IMMUTABLE(inode)) + newflags |= EXT3_IMMUTABLE_FL; + if (IS_IUNLINK(inode)) + newflags |= EXT3_IUNLINK_FL; + if (IS_BARRIER(inode)) + newflags |= EXT3_BARRIER_FL; + + /* we do not want to copy superblock flags */ + if (inode->i_flags & S_NOATIME) + newflags |= EXT3_NOATIME_FL; + if (inode->i_flags & S_SYNC) + newflags |= EXT3_SYNC_FL; + if (inode->i_flags & S_DIRSYNC) + newflags |= EXT3_DIRSYNC_FL; + + if (oldflags ^ newflags) { + handle_t *handle; + struct ext3_iloc iloc; + + handle = ext3_journal_start(inode, 1); + if (IS_ERR(handle)) + return PTR_ERR(handle); + if (IS_SYNC(inode)) + handle->h_sync = 1; + err = ext3_reserve_inode_write(handle, inode, &iloc); + if (err) + goto flags_err; + + EXT3_I(inode)->i_flags = newflags; + inode->i_ctime = CURRENT_TIME; + + err = ext3_mark_iloc_dirty(handle, inode, &iloc); + flags_err: + ext3_journal_stop(handle); + } + return err; +} + void ext3_read_inode(struct inode * inode) { struct ext3_iloc iloc; --- linux-2.6.16-rc4/fs/ext3/namei.c 2006-02-18 14:40:22 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext3/namei.c 2006-02-17 23:26:32 +0100 @@ -2372,6 +2374,7 @@ struct inode_operations ext3_dir_inode_o .removexattr = generic_removexattr, #endif .permission = ext3_permission, + .sync_flags = ext3_sync_flags, }; struct inode_operations ext3_special_inode_operations = { --- linux-2.6.16-rc4/fs/ext3/namei.c 2006-02-18 14:40:22 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext3/namei.c 2006-02-17 23:26:32 +0100 @@ -2383,4 +2386,5 @@ struct inode_operations ext3_special_ino .removexattr = generic_removexattr, #endif .permission = ext3_permission, + .sync_flags = ext3_sync_flags, }; --- linux-2.6.16-rc4/fs/ext3/symlink.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext3/symlink.c 2006-02-17 23:26:32 +0100 @@ -40,6 +40,7 @@ struct inode_operations ext3_symlink_ino .listxattr = ext3_listxattr, .removexattr = generic_removexattr, #endif + .sync_flags = ext3_sync_flags, }; struct inode_operations ext3_fast_symlink_inode_operations = { --- linux-2.6.16-rc4/fs/ext3/symlink.c 2005-08-29 22:25:30 +0200 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/ext3/symlink.c 2006-02-17 23:26:32 +0100 @@ -51,4 +52,5 @@ struct inode_operations ext3_fast_symlin .listxattr = ext3_listxattr, .removexattr = generic_removexattr, #endif + .sync_flags = ext3_sync_flags, }; --- linux-2.6.16-rc4/fs/reiserfs/file.c 2006-02-18 14:40:26 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/reiserfs/file.c 2006-02-17 23:26:32 +0100 @@ -1586,4 +1587,5 @@ struct inode_operations reiserfs_file_in .listxattr = reiserfs_listxattr, .removexattr = reiserfs_removexattr, .permission = reiserfs_permission, + .sync_flags = reiserfs_sync_flags, }; --- linux-2.6.16-rc4/fs/reiserfs/inode.c 2006-02-18 14:40:26 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/reiserfs/inode.c 2006-02-17 23:26:32 +0100 @@ -2904,6 +2940,22 @@ static ssize_t reiserfs_direct_IO(int rw reiserfs_get_blocks_direct_io, NULL); } +int reiserfs_sync_flags(struct inode *inode) +{ + u16 oldflags, newflags; + + oldflags = REISERFS_I(inode)->i_attrs; + newflags = oldflags; + i_attrs_to_sd_attrs(inode, &newflags); + + if (oldflags ^ newflags) { + REISERFS_I(inode)->i_attrs = newflags; + inode->i_ctime = CURRENT_TIME_SEC; + mark_inode_dirty(inode); + } + return 0; +} + int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { struct inode *inode = dentry->d_inode; --- linux-2.6.16-rc4/fs/reiserfs/namei.c 2006-02-18 14:40:26 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/reiserfs/namei.c 2006-02-17 23:26:32 +0100 @@ -1546,6 +1549,7 @@ struct inode_operations reiserfs_dir_ino .listxattr = reiserfs_listxattr, .removexattr = reiserfs_removexattr, .permission = reiserfs_permission, + .sync_flags = reiserfs_sync_flags, }; /* --- linux-2.6.16-rc4/fs/reiserfs/namei.c 2006-02-18 14:40:26 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/reiserfs/namei.c 2006-02-17 23:26:32 +0100 @@ -1562,6 +1566,7 @@ struct inode_operations reiserfs_symlink .listxattr = reiserfs_listxattr, .removexattr = reiserfs_removexattr, .permission = reiserfs_permission, + .sync_flags = reiserfs_sync_flags, }; --- linux-2.6.16-rc4/fs/reiserfs/namei.c 2006-02-18 14:40:26 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/reiserfs/namei.c 2006-02-17 23:26:32 +0100 @@ -1575,5 +1580,6 @@ struct inode_operations reiserfs_special .listxattr = reiserfs_listxattr, .removexattr = reiserfs_removexattr, .permission = reiserfs_permission, + .sync_flags = reiserfs_sync_flags, }; --- linux-2.6.16-rc4/fs/xfs/linux-2.6/xfs_iops.c 2006-02-18 14:40:27 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/xfs/linux-2.6/xfs_iops.c 2006-02-17 23:26:32 +0100 @@ -646,6 +648,41 @@ linvfs_getattr( } STATIC int +linvfs_sync_flags(struct inode *inode) +{ + unsigned int oldflags, newflags; + vattr_t vattr; + int flags = 0; + int error; + vnode_t *vp = LINVFS_GET_VP(inode); + + memset(&vattr, 0, sizeof(vattr_t)); + + vattr.va_mask = XFS_AT_XFLAGS; + VOP_GETATTR(vp, &vattr, 0, NULL, error); + if (error) + return error; + oldflags = vattr.va_xflags; + newflags = oldflags & ~(XFS_XFLAG_IMMUTABLE | + XFS_XFLAG_IUNLINK | XFS_XFLAG_BARRIER); + + if (IS_IMMUTABLE(inode)) + newflags |= XFS_XFLAG_IMMUTABLE; + if (IS_IUNLINK(inode)) + newflags |= XFS_XFLAG_IUNLINK; + if (IS_BARRIER(inode)) + newflags |= XFS_XFLAG_BARRIER; + + if (oldflags ^ newflags) { + vattr.va_xflags = newflags; + vattr.va_mask |= XFS_AT_XFLAGS; + VOP_SETATTR(vp, &vattr, flags, NULL, error); + } + vn_revalidate(vp); + return error; +} + +STATIC int linvfs_setattr( struct dentry *dentry, struct iattr *attr) --- linux-2.6.16-rc4/fs/xfs/linux-2.6/xfs_iops.c 2006-02-18 14:40:27 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/xfs/linux-2.6/xfs_iops.c 2006-02-17 23:26:32 +0100 @@ -825,6 +870,7 @@ struct inode_operations linvfs_file_inod .getxattr = linvfs_getxattr, .listxattr = linvfs_listxattr, .removexattr = linvfs_removexattr, + .sync_flags = linvfs_sync_flags, }; struct inode_operations linvfs_dir_inode_operations = { --- linux-2.6.16-rc4/fs/xfs/linux-2.6/xfs_iops.c 2006-02-18 14:40:27 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/xfs/linux-2.6/xfs_iops.c 2006-02-17 23:26:32 +0100 @@ -844,6 +890,7 @@ struct inode_operations linvfs_dir_inode .getxattr = linvfs_getxattr, .listxattr = linvfs_listxattr, .removexattr = linvfs_removexattr, + .sync_flags = linvfs_sync_flags, }; struct inode_operations linvfs_symlink_inode_operations = { --- linux-2.6.16-rc4/fs/xfs/linux-2.6/xfs_iops.c 2006-02-18 14:40:27 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/fs/xfs/linux-2.6/xfs_iops.c 2006-02-17 23:26:32 +0100 @@ -857,4 +904,5 @@ struct inode_operations linvfs_symlink_i .getxattr = linvfs_getxattr, .listxattr = linvfs_listxattr, .removexattr = linvfs_removexattr, + .sync_flags = linvfs_sync_flags, }; --- linux-2.6.16-rc4/include/linux/ext3_fs.h 2005-10-28 20:49:54 +0200 +++ linux-2.6.16-rc4-vs2.1.1-rc8/include/linux/ext3_fs.h 2006-02-17 23:26:32 +0100 @@ -775,6 +787,7 @@ extern unsigned long ext3_count_free (st extern int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); +extern int ext3_sync_flags(struct inode *inode); extern void ext3_read_inode (struct inode *); extern int ext3_write_inode (struct inode *, int); --- linux-2.6.16-rc4/include/linux/fs.h 2006-02-18 14:40:32 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/include/linux/fs.h 2006-02-17 23:26:32 +0100 @@ -1048,6 +1068,7 @@ struct inode_operations { ssize_t (*listxattr) (struct dentry *, char *, size_t); int (*removexattr) (struct dentry *, const char *); void (*truncate_range)(struct inode *, loff_t, loff_t); + int (*sync_flags) (struct inode *); }; struct seq_file; --- linux-2.6.16-rc4/include/linux/reiserfs_fs.h 2006-02-18 14:40:35 +0100 +++ linux-2.6.16-rc4-vs2.1.1-rc8/include/linux/reiserfs_fs.h 2006-02-17 23:26:32 +0100 @@ -1904,6 +1916,7 @@ static inline void reiserfs_update_sd(st void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode); void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs); int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); +int reiserfs_sync_flags(struct inode *inode); /* namei.c */ void set_de_name_and_namelen(struct reiserfs_dir_entry *de);