Messages in this thread | | | Date | Sat, 11 Dec 1999 23:08:47 -0500 (EST) | From | afei@jhu ... | Subject | fs/ext2/balloc.c question |
| |
I do not quite understand how this function works. Check out line:232. It looks to me like an infinite lookp.
Fei
205 static inline int load_block_bitmap (struct super_block * sb, 206 unsigned int block_group) 207 { 208 int slot; 209 210 /* 211 * Do the lookup for the slot. First of all, check if we're asking 212 * for the same slot as last time, and did we succeed that last time? 213 */ 214 if (sb->u.ext2_sb.s_loaded_block_bitmaps > 0 && 215 sb->u.ext2_sb.s_block_bitmap_number[0] == block_group && 216 sb->u.ext2_sb.s_block_bitmap[block_group]) { 217 return 0; 218 } 219 /* 220 * Or can we do a fast lookup based on a loaded group on a filesystem 221 * small enough to be mapped directly into the superblock? 222 */ 223 else if (sb->u.ext2_sb.s_groups_count <= EXT2_MAX_GROUP_LOADED && 224 sb->u.ext2_sb.s_block_bitmap_number[block_group] == block_group && 225 sb->u.ext2_sb.s_block_bitmap[block_group]) { 226 slot = block_group; 227 } 228 /* 229 * If not, then do a full lookup for this block group. 230 */ 231 else { 232 slot = load__block_bitmap (sb, block_group); 233 } 234 235 /* 236 * <0 means we just got an error 237 */ 238 if (slot < 0) 239 return slot; 240 241 /* 242 * If it's a valid slot, we may still have cached a previous IO error, 243 * in which case the bh in the superblock cache will be zero. 244 */ 245 if (!sb->u.ext2_sb.s_block_bitmap[slot]) 246 return -EIO; 247 248 /* 249 * Must have been read in OK to get this far. 250 */ 251 return slot; 252 }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |