Skip to contentSkip to conversation

GFS2: Eliminate 64-bit divides

PATCH New Bob Peterson 2 participants 2 messages Jul 20, 2012 1 message not in the archive GFS2 file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 2a6c55fa-677e-4459-b841-524ef2512548@zmail12.collab.prod.int.phx2.redhat.com

#1 lore raw

PATCH 1/1 GFS2: Eliminate 64-bit divides

Hi,

This patch removes the 64-bit divides introduced in the previous patch in favor of shifting, so that it will compile properly on 32-bit machines.

Regards,

Bob Peterson
Red Hat File Systems

---
commit 050bf58948473a5c83e22f3db046f52a9ffa4cce

Author: Bob Peterson <[email protected]>
Date:   Fri Jul 20 12:59:43 2012 -0500

GFS2: Eliminate 64-bit divides

This patch removes the 64-bit divides in favor of shifting, so that it will compile properly on 32-bit machines.

---
 fs/gfs2/file.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/gfs2/file.c +3 -3
index 9f94832..9aa6af1 100644
@@ -384,7 +384,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 		return ret;
 
 	atomic_set(&ip->i_res->rs_sizehint,
-		   PAGE_CACHE_SIZE / sdp->sd_sb.sb_bsize);
+		   PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift);
 
 	gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
 	ret = gfs2_glock_nq(&gh);
@@ -669,7 +669,7 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
 	if (ret)
 		return ret;
 
-	atomic_set(&ip->i_res->rs_sizehint, writesize / sdp->sd_sb.sb_bsize);
+	atomic_set(&ip->i_res->rs_sizehint, writesize >> sdp->sd_sb.sb_bsize_shift);
 	if (file->f_flags & O_APPEND) {
 		struct gfs2_holder gh;
 
@@ -795,7 +795,7 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
 	if (unlikely(error))
 		goto out_uninit;
 
-	atomic_set(&ip->i_res->rs_sizehint, len / sdp->sd_sb.sb_bsize);
+	atomic_set(&ip->i_res->rs_sizehint, len >> sdp->sd_sb.sb_bsize_shift);
 
 	while (len > 0) {
 		if (len < bytes)
#2 lore raw

PATCH 1/1 GFS2: Eliminate 64-bit divides

Hi,

Thanks - now in the -nmw tree,

Steve.

Quoted 56 lines · Bob Peterson

Hi,

This patch removes the 64-bit divides introduced in the previous patch in favor of shifting, so that it will compile properly on 32-bit machines.

Regards,

Bob Peterson
Red Hat File Systems

---
commit 050bf58948473a5c83e22f3db046f52a9ffa4cce

Author: Bob Peterson <[email protected]>
Date:   Fri Jul 20 12:59:43 2012 -0500

GFS2: Eliminate 64-bit divides

This patch removes the 64-bit divides in favor of shifting, so that it will compile properly on 32-bit machines.

---
 fs/gfs2/file.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/gfs2/file.c +3 -3
index 9f94832..9aa6af1 100644
@@ -384,7 +384,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 		return ret;
 
 	atomic_set(&ip->i_res->rs_sizehint,
-		   PAGE_CACHE_SIZE / sdp->sd_sb.sb_bsize);
+		   PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift);
 
 	gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
 	ret = gfs2_glock_nq(&gh);
@@ -669,7 +669,7 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
 	if (ret)
 		return ret;
 
-	atomic_set(&ip->i_res->rs_sizehint, writesize / sdp->sd_sb.sb_bsize);
+	atomic_set(&ip->i_res->rs_sizehint, writesize >> sdp->sd_sb.sb_bsize_shift);
 	if (file->f_flags & O_APPEND) {
 		struct gfs2_holder gh;
 
@@ -795,7 +795,7 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
 	if (unlikely(error))
 		goto out_uninit;
 
-	atomic_set(&ip->i_res->rs_sizehint, len / sdp->sd_sb.sb_bsize);
+	atomic_set(&ip->i_res->rs_sizehint, len >> sdp->sd_sb.sb_bsize_shift);
 
 	while (len > 0) {
 		if (len < bytes)