diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2010-03-03 23:55:01 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-03-03 23:55:01 -0500 |
commit | 731eb1a03a8445cde2cb23ecfb3580c6fa7bb690 (patch) | |
tree | 9978388978604207cc78da1c81b97625857256cb /fs | |
parent | bda00de7e8569b1fcde27b68fa59e74e14c5f93a (diff) |
ext4: consolidate in_range() definitions
There are duplicate macro definitions of in_range() in mballoc.h and
balloc.c. This consolidates these two definitions into ext4.h, and
changes extents.c to use in_range() as well.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger@sun.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/balloc.c | 3 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 2 | ||||
-rw-r--r-- | fs/ext4/extents.c | 4 | ||||
-rw-r--r-- | fs/ext4/mballoc.h | 2 |
4 files changed, 4 insertions, 7 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index fadbc4d3a202..d2f37a5516c7 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -188,9 +188,6 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
188 | * when a file system is mounted (see ext4_fill_super). | 188 | * when a file system is mounted (see ext4_fill_super). |
189 | */ | 189 | */ |
190 | 190 | ||
191 | |||
192 | #define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) | ||
193 | |||
194 | /** | 191 | /** |
195 | * ext4_get_group_desc() -- load group descriptor from disk | 192 | * ext4_get_group_desc() -- load group descriptor from disk |
196 | * @sb: super block | 193 | * @sb: super block |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 3d85bbb09f1b..9b179163f1de 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1819,6 +1819,8 @@ static inline void set_bitmap_uptodate(struct buffer_head *bh) | |||
1819 | set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state); | 1819 | set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state); |
1820 | } | 1820 | } |
1821 | 1821 | ||
1822 | #define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) | ||
1823 | |||
1822 | #endif /* __KERNEL__ */ | 1824 | #endif /* __KERNEL__ */ |
1823 | 1825 | ||
1824 | #endif /* _EXT4_H */ | 1826 | #endif /* _EXT4_H */ |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 3c0bae11a097..94c8ee81f5e1 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -2051,7 +2051,7 @@ ext4_ext_in_cache(struct inode *inode, ext4_lblk_t block, | |||
2051 | 2051 | ||
2052 | BUG_ON(cex->ec_type != EXT4_EXT_CACHE_GAP && | 2052 | BUG_ON(cex->ec_type != EXT4_EXT_CACHE_GAP && |
2053 | cex->ec_type != EXT4_EXT_CACHE_EXTENT); | 2053 | cex->ec_type != EXT4_EXT_CACHE_EXTENT); |
2054 | if (block >= cex->ec_block && block < cex->ec_block + cex->ec_len) { | 2054 | if (in_range(block, cex->ec_block, cex->ec_len)) { |
2055 | ex->ee_block = cpu_to_le32(cex->ec_block); | 2055 | ex->ee_block = cpu_to_le32(cex->ec_block); |
2056 | ext4_ext_store_pblock(ex, cex->ec_start); | 2056 | ext4_ext_store_pblock(ex, cex->ec_start); |
2057 | ex->ee_len = cpu_to_le16(cex->ec_len); | 2057 | ex->ee_len = cpu_to_le16(cex->ec_len); |
@@ -3364,7 +3364,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
3364 | */ | 3364 | */ |
3365 | ee_len = ext4_ext_get_actual_len(ex); | 3365 | ee_len = ext4_ext_get_actual_len(ex); |
3366 | /* if found extent covers block, simply return it */ | 3366 | /* if found extent covers block, simply return it */ |
3367 | if (iblock >= ee_block && iblock < ee_block + ee_len) { | 3367 | if (in_range(iblock, ee_block, ee_len)) { |
3368 | newblock = iblock - ee_block + ee_start; | 3368 | newblock = iblock - ee_block + ee_start; |
3369 | /* number of remaining blocks in the extent */ | 3369 | /* number of remaining blocks in the extent */ |
3370 | allocated = ee_len - (iblock - ee_block); | 3370 | allocated = ee_len - (iblock - ee_block); |
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h index 9b2deed652b7..b619322c76f0 100644 --- a/fs/ext4/mballoc.h +++ b/fs/ext4/mballoc.h | |||
@@ -220,8 +220,6 @@ struct ext4_buddy { | |||
220 | #define EXT4_MB_BITMAP(e4b) ((e4b)->bd_bitmap) | 220 | #define EXT4_MB_BITMAP(e4b) ((e4b)->bd_bitmap) |
221 | #define EXT4_MB_BUDDY(e4b) ((e4b)->bd_buddy) | 221 | #define EXT4_MB_BUDDY(e4b) ((e4b)->bd_buddy) |
222 | 222 | ||
223 | #define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) | ||
224 | |||
225 | static inline ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb, | 223 | static inline ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb, |
226 | struct ext4_free_extent *fex) | 224 | struct ext4_free_extent *fex) |
227 | { | 225 | { |