Several places in extents.c look like they should be using ext4_lblk_t rather than unsigned long or unsigned int. (any further scrutiny welcomed) :) Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> --- Index: linux-2.6.24-rc1/fs/ext4/extents.c =================================================================== --- linux-2.6.24-rc1.orig/fs/ext4/extents.c +++ linux-2.6.24-rc1/fs/ext4/extents.c @@ -1165,7 +1165,7 @@ ext4_ext_search_right(struct inode *inod * allocated block. Thus, index entries have to be consistent * with leaves. */ -static unsigned long +static ext4_lblk_t ext4_ext_next_allocated_block(struct ext4_ext_path *path) { int depth; @@ -1383,7 +1383,7 @@ unsigned int ext4_ext_check_overlap(stru struct ext4_extent *newext, struct ext4_ext_path *path) { - unsigned long b1, b2; + ext4_lblk_t b1, b2; unsigned int depth, len1; unsigned int ret = 0; @@ -1404,7 +1404,7 @@ unsigned int ext4_ext_check_overlap(stru goto out; } - /* check for wrap through zero */ + /* check for wrap through zero on extent logical start block*/ if (b1 + len1 < b1) { len1 = EXT_MAX_BLOCK - b1; newext->ee_len = cpu_to_le16(len1); @@ -1622,15 +1623,17 @@ ext4_ext_put_gap_in_cache(struct inode * ext4_ext_get_actual_len(ex)); } else if (block >= le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex)) { + ext4_lblk_t next; + lblock = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex); - len = ext4_ext_next_allocated_block(path); + next = ext4_ext_next_allocated_block(path); ext_debug("cache gap(after): [%u:%u] %u", le32_to_cpu(ex->ee_block), ext4_ext_get_actual_len(ex), block); - BUG_ON(len == lblock); - len = len - lblock; + BUG_ON(next == lblock); + len = next - lblock; } else { lblock = len = 0; BUG(); @@ -1752,7 +1755,7 @@ int ext4_ext_calc_credits_for_insert(str static int ext4_remove_blocks(handle_t *handle, struct inode *inode, struct ext4_extent *ex, - unsigned long from, unsigned long to) + ext4_lblk_t from, ext4_lblk_t to) { struct buffer_head *bh; unsigned short ee_len = ext4_ext_get_actual_len(ex); @@ -1778,11 +1781,12 @@ static int ext4_remove_blocks(handle_t * if (from >= le32_to_cpu(ex->ee_block) && to == le32_to_cpu(ex->ee_block) + ee_len - 1) { /* tail removal */ - unsigned long num; + ext4_lblk_t num; ext4_fsblk_t start; + num = le32_to_cpu(ex->ee_block) + ee_len - from; start = ext_pblock(ex) + ee_len - num; - ext_debug("free last %lu blocks starting %llu\n", num, start); + ext_debug("free last %u blocks starting %llu\n", num, start); for (i = 0; i < num; i++) { bh = sb_find_get_block(inode->i_sb, start + i); ext4_forget(handle, 0, inode, bh, start + i); @@ -1790,10 +1794,10 @@ static int ext4_remove_blocks(handle_t * ext4_free_blocks(handle, inode, start, num, metadata); } else if (from == le32_to_cpu(ex->ee_block) && to <= le32_to_cpu(ex->ee_block) + ee_len - 1) { - printk("strange request: removal %lu-%lu from %u:%u\n", + printk("strange request: removal %u-%u from %u:%u\n", from, to, le32_to_cpu(ex->ee_block), ee_len); } else { - printk("strange request: removal(2) %lu-%lu from %u:%u\n", + printk("strange request: removal(2) %u-%u from %u:%u\n", from, to, le32_to_cpu(ex->ee_block), ee_len); } return 0; @@ -1801,19 +1805,20 @@ static int ext4_remove_blocks(handle_t * static int ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, - struct ext4_ext_path *path, unsigned long start) + struct ext4_ext_path *path, ext4_lblk_t start) { int err = 0, correct_index = 0; int depth = ext_depth(inode), credits; struct ext4_extent_header *eh; - unsigned a, b, block, num; - unsigned long ex_ee_block; + ext4_lblk_t a, b, block; + unsigned num; + ext4_lblk_t ex_ee_block; unsigned short ex_ee_len; unsigned uninitialized = 0; struct ext4_extent *ex; /* the header must be checked already in ext4_ext_remove_space() */ - ext_debug("truncate since %lu in leaf\n", start); + ext_debug("truncate since %u in leaf\n", start); if (!path[depth].p_hdr) path[depth].p_hdr = ext_block_hdr(path[depth].p_bh); eh = path[depth].p_hdr; @@ -1944,7 +1949,7 @@ ext4_ext_more_to_rm(struct ext4_ext_path return 1; } -static int ext4_ext_remove_space(struct inode *inode, unsigned long start) +static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start) { struct super_block *sb = inode->i_sb; int depth = ext_depth(inode); @@ -1952,7 +1957,7 @@ static int ext4_ext_remove_space(struct handle_t *handle; int i = 0, err = 0; - ext_debug("truncate since %lu\n", start); + ext_debug("truncate since %u\n", start); /* probably first extent we're gonna free will be last in block */ handle = ext4_journal_start(inode, depth + 1); @@ -2144,7 +2149,8 @@ static int ext4_ext_convert_to_initializ struct ext4_extent *ex2 = NULL; struct ext4_extent *ex3 = NULL; struct ext4_extent_header *eh; - unsigned int allocated, ee_block, ee_len, depth; + ext4_lblk_t ee_block; + unsigned int allocated, ee_len, depth; ext4_fsblk_t newblock; int err = 0; int ret = 0; @@ -2487,7 +2493,7 @@ void ext4_ext_truncate(struct inode * in { struct address_space *mapping = inode->i_mapping; struct super_block *sb = inode->i_sb; - unsigned long last_block; + ext4_lblk_t last_block; handle_t *handle; int err = 0; - To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html