Commit 45eb0504 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Minor PAGE_SIZE arithmetic cleanups

Replace divisions by PAGE_SIZE with shifts by PAGE_SHIFT and similar.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 8f0daef5
...@@ -243,7 +243,7 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping, ...@@ -243,7 +243,7 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping,
{ {
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
struct gfs2_sbd *sdp = GFS2_SB(inode); 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 i;
int ret; int ret;
...@@ -552,7 +552,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos, ...@@ -552,7 +552,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos,
unsigned size) unsigned size)
{ {
struct address_space *mapping = ip->i_inode.i_mapping; 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 offset = *pos & (PAGE_SIZE - 1);
unsigned copied = 0; unsigned copied = 0;
unsigned amt; unsigned amt;
......
...@@ -1049,7 +1049,7 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t ...@@ -1049,7 +1049,7 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t
rblocks += data_blocks ? data_blocks : 1; rblocks += data_blocks ? data_blocks : 1;
error = gfs2_trans_begin(sdp, rblocks, error = gfs2_trans_begin(sdp, rblocks,
PAGE_SIZE/sdp->sd_sb.sb_bsize); PAGE_SIZE >> inode->i_blkbits);
if (error) if (error)
goto out_trans_fail; goto out_trans_fail;
......
...@@ -774,7 +774,7 @@ static int gfs2_write_disk_quota(struct gfs2_inode *ip, struct gfs2_quota *qp, ...@@ -774,7 +774,7 @@ static int gfs2_write_disk_quota(struct gfs2_inode *ip, struct gfs2_quota *qp,
nbytes = sizeof(struct gfs2_quota); nbytes = sizeof(struct gfs2_quota);
pg_beg = loc >> PAGE_SHIFT; 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 the quota straddles a page boundary, split the write in two */
if ((pg_off + nbytes) > PAGE_SIZE) { if ((pg_off + nbytes) > PAGE_SIZE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment