]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ext4: consolidate in_range() definitions
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 4 Mar 2010 04:55:01 +0000 (23:55 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Mar 2011 19:44:12 +0000 (12:44 -0700)
commit 731eb1a03a8445cde2cb23ecfb3580c6fa7bb690 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/balloc.c
fs/ext4/ext4.h
fs/ext4/extents.c
fs/ext4/mballoc.h

index 22bc7435d9134b397f537440faa15ce890b7c44f..876c748b518ac391ad4884195cb8e66bf502c777 100644 (file)
@@ -189,9 +189,6 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
  * when a file system is mounted (see ext4_fill_super).
  */
 
-
-#define in_range(b, first, len)        ((b) >= (first) && (b) <= (first) + (len) - 1)
-
 /**
  * ext4_get_group_desc() -- load group descriptor from disk
  * @sb:                        super block
index 602d5ad6f5e75ef08d06a33ed22661e460b51c26..3744359616df6e3cc437ce767603144244149690 100644 (file)
@@ -1773,6 +1773,8 @@ static inline void set_bitmap_uptodate(struct buffer_head *bh)
        set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state);
 }
 
+#define in_range(b, first, len)        ((b) >= (first) && (b) <= (first) + (len) - 1)
+
 #endif /* __KERNEL__ */
 
 #endif /* _EXT4_H */
index cae75c122ea4d2ad69f8c6ec1b637b1f165c2afe..1667fac41f32ca25735cc887cb9282824856839c 100644 (file)
@@ -1952,7 +1952,7 @@ ext4_ext_in_cache(struct inode *inode, ext4_lblk_t block,
 
        BUG_ON(cex->ec_type != EXT4_EXT_CACHE_GAP &&
                        cex->ec_type != EXT4_EXT_CACHE_EXTENT);
-       if (block >= cex->ec_block && block < cex->ec_block + cex->ec_len) {
+       if (in_range(block, cex->ec_block, cex->ec_len)) {
                ex->ee_block = cpu_to_le32(cex->ec_block);
                ext4_ext_store_pblock(ex, cex->ec_start);
                ex->ee_len = cpu_to_le16(cex->ec_len);
@@ -3258,7 +3258,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
                 */
                ee_len = ext4_ext_get_actual_len(ex);
                /* if found extent covers block, simply return it */
-               if (iblock >= ee_block && iblock < ee_block + ee_len) {
+               if (in_range(iblock, ee_block, ee_len)) {
                        newblock = iblock - ee_block + ee_start;
                        /* number of remaining blocks in the extent */
                        allocated = ee_len - (iblock - ee_block);
index 436521cae45662629d02871d5ff8429aee92065b..ae6de87712e3cbcc70ab89a490cec3098eb3d3d0 100644 (file)
@@ -220,8 +220,6 @@ struct ext4_buddy {
 #define EXT4_MB_BITMAP(e4b)    ((e4b)->bd_bitmap)
 #define EXT4_MB_BUDDY(e4b)     ((e4b)->bd_buddy)
 
-#define in_range(b, first, len)        ((b) >= (first) && (b) <= (first) + (len) - 1)
-
 static inline ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb,
                                        struct ext4_free_extent *fex)
 {