Skip to contentSkip to conversation

uml: use DIV_ROUND_UP

PATCH In review Jiri Olsa 3 participants 3 messages Feb 19, 2008 – Feb 20, 2008

Subsystems (2)
lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 uml: use DIV_ROUND_UP

Hi,

I just saw similar patches in the janitor kernel's list, and spotted place it fits.

---
 arch/um/drivers/ubd_kern.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/um/drivers/ubd_kern.c +1 -2
index b1a77b1..1e579e4 100644
@@ -1020,8 +1020,7 @@ static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask,
 	 * by one word.  Thanks to Lynn Kerby for the fix and James McMechan
 	 * for the original diagnosis.
 	 */
-	if(*cow_offset = ((bitmap_len + sizeof(unsigned long) - 1) /
-			   sizeof(unsigned long) - 1))
+	if(*cow_offset = (DIV_ROUND_UP(bitmap_len, sizeof(unsigned long)) - 1))
 		(*cow_offset)--;
 
 	bitmap_words[0] = bitmap[*cow_offset];
#1 lore raw

From: Jiri Olsa <[email protected]>
Subject: [PATCH] uml: use DIV_ROUND_UP
Date: Tue, 19 Feb 2008 22:49:33 +0100
Message-ID: <[email protected]>

Quoted 15 lines

Hi,

I just saw similar patches in the janitor kernel's list, and spotted place it fits.

---
 arch/um/drivers/ubd_kern.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/um/drivers/ubd_kern.c +0 -0
index b1a77b1..1e579e4 100644

arch/um/drivers/ubd_kern.c static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask, · line 1023

Quoted 6 lines
arch/um/drivers/ubd_kern.c +1 -2
@@ -1020,8 +1020,7 @@ static void cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask,
 	 * by one word.  Thanks to Lynn Kerby for the fix and James McMechan
 	 * for the original diagnosis.
 	 */
-	if(*cow_offset = ((bitmap_len + sizeof(unsigned long) - 1) /
-			   sizeof(unsigned long) - 1))
+	if(*cow_offset = (DIV_ROUND_UP(bitmap_len, sizeof(unsigned long)) - 1))

Looks good for me. ACK.

#2 lore raw
In reply to Jiri Olsa
Quoted 1 line · WANG Cong

Looks good for me. ACK.

Me too, I'll send it on if Andrew doesn't pick it up on his own.

Jeff

Signature · 1 line
Work email - jdike at linux dot intel dot com