[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.58.0802141615240.1185@pc-041.diku.dk>
Date: Thu, 14 Feb 2008 16:15:45 +0100 (MET)
From: Julia Lawall <julia@...u.dk>
To: jack@...e.cz, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH 4/6] fs/udf: Use DIV_ROUND_UP
From: Julia Lawall <julia@...u.dk>
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.
An extract of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@haskernel@
@@
#include <linux/kernel.h>
@depends on haskernel@
expression n,d;
@@
(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)
@depends on haskernel@
expression n,d;
@@
- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)
@depends on haskernel@
expression n,d;
@@
- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>
Signed-off-by: Julia Lawall <julia@...u.dk>
---
diff -u -p a/fs/udf/super.c b/fs/udf/super.c
--- a/fs/udf/super.c 2008-02-10 17:13:55.000000000 +0100
+++ b/fs/udf/super.c 2008-02-14 07:32:31.000000000 +0100
@@ -1025,10 +1025,9 @@ static void udf_load_fileset(struct supe
int udf_compute_nr_groups(struct super_block *sb, u32 partition)
{
struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
- return (map->s_partition_len +
- (sizeof(struct spaceBitmapDesc) << 3) +
- (sb->s_blocksize * 8) - 1) /
- (sb->s_blocksize * 8);
+ return DIV_ROUND_UP(map->s_partition_len +
+ (sizeof(struct spaceBitmapDesc) << 3),
+ sb->s_blocksize * 8);
}
static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists