]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gfs2: Minor PAGE_SIZE arithmetic cleanups
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 2 Sep 2019 16:31:06 +0000 (17:31 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 4 Sep 2019 18:22:06 +0000 (20:22 +0200)
Replace divisions by PAGE_SIZE with shifts by PAGE_SHIFT and similar.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/aops.c
fs/gfs2/file.c
fs/gfs2/quota.c

index f42048cc54549e62fe0d373170df3fac9e46e4ff..b9fe975d7625a2b5c4d3e840e30c92a7d5abce70 100644 (file)
@@ -243,7 +243,7 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping,
 {
        struct inode *inode = mapping->host;
        struct gfs2_sbd *sdp = GFS2_SB(inode);
-       unsigned nrblocks = nr_pages * (PAGE_SIZE/inode->i_sb->s_blocksize);
+       unsigned nrblocks = nr_pages * (PAGE_SIZE >> inode->i_blkbits);
        int i;
        int ret;
 
@@ -552,7 +552,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos,
                        unsigned size)
 {
        struct address_space *mapping = ip->i_inode.i_mapping;
-       unsigned long index = *pos / PAGE_SIZE;
+       unsigned long index = *pos >> PAGE_SHIFT;
        unsigned offset = *pos & (PAGE_SIZE - 1);
        unsigned copied = 0;
        unsigned amt;
index 99e2c8cd5eaae73b222e47f891a473ee7423c16b..997b326247e26c9432cb87e94688e716b0debd49 100644 (file)
@@ -1049,7 +1049,7 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t
                        rblocks += data_blocks ? data_blocks : 1;
 
                error = gfs2_trans_begin(sdp, rblocks,
-                                        PAGE_SIZE/sdp->sd_sb.sb_bsize);
+                                        PAGE_SIZE >> inode->i_blkbits);
                if (error)
                        goto out_trans_fail;
 
index 69c4b77f127b19d21910aed75f57942c0f166525..7c016a082aa68cd963d39deb0bb99df90df8abbf 100644 (file)
@@ -774,7 +774,7 @@ static int gfs2_write_disk_quota(struct gfs2_inode *ip, struct gfs2_quota *qp,
        nbytes = sizeof(struct gfs2_quota);
 
        pg_beg = loc >> PAGE_SHIFT;
-       pg_off = loc % PAGE_SIZE;
+       pg_off = offset_in_page(loc);
 
        /* If the quota straddles a page boundary, split the write in two */
        if ((pg_off + nbytes) > PAGE_SIZE) {