btrfs: use offset_in_page instead of open-coding it

Constructs like 'var & (PAGE_SIZE - 1)' or 'var & ~PAGE_MASK' can denote an
offset into a page.

So replace them by the offset_in_page() macro instead of open-coding it if
they're not used as an alignment check.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Johannes Thumshirn
2018-12-05 15:23:03 +01:00
committed by David Sterba
parent cb5583dd52
commit 7073017aeb
7 changed files with 38 additions and 44 deletions

View File

@@ -477,7 +477,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
if (page->index == end_index) {
char *userpage;
size_t zero_offset = isize & (PAGE_SIZE - 1);
size_t zero_offset = offset_in_page(isize);
if (zero_offset) {
int zeros;