1 Index: linux-2.6.27.21-0.1/fs/ext4/ialloc.c
2 ===================================================================
3 --- linux-2.6.27.21-0.1.orig/fs/ext4/ialloc.c 2009-07-07 14:47:04.000000000 +0530
4 +++ linux-2.6.27.21-0.1/fs/ext4/ialloc.c 2009-07-07 15:04:02.000000000 +0530
9 +unsigned long ext4_find_reverse(struct super_block *sb)
11 + struct ext4_group_desc *desc;
12 + struct buffer_head *bitmap_bh = NULL;
14 + unsigned long ino, offset;
16 + for (offset = (EXT4_INODES_PER_GROUP(sb) >> 1); offset >= 0;
18 + for (group = EXT4_SB(sb)->s_groups_count - 1; group >= 0;
20 + desc = ext4_get_group_desc(sb, group, NULL);
21 + if (ext4_free_inodes_count(sb, desc) == 0)
24 + bitmap_bh = ext4_read_inode_bitmap(sb, group);
28 + ino = ext4_find_next_zero_bit((unsigned long *)
30 + EXT4_INODES_PER_GROUP(sb), offset);
31 + if (ino < EXT4_INODES_PER_GROUP(sb))
32 + return (group * EXT4_INODES_PER_GROUP(sb) +
39 /* Verify that we are loading a valid orphan from disk */
40 struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino)
42 Index: linux-2.6.27.21-0.1/fs/ext4/namei.c
43 ===================================================================
44 --- linux-2.6.27.21-0.1.orig/fs/ext4/namei.c 2009-07-07 14:47:05.000000000 +0530
45 +++ linux-2.6.27.21-0.1/fs/ext4/namei.c 2009-07-07 15:04:21.000000000 +0530
50 +/* Only use the least 3 bits of ldp_flags for goal policy */
53 + DP_LASTGROUP_REVERSE = 1,
56 static inline ext4_lblk_t dx_get_block(struct dx_entry *entry);
57 static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value);
58 static inline unsigned dx_get_hash(struct dx_entry *entry);
59 @@ -1771,8 +1777,14 @@
60 if (dentry->d_fsdata != NULL) {
61 struct lvfs_dentry_params *param = dentry->d_fsdata;
63 - if (param->ldp_magic == LVFS_DENTRY_PARAM_MAGIC)
64 - inum = param->ldp_inum;
65 + if (param->ldp_magic == LVFS_DENTRY_PARAM_MAGIC) {
66 + if ((dp_policy_t)(param->ldp_flags & 0x7) ==
67 + DP_LASTGROUP_REVERSE)
68 + inum = ext4_find_reverse(sb);
69 + else /* DP_GOAL_POLICY */
70 + inum = param->ldp_inum;
76 Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
77 ===================================================================
78 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h 2009-07-07 14:47:22.000000000 +0530
79 +++ linux-2.6.27.21-0.1/fs/ext4/ext4.h 2009-07-07 15:04:02.000000000 +0530
81 EXT4_SB(dir->i_sb)->s_inode_goal);
83 extern void ext4_free_inode(handle_t *, struct inode *);
84 +extern unsigned long ext4_find_reverse(struct super_block *);
85 extern struct inode * ext4_orphan_get(struct super_block *, unsigned long);
86 extern unsigned long ext4_count_free_inodes(struct super_block *);
87 extern unsigned long ext4_count_dirs(struct super_block *);