diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2013-02-26 08:10:22 +0000 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-02-26 11:04:13 -0500 |
commit | fda2832febb1928da0625b2c5d15559b29d7e740 (patch) | |
tree | dac83eff57b657dfc04ba72fa7bcce4b4674b810 /fs/btrfs/volumes.c | |
parent | 8c4ce81e911ab6c84e4f75e18d4ceb3fa555c35b (diff) | |
download | op-kernel-dev-fda2832febb1928da0625b2c5d15559b29d7e740.zip op-kernel-dev-fda2832febb1928da0625b2c5d15559b29d7e740.tar.gz |
btrfs: cleanup for open-coded alignment
Though most of the btrfs codes are using ALIGN macro for page alignment,
there are still some codes using open-coded alignment like the
following:
------
u64 mask = ((u64)root->stripesize - 1);
u64 ret = (val + mask) & ~mask;
------
Or even hidden one:
------
num_bytes = (end - start + blocksize) & ~(blocksize - 1);
------
Sometimes these open-coded alignment is not so easy to understand for
newbie like me.
This commit changes the open-coded alignment to the ALIGN macro for a
better readability.
Also there is a previous patch from David Sterba with similar changes,
but the patch is for 3.2 kernel and seems not merged.
http://www.spinics.net/lists/linux-btrfs/msg12747.html
Cc: David Sterba <dave@jikos.cz>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 538c5cf..db72e0c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -4556,8 +4556,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw, num_stripes = 1; stripe_index = 0; stripe_nr_orig = stripe_nr; - stripe_nr_end = (offset + *length + map->stripe_len - 1) & - (~(map->stripe_len - 1)); + stripe_nr_end = ALIGN(offset + *length, map->stripe_len); do_div(stripe_nr_end, map->stripe_len); stripe_end_offset = stripe_nr_end * map->stripe_len - (offset + *length); |