Whamcloud - gitweb
ad9e0eeb14137e4f91327fc799053aae5e4d5b43
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel6.3 / ext4-misc.patch
1 Index: linux-stage/fs/ext4/ext4.h
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ext4.h     2011-05-20 10:59:32.000000000 +0300
4 +++ linux-stage/fs/ext4/ext4.h  2011-05-20 11:01:06.000000000 +0300
5 @@ -1630,6 +1633,9 @@ extern void ext4_mb_put_buddy_cache_lock
6                                                 ext4_group_t, int);
7  extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
8  
9 +extern void ext4_mb_discard_inode_preallocations(struct inode *);
10 +
11 +
12  /* inode.c */
13  int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
14                 struct buffer_head *bh, ext4_fsblk_t blocknr);
15 Index: linux-stage/fs/ext4/ext4_extents.h
16 ===================================================================
17 --- linux-stage.orig/fs/ext4/ext4_extents.h     2011-05-20 10:59:30.000000000 +0300
18 +++ linux-stage/fs/ext4/ext4_extents.h  2011-05-20 11:00:01.000000000 +0300
19 @@ -58,6 +58,12 @@
20   */
21  #define EXT_STATS_
22  
23 +/*
24 + * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
25 + * are now accounted in ext4_ext_calc_credits_for_insert()
26 + */
27 +#define EXT4_ALLOC_NEEDED 0
28 +#define HAVE_EXT_PREPARE_CB_EXTENT
29  
30  /*
31   * ext4_inode has i_block array (60 bytes total).
32 @@ -239,6 +245,8 @@ extern int ext4_extent_tree_init(handle_
33  extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
34                                                    int num,
35                                                    struct ext4_ext_path *path);
36 +extern int ext4_ext_calc_credits_for_insert(struct inode *,
37 +                                           struct ext4_ext_path *);
38  extern int ext4_can_extents_be_merged(struct inode *inode,
39                                       struct ext4_extent *ex1,
40                                       struct ext4_extent *ex2);
41 Index: linux-stage/fs/ext4/ext4_jbd2.c
42 ===================================================================
43 --- linux-stage.orig/fs/ext4/ext4_jbd2.c        2011-05-20 10:59:29.000000000 +0300
44 +++ linux-stage/fs/ext4/ext4_jbd2.c     2011-05-20 11:00:01.000000000 +0300
45 @@ -31,6 +31,7 @@ int __ext4_journal_get_write_access(cons
46         }
47         return err;
48  }
49 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
50  
51  int __ext4_journal_forget(const char *where, handle_t *handle,
52                                 struct buffer_head *bh)
53 @@ -107,3 +108,4 @@ int __ext4_handle_dirty_metadata(const c
54         }
55         return err;
56  }
57 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
58 Index: linux-stage/fs/ext4/extents.c
59 ===================================================================
60 --- linux-stage.orig/fs/ext4/extents.c
61 +++ linux-stage/fs/ext4/extents.c
62 @@ -2133,6 +2133,55 @@ int ext4_ext_calc_credits_for_single_ext
63  }
64  
65  /*
66 + * This routine returns max. credits extent tree can consume.
67 + * It should be OK for low-performance paths like ->writepage()
68 + * To allow many writing process to fit a single transaction,
69 + * caller should calculate credits under truncate_mutex and
70 + * pass actual path.
71 + */
72 +int ext4_ext_calc_credits_for_insert(struct inode *inode,
73 +                                    struct ext4_ext_path *path)
74 +{
75 +       int depth, needed;
76 +
77 +       if (path) {
78 +               /* probably there is space in leaf? */
79 +               depth = path->p_depth;
80 +               if (le16_to_cpu(path[depth].p_hdr->eh_entries)
81 +                               < le16_to_cpu(path[depth].p_hdr->eh_max))
82 +                       return 1;
83 +       }
84 +
85 +       /*
86 +        * given 32bit logical block (4294967296 blocks), max. tree
87 +        * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
88 +        * let's also add one more level for imbalance.
89 +        */
90 +       depth = 5;
91 +
92 +       /* allocation of new data block(s) */
93 +       needed = 2;
94 +
95 +       /*
96 +        * tree can be full, so it'd need to grow in depth:
97 +        * we need one credit to modify old root, credits for
98 +        * new root will be added in split accounting
99 +        */
100 +       needed += 1;
101 +       /*
102 +        * Index split can happen, we'd need:
103 +        *    allocate intermediate indexes (bitmap + group)
104 +        *  + change two blocks at each level, but root (already included)
105 +        */
106 +       needed += (depth * 2) + (depth * 2);
107 +
108 +       /* any allocation modifies superblock */
109 +       needed += 1;
110 +
111 +       return needed;
112 +}
113 +
114 +/*
115   * How many index/leaf blocks need to change/allocate to modify nrblocks?
116   *
117   * if nrblocks are fit in a single extent (chunk flag is 1), then
118 @@ -4029,3 +4079,14 @@ int ext4_fiemap(struct inode *inode, str
119         return error;
120  }
121  
122 +EXPORT_SYMBOL(ext4_ext_store_pblock);
123 +EXPORT_SYMBOL(ext4_ext_search_right);
124 +EXPORT_SYMBOL(ext4_ext_search_left);
125 +EXPORT_SYMBOL(ext_pblock);
126 +EXPORT_SYMBOL(ext4_ext_insert_extent);
127 +EXPORT_SYMBOL(ext4_mb_new_blocks);
128 +EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
129 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
130 +EXPORT_SYMBOL(ext4_ext_walk_space);
131 +EXPORT_SYMBOL(ext4_ext_find_extent);
132 +EXPORT_SYMBOL(ext4_ext_drop_refs);
133 +
134 Index: linux-stage/fs/ext4/inode.c
135 ===================================================================
136 --- linux-stage.orig/fs/ext4/inode.c    2011-05-20 10:59:31.000000000 +0300
137 +++ linux-stage/fs/ext4/inode.c 2011-05-20 11:00:01.000000000 +0300
138 @@ -5249,6 +5249,7 @@ bad_inode:
139         iget_failed(inode);
140         return ERR_PTR(ret);
141  }
142 +EXPORT_SYMBOL(ext4_iget);
143  
144  static int ext4_inode_blocks_set(handle_t *handle,
145                                 struct ext4_inode *raw_inode,
146 Index: linux-stage/fs/ext4/mballoc.c
147 ===================================================================
148 --- linux-stage.orig/fs/ext4/mballoc.c  2011-05-20 10:59:32.000000000 +0300
149 +++ linux-stage/fs/ext4/mballoc.c       2011-05-20 11:00:01.000000000 +0300
150 @@ -4044,6 +4044,7 @@ repeat:
151         if (ac)
152                 kmem_cache_free(ext4_ac_cachep, ac);
153  }
154 +EXPORT_SYMBOL(ext4_discard_preallocations);
155  
156  /*
157   * finds all preallocated spaces and return blocks being freed to them
158 @@ -5029,3 +5030,6 @@ int ext4_trim_fs(struct super_block *sb,
159  
160         return ret;
161  }
162 +
163 +EXPORT_SYMBOL(ext4_free_blocks);
164 +
165 Index: linux-stage/fs/ext4/super.c
166 ===================================================================
167 --- linux-stage.orig/fs/ext4/super.c    2011-05-20 10:59:31.000000000 +0300
168 +++ linux-stage/fs/ext4/super.c 2011-05-20 11:00:01.000000000 +0300
169 @@ -128,6 +128,7 @@ __u32 ext4_itable_unused_count(struct su
170                 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
171                  (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
172  }
173 +EXPORT_SYMBOL(ext4_itable_unused_count);
174  
175  void ext4_block_bitmap_set(struct super_block *sb,
176                            struct ext4_group_desc *bg, ext4_fsblk_t blk)