Skip to contentSkip to conversation

staging: lustre: ptlrpc: sec_bulk: Use macro DIV_ROUND_UP

PATCH New Bhaktipriya Shridhar 1 participant 1 message Mar 8, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 staging: lustre: ptlrpc: sec_bulk: Use macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

---
Changes in v3:
-Changed subject to prevent conflict with other patches

 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1 -1
index 72d5b9b..0d58d8e 100644
@@ -274,7 +274,7 @@ static unsigned long enc_pools_shrink_scan(struct shrinker *s,
 static inline
 int npages_to_npools(unsigned long npages)
 {
-	return (int) ((npages + PAGES_PER_POOL - 1) / PAGES_PER_POOL);
+	return (int) (DIV_ROUND_UP(npages, PAGES_PER_POOL));
 }
 
 /*

--
2.1.4