Whamcloud - gitweb
b=22790 strip the .patch off of the dpatch name
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext3-extents-fixes-2.6.9-rhel4.patch
1  - minor fixes
2  - multiblock get_block() for direct I/O
3
4 Index: linux-2.6.9-full/include/linux/ext3_extents.h
5 ===================================================================
6 --- linux-2.6.9-full.orig/include/linux/ext3_extents.h  2007-03-23 15:57:00.000000000 +0300
7 +++ linux-2.6.9-full/include/linux/ext3_extents.h       2007-03-28 00:59:32.000000000 +0400
8 @@ -205,7 +205,7 @@ typedef int (*ext_prepare_callback)(stru
9  #define EXT_DEPTH(__tree__)    (EXT_ROOT_HDR(__tree__)->eh_depth)
10  #define EXT_GENERATION(__tree__) EXT_HDR_GEN(EXT_ROOT_HDR(__tree__))
11  
12 -#define EXT_ASSERT(__x__) if (!(__x__)) BUG();
13 +#define EXT_ASSERT(__x__) if (unlikely(!(__x__))) BUG();
14  
15  #define EXT_CHECK_PATH(tree,path)                                      \
16  {                                                                      \
17 Index: linux-2.6.9-full/fs/ext3/extents.c
18 ===================================================================
19 --- linux-2.6.9-full.orig/fs/ext3/extents.c     2007-03-23 15:57:00.000000000 +0300
20 +++ linux-2.6.9-full/fs/ext3/extents.c  2007-03-28 00:59:41.000000000 +0400
21 @@ -895,6 +895,8 @@ repeat:
22                 /* if we found index with free entry, then use that
23                  * entry: create all needed subtree and add new leaf */
24                 err = ext3_ext_split(handle, tree, path, newext, i);
25 +               if (err)
26 +                       goto out;
27  
28                 /* refill path */
29                 ext3_ext_drop_refs(path);
30 @@ -904,12 +906,16 @@ repeat:
31         } else {
32                 /* tree is full, time to grow in depth */
33                 err = ext3_ext_grow_indepth(handle, tree, path, newext);
34 +               if (err)
35 +                       goto out;
36  
37                 /* refill path */
38                 ext3_ext_drop_refs(path);
39                 path = ext3_ext_find_extent(tree, newext->ee_block, path);
40 -               if (IS_ERR(path))
41 +               if (IS_ERR(path)) {
42                         err = PTR_ERR(path);
43 +                       goto out;
44 +               }
45  
46                 /*
47                  * only first (depth 0 -> 1) produces free space
48 @@ -922,10 +928,8 @@ repeat:
49                 }
50         }
51  
52 -       if (err)
53 -               return err;
54 -
55 -       return 0;
56 +out:
57 +       return err;
58  }
59  
60  /*
61 @@ -1992,21 +1996,10 @@ static int ext3_new_block_cb(handle_t *h
62         EXT_ASSERT(ex->ee_start);
63         EXT_ASSERT(ex->ee_len);
64         
65 -       /* reuse block from the extent to order data/metadata */
66 -       newblock = ex->ee_start++;
67 -       ex->ee_len--;
68 -       if (ex->ee_len == 0) {
69 -               ex->ee_len = 1;
70 -               /* allocate new block for the extent */
71 -               goal = ext3_ext_find_goal(inode, path, ex->ee_block);
72 -               ex->ee_start = ext3_new_block(handle, inode, goal, err);
73 -               ex->ee_start_hi = 0;
74 -               if (ex->ee_start == 0) {
75 -                       /* error occured: restore old extent */
76 -                       ex->ee_start = newblock;
77 -                       return 0;
78 -               }
79 -       }
80 +       /* allocate new block for the extent */
81 +       goal = ext3_ext_find_goal(inode, path, ex->ee_block);
82 +       newblock = ext3_new_block(handle, inode, goal, err);
83 +
84         return newblock;
85  }
86