diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2019-09-02 12:31:06 -0400 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2019-09-04 14:22:06 -0400 |
commit | 45eb05042d5667408d101a8c056f70a8e8ac27f6 (patch) | |
tree | 080cb4db4973cb944d5e2a99b9b58478001e6d6d | |
parent | 8f0daef5f797c13d7f9bd248190933932b14df36 (diff) |
gfs2: Minor PAGE_SIZE arithmetic cleanups
Replace divisions by PAGE_SIZE with shifts by PAGE_SHIFT and similar.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r-- | fs/gfs2/aops.c | 4 | ||||
-rw-r--r-- | fs/gfs2/file.c | 2 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index f42048cc5454..b9fe975d7625 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -243,7 +243,7 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping, | |||
243 | { | 243 | { |
244 | struct inode *inode = mapping->host; | 244 | struct inode *inode = mapping->host; |
245 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 245 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
246 | unsigned nrblocks = nr_pages * (PAGE_SIZE/inode->i_sb->s_blocksize); | 246 | unsigned nrblocks = nr_pages * (PAGE_SIZE >> inode->i_blkbits); |
247 | int i; | 247 | int i; |
248 | int ret; | 248 | int ret; |
249 | 249 | ||
@@ -552,7 +552,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos, | |||
552 | unsigned size) | 552 | unsigned size) |
553 | { | 553 | { |
554 | struct address_space *mapping = ip->i_inode.i_mapping; | 554 | struct address_space *mapping = ip->i_inode.i_mapping; |
555 | unsigned long index = *pos / PAGE_SIZE; | 555 | unsigned long index = *pos >> PAGE_SHIFT; |
556 | unsigned offset = *pos & (PAGE_SIZE - 1); | 556 | unsigned offset = *pos & (PAGE_SIZE - 1); |
557 | unsigned copied = 0; | 557 | unsigned copied = 0; |
558 | unsigned amt; | 558 | unsigned amt; |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 99e2c8cd5eaa..997b326247e2 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -1049,7 +1049,7 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t | |||
1049 | rblocks += data_blocks ? data_blocks : 1; | 1049 | rblocks += data_blocks ? data_blocks : 1; |
1050 | 1050 | ||
1051 | error = gfs2_trans_begin(sdp, rblocks, | 1051 | error = gfs2_trans_begin(sdp, rblocks, |
1052 | PAGE_SIZE/sdp->sd_sb.sb_bsize); | 1052 | PAGE_SIZE >> inode->i_blkbits); |
1053 | if (error) | 1053 | if (error) |
1054 | goto out_trans_fail; | 1054 | goto out_trans_fail; |
1055 | 1055 | ||
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 69c4b77f127b..7c016a082aa6 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -774,7 +774,7 @@ static int gfs2_write_disk_quota(struct gfs2_inode *ip, struct gfs2_quota *qp, | |||
774 | nbytes = sizeof(struct gfs2_quota); | 774 | nbytes = sizeof(struct gfs2_quota); |
775 | 775 | ||
776 | pg_beg = loc >> PAGE_SHIFT; | 776 | pg_beg = loc >> PAGE_SHIFT; |
777 | pg_off = loc % PAGE_SIZE; | 777 | pg_off = offset_in_page(loc); |
778 | 778 | ||
779 | /* If the quota straddles a page boundary, split the write in two */ | 779 | /* If the quota straddles a page boundary, split the write in two */ |
780 | if ((pg_off + nbytes) > PAGE_SIZE) { | 780 | if ((pg_off + nbytes) > PAGE_SIZE) { |