update to rc6, and verified pass fsx/dbench
[ext4-patch-queue.git] / ext4-propagate_flags.patch
blob5400e82e9014c5c59dee7943ef80b6c29c6dfb90
1 Propagate flags such as S_APPEND, S_IMMUTABLE, etc. from i_flags into
2 ext4-specific i_flags. Hence, when someone sets these flags via a different
3 interface than ioctl, they are stored correctly.
5 Signed-off-by: Jan Kara <jack@suse.cz>
6 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
8 Index: linux-2.6.22-rc4/fs/ext4/inode.c
9 ===================================================================
10 --- linux-2.6.22-rc4.orig/fs/ext4/inode.c 2007-06-11 17:24:01.000000000 -0700
11 +++ linux-2.6.22-rc4/fs/ext4/inode.c 2007-06-11 17:24:28.000000000 -0700
12 @@ -2583,6 +2583,25 @@
13 inode->i_flags |= S_DIRSYNC;
16 +/* Propagate flags from i_flags to EXT4_I(inode)->i_flags */
17 +void ext4_get_inode_flags(struct ext4_inode_info *ei)
19 + unsigned int flags = ei->vfs_inode.i_flags;
21 + ei->i_flags &= ~(EXT4_SYNC_FL|EXT4_APPEND_FL|
22 + EXT4_IMMUTABLE_FL|EXT4_NOATIME_FL|EXT4_DIRSYNC_FL);
23 + if (flags & S_SYNC)
24 + ei->i_flags |= EXT4_SYNC_FL;
25 + if (flags & S_APPEND)
26 + ei->i_flags |= EXT4_APPEND_FL;
27 + if (flags & S_IMMUTABLE)
28 + ei->i_flags |= EXT4_IMMUTABLE_FL;
29 + if (flags & S_NOATIME)
30 + ei->i_flags |= EXT4_NOATIME_FL;
31 + if (flags & S_DIRSYNC)
32 + ei->i_flags |= EXT4_DIRSYNC_FL;
35 void ext4_read_inode(struct inode * inode)
37 struct ext4_iloc iloc;
38 @@ -2742,6 +2761,7 @@
39 if (ei->i_state & EXT4_STATE_NEW)
40 memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size);
42 + ext4_get_inode_flags(ei);
43 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
44 if(!(test_opt(inode->i_sb, NO_UID32))) {
45 raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
46 Index: linux-2.6.22-rc4/fs/ext4/ioctl.c
47 ===================================================================
48 --- linux-2.6.22-rc4.orig/fs/ext4/ioctl.c 2007-06-11 17:24:01.000000000 -0700
49 +++ linux-2.6.22-rc4/fs/ext4/ioctl.c 2007-06-11 17:25:11.000000000 -0700
50 @@ -28,6 +28,7 @@
52 switch (cmd) {
53 case EXT4_IOC_GETFLAGS:
54 + ext4_get_inode_flags(ei);
55 flags = ei->i_flags & EXT4_FL_USER_VISIBLE;
56 return put_user(flags, (int __user *) arg);
57 case EXT4_IOC_SETFLAGS: {
58 Index: linux-2.6.22-rc4/include/linux/ext4_fs.h
59 ===================================================================
60 --- linux-2.6.22-rc4.orig/include/linux/ext4_fs.h 2007-06-11 17:24:01.000000000 -0700
61 +++ linux-2.6.22-rc4/include/linux/ext4_fs.h 2007-06-11 17:24:28.000000000 -0700
62 @@ -862,6 +862,7 @@
63 extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
64 extern void ext4_truncate (struct inode *);
65 extern void ext4_set_inode_flags(struct inode *);
66 +extern void ext4_get_inode_flags(struct ext4_inode_info *);
67 extern void ext4_set_aops(struct inode *inode);
68 extern int ext4_writepage_trans_blocks(struct inode *);
69 extern int ext4_block_truncate_page(handle_t *handle, struct page *page,