Skip to contentSkip to conversation

nilfs2-use-div64_ul-instead-of-do_div.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Mar 12, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: nilfs2: use div64_ul() instead of do_div()
has been removed from the -mm tree. Its filename was

     nilfs2-use-div64_ul-instead-of-do_div.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Thorsten Blum <[email protected]>
Subject: nilfs2: use div64_ul() instead of do_div()
Date: Wed, 6 Mar 2024 23:25:47 +0900

Fixes Coccinelle/coccicheck warnings reported by do_div.cocci.

Compared to do_div(), div64_ul() does not implicitly cast the divisor and does not unnecessarily calculate the remainder.

---

 fs/nilfs2/cpfile.c    |    2 +-
 fs/nilfs2/dat.c       |    2 +-
 fs/nilfs2/ioctl.c     |    4 ++--
 fs/nilfs2/sufile.c    |    2 +-
 fs/nilfs2/super.c     |    2 +-
 fs/nilfs2/the_nilfs.c |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)
fs/nilfs2/cpfile.c renamed from fs/nilfs2/cpfile.c~nilfs2-use-div64_ul-instead-of-do_div +1 -1
@@ -28,7 +28,7 @@ nilfs_cpfile_get_blkoff(const struct ino
 {
 	__u64 tcno = cno + NILFS_MDT(cpfile)->mi_first_entry_offset - 1;
 
-	do_div(tcno, nilfs_cpfile_checkpoints_per_block(cpfile));
+	tcno = div64_ul(tcno, nilfs_cpfile_checkpoints_per_block(cpfile));
 	return (unsigned long)tcno;
 }
 
fs/nilfs2/dat.c renamed from fs/nilfs2/dat.c~nilfs2-use-div64_ul-instead-of-do_div +1 -1
@@ -460,7 +460,7 @@ ssize_t nilfs_dat_get_vinfo(struct inode
 		kaddr = kmap_local_page(entry_bh->b_page);
 		/* last virtual block number in this block */
 		first = vinfo->vi_vblocknr;
-		do_div(first, entries_per_block);
+		first = div64_ul(first, entries_per_block);
 		first *= entries_per_block;
 		last = first + entries_per_block - 1;
 		for (j = i, n = 0;
fs/nilfs2/ioctl.c renamed from fs/nilfs2/ioctl.c~nilfs2-use-div64_ul-instead-of-do_div +2 -2
@@ -1111,7 +1111,7 @@ static int nilfs_ioctl_set_alloc_range(s
 	segbytes = nilfs->ns_blocks_per_segment * nilfs->ns_blocksize;
 
 	minseg = range[0] + segbytes - 1;
-	do_div(minseg, segbytes);
+	minseg = div64_ul(minseg, segbytes);
 
 	if (range[1] < 4096)
 		goto out;
@@ -1120,7 +1120,7 @@ static int nilfs_ioctl_set_alloc_range(s
 	if (maxseg < segbytes)
 		goto out;
 
-	do_div(maxseg, segbytes);
+	maxseg = div64_ul(maxseg, segbytes);
 	maxseg--;
 
 	ret = nilfs_sufile_set_alloc_range(nilfs->ns_sufile, minseg, maxseg);
fs/nilfs2/sufile.c renamed from fs/nilfs2/sufile.c~nilfs2-use-div64_ul-instead-of-do_div +1 -1
@@ -48,7 +48,7 @@ nilfs_sufile_get_blkoff(const struct ino
 {
 	__u64 t = segnum + NILFS_MDT(sufile)->mi_first_entry_offset;
 
-	do_div(t, nilfs_sufile_segment_usages_per_block(sufile));
+	t = div64_ul(t, nilfs_sufile_segment_usages_per_block(sufile));
 	return (unsigned long)t;
 }
 
fs/nilfs2/super.c renamed from fs/nilfs2/super.c~nilfs2-use-div64_ul-instead-of-do_div +1 -1
@@ -448,7 +448,7 @@ int nilfs_resize_fs(struct super_block *
 
 	sb2off = NILFS_SB2_OFFSET_BYTES(newsize);
 	newnsegs = sb2off >> nilfs->ns_blocksize_bits;
-	do_div(newnsegs, nilfs->ns_blocks_per_segment);
+	newnsegs = div64_ul(newnsegs, nilfs->ns_blocks_per_segment);
 
 	ret = nilfs_sufile_resize(nilfs->ns_sufile, newnsegs);
 	up_write(&nilfs->ns_segctor_sem);
fs/nilfs2/the_nilfs.c renamed from fs/nilfs2/the_nilfs.c~nilfs2-use-div64_ul-instead-of-do_div +1 -1
@@ -413,7 +413,7 @@ static u64 nilfs_max_segment_count(struc
 {
 	u64 max_count = U64_MAX;
 
-	do_div(max_count, nilfs->ns_blocks_per_segment);
+	max_count = div64_ul(max_count, nilfs->ns_blocks_per_segment);
 	return min_t(u64, max_count, ULONG_MAX);
 }
 

_

Patches currently in -mm which might be from [email protected] are