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>
This commit is contained in:
@@ -484,7 +484,6 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_key *key)
|
||||
{
|
||||
int found_type;
|
||||
u64 mask = root->sectorsize - 1;
|
||||
u64 extent_end;
|
||||
u64 start = key->offset;
|
||||
u64 saved_nbytes;
|
||||
@@ -501,7 +500,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
|
||||
extent_end = start + btrfs_file_extent_num_bytes(eb, item);
|
||||
else if (found_type == BTRFS_FILE_EXTENT_INLINE) {
|
||||
size = btrfs_file_extent_inline_len(eb, item);
|
||||
extent_end = (start + size + mask) & ~mask;
|
||||
extent_end = ALIGN(start + size, root->sectorsize);
|
||||
} else {
|
||||
ret = 0;
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user