extents.c (ed7a7e16724a4123fce1fc0ff1f5131a0596f189) | extents.c (f86186b44b4164600cce03d0d93ad48ec21fa429) |
---|---|
1/* 2 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 3 * Written by Alex Tomas <alex@clusterfs.com> 4 * 5 * Architecture independence: 6 * Copyright (c) 2005, Bull S.A. 7 * Written by Pierre Peiffer <pierre.peiffer@bull.net> 8 * --- 100 unchanged lines hidden (view full) --- 109 } 110 return err; 111} 112 113static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode, 114 struct ext4_ext_path *path, 115 ext4_lblk_t block) 116{ | 1/* 2 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 3 * Written by Alex Tomas <alex@clusterfs.com> 4 * 5 * Architecture independence: 6 * Copyright (c) 2005, Bull S.A. 7 * Written by Pierre Peiffer <pierre.peiffer@bull.net> 8 * --- 100 unchanged lines hidden (view full) --- 109 } 110 return err; 111} 112 113static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode, 114 struct ext4_ext_path *path, 115 ext4_lblk_t block) 116{ |
117 struct ext4_inode_info *ei = EXT4_I(inode); 118 ext4_fsblk_t bg_start; 119 ext4_fsblk_t last_block; 120 ext4_grpblk_t colour; 121 ext4_group_t block_group; 122 int flex_size = ext4_flex_bg_size(EXT4_SB(inode->i_sb)); | |
123 int depth; 124 125 if (path) { 126 struct ext4_extent *ex; 127 depth = path->p_depth; 128 129 /* 130 * Try to predict block placement assuming that we are --- 25 unchanged lines hidden (view full) --- 156 157 /* it looks like index is empty; 158 * try to find starting block from index itself */ 159 if (path[depth].p_bh) 160 return path[depth].p_bh->b_blocknr; 161 } 162 163 /* OK. use inode's group */ | 117 int depth; 118 119 if (path) { 120 struct ext4_extent *ex; 121 depth = path->p_depth; 122 123 /* 124 * Try to predict block placement assuming that we are --- 25 unchanged lines hidden (view full) --- 150 151 /* it looks like index is empty; 152 * try to find starting block from index itself */ 153 if (path[depth].p_bh) 154 return path[depth].p_bh->b_blocknr; 155 } 156 157 /* OK. use inode's group */ |
164 block_group = ei->i_block_group; 165 if (flex_size >= EXT4_FLEX_SIZE_DIR_ALLOC_SCHEME) { 166 /* 167 * If there are at least EXT4_FLEX_SIZE_DIR_ALLOC_SCHEME 168 * block groups per flexgroup, reserve the first block 169 * group for directories and special files. Regular 170 * files will start at the second block group. This 171 * tends to speed up directory access and improves 172 * fsck times. 173 */ 174 block_group &= ~(flex_size-1); 175 if (S_ISREG(inode->i_mode)) 176 block_group++; 177 } 178 bg_start = ext4_group_first_block_no(inode->i_sb, block_group); 179 last_block = ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es) - 1; 180 181 /* 182 * If we are doing delayed allocation, we don't need take 183 * colour into account. 184 */ 185 if (test_opt(inode->i_sb, DELALLOC)) 186 return bg_start; 187 188 if (bg_start + EXT4_BLOCKS_PER_GROUP(inode->i_sb) <= last_block) 189 colour = (current->pid % 16) * 190 (EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16); 191 else 192 colour = (current->pid % 16) * ((last_block - bg_start) / 16); 193 return bg_start + colour + block; | 158 return ext4_inode_to_goal_block(inode); |
194} 195 196/* 197 * Allocation for a meta data block 198 */ 199static ext4_fsblk_t 200ext4_ext_new_meta_block(handle_t *handle, struct inode *inode, 201 struct ext4_ext_path *path, --- 4161 unchanged lines hidden --- | 159} 160 161/* 162 * Allocation for a meta data block 163 */ 164static ext4_fsblk_t 165ext4_ext_new_meta_block(handle_t *handle, struct inode *inode, 166 struct ext4_ext_path *path, --- 4161 unchanged lines hidden --- |