diff options
author | David Sterba <dsterba@suse.cz> | 2014-06-04 19:59:57 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-09-17 16:37:17 -0400 |
commit | ed6078f70335f158ca79790a0d0708ce558a6e9a (patch) | |
tree | 636322e2a1e25f7db9f5982204a8fa4bc1bf9cbf /fs/btrfs/raid56.c | |
parent | 4e54b17ad67a2d0d59bda6edcf725dc5b281c253 (diff) |
btrfs: use DIV_ROUND_UP instead of open-coded variants
The form
(value + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT
is equivalent to
(value + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE
The rest is a simple subsitution, no difference in the generated
assembly code.
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/raid56.c')
-rw-r--r-- | fs/btrfs/raid56.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 0a6b6e4bcbb9..6a41631cb959 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
@@ -912,7 +912,7 @@ static struct page *page_in_rbio(struct btrfs_raid_bio *rbio, | |||
912 | static unsigned long rbio_nr_pages(unsigned long stripe_len, int nr_stripes) | 912 | static unsigned long rbio_nr_pages(unsigned long stripe_len, int nr_stripes) |
913 | { | 913 | { |
914 | unsigned long nr = stripe_len * nr_stripes; | 914 | unsigned long nr = stripe_len * nr_stripes; |
915 | return (nr + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 915 | return DIV_ROUND_UP(nr, PAGE_CACHE_SIZE); |
916 | } | 916 | } |
917 | 917 | ||
918 | /* | 918 | /* |
@@ -1442,7 +1442,7 @@ static int raid56_rmw_stripe(struct btrfs_raid_bio *rbio) | |||
1442 | struct btrfs_bio *bbio = rbio->bbio; | 1442 | struct btrfs_bio *bbio = rbio->bbio; |
1443 | struct bio_list bio_list; | 1443 | struct bio_list bio_list; |
1444 | int ret; | 1444 | int ret; |
1445 | int nr_pages = (rbio->stripe_len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 1445 | int nr_pages = DIV_ROUND_UP(rbio->stripe_len, PAGE_CACHE_SIZE); |
1446 | int pagenr; | 1446 | int pagenr; |
1447 | int stripe; | 1447 | int stripe; |
1448 | struct bio *bio; | 1448 | struct bio *bio; |
@@ -1725,7 +1725,7 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio) | |||
1725 | int pagenr, stripe; | 1725 | int pagenr, stripe; |
1726 | void **pointers; | 1726 | void **pointers; |
1727 | int faila = -1, failb = -1; | 1727 | int faila = -1, failb = -1; |
1728 | int nr_pages = (rbio->stripe_len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 1728 | int nr_pages = DIV_ROUND_UP(rbio->stripe_len, PAGE_CACHE_SIZE); |
1729 | struct page *page; | 1729 | struct page *page; |
1730 | int err; | 1730 | int err; |
1731 | int i; | 1731 | int i; |
@@ -1940,7 +1940,7 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio) | |||
1940 | struct btrfs_bio *bbio = rbio->bbio; | 1940 | struct btrfs_bio *bbio = rbio->bbio; |
1941 | struct bio_list bio_list; | 1941 | struct bio_list bio_list; |
1942 | int ret; | 1942 | int ret; |
1943 | int nr_pages = (rbio->stripe_len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 1943 | int nr_pages = DIV_ROUND_UP(rbio->stripe_len, PAGE_CACHE_SIZE); |
1944 | int pagenr; | 1944 | int pagenr; |
1945 | int stripe; | 1945 | int stripe; |
1946 | struct bio *bio; | 1946 | struct bio *bio; |