Whamcloud - gitweb
b=20298 (Merge head ldiskfs and b1_8 ldiskfs)
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-pdir-fix.patch
1 diff -rupN linux-2.6.27.21-0.1_1//fs/ext4/ext4_i.h linux-2.6.27.21-0.1_2//fs/ext4/ext4_i.h
2 --- linux-2.6.27.21-0.1_1//fs/ext4/ext4_i.h     2009-08-24 13:00:59.000000000 +0530
3 +++ linux-2.6.27.21-0.1_2//fs/ext4/ext4_i.h     2009-08-24 13:01:25.000000000 +0530
4 @@ -16,6 +16,7 @@
5  #ifndef _EXT4_I
6  #define _EXT4_I
7  
8 +#include <linux/dynlocks.h>
9  #include <linux/rwsem.h>
10  #include <linux/rbtree.h>
11  #include <linux/seqlock.h>
12 @@ -56,7 +57,9 @@ struct ext4_inode_info {
13         __u32   i_flags;
14         ext4_fsblk_t    i_file_acl;
15         __u32   i_dtime;
16 -
17 +       /* following fields for parallel directory operations -bzzz */
18 +       struct dynlock   i_htree_lock;
19 +       struct semaphore i_append_sem;
20         /*
21          * i_block_group is the number of the block group which contains
22          * this file's inode.  Constant across the lifetime of the inode,
23 diff -rupN linux-2.6.27.21-0.1_1//fs/ext4/namei.c linux-2.6.27.21-0.1_2//fs/ext4/namei.c
24 --- linux-2.6.27.21-0.1_1//fs/ext4/namei.c      2009-08-24 13:00:59.000000000 +0530
25 +++ linux-2.6.27.21-0.1_2//fs/ext4/namei.c      2009-08-24 13:03:45.000000000 +0530
26 @@ -55,6 +55,11 @@ static struct buffer_head *ext4_append(h
27                                         ext4_lblk_t *block, int *err)
28  {
29         struct buffer_head *bh;
30 +       struct ext4_inode_info *ei = EXT4_I(inode);
31 +
32 +       /* with parallel dir operations all appends
33 +       * have to be serialized -bzzz */
34 +       down(&ei->i_append_sem);
35  
36         *block = inode->i_size >> inode->i_sb->s_blocksize_bits;
37  
38 @@ -67,7 +72,9 @@ static struct buffer_head *ext4_append(h
39                         brelse(bh);
40                         bh = NULL;
41                 }
42 +               ei->i_disksize = inode->i_size;
43         }
44 +       up(&ei->i_append_sem);
45         return bh;
46  }
47  
48 diff -rupN linux-2.6.27.21-0.1_1//fs/ext4/super.c linux-2.6.27.21-0.1_2//fs/ext4/super.c
49 --- linux-2.6.27.21-0.1_1//fs/ext4/super.c      2009-08-24 13:00:59.000000000 +0530
50 +++ linux-2.6.27.21-0.1_2//fs/ext4/super.c      2009-08-24 13:01:25.000000000 +0530
51 @@ -635,6 +635,8 @@ static struct inode *ext4_alloc_inode(st
52  #endif
53         ei->vfs_inode.i_version = 1;
54         ei->vfs_inode.i_data.writeback_index = 0;
55 +       dynlock_init(&ei->i_htree_lock);
56 +       sema_init(&ei->i_append_sem, 1);
57         memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache));
58         INIT_LIST_HEAD(&ei->i_prealloc_list);
59         spin_lock_init(&ei->i_prealloc_lock);