staging: lusture: ptlrpc: Prefer using macro DIV_ROUND_UP
PATCH 1/1 staging: lusture: ptlrpc: Prefer using 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)
)
Signed-off-by Bhaktipriya Shridhar <[email protected]>
--- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +1 -1
@@ -160,7 +160,7 @@ static int ptlrpc_register_bulk(struct ptlrpc_request *req)"registered: %d rq_xid: %llu bd_last_xid: %llu\n" , desc->bd_registered, xid, desc->bd_last_xid); - total_md = (desc->bd_iov_count +LNET_MAX_IOV -1 ) /LNET_MAX_IOV ; + total_md =DIV_ROUND_UP (desc->bd_iov_count,LNET_MAX_IOV ); desc->bd_registered =1 ; desc->bd_last_xid = xid; desc->bd_md_count = total_md;
--
2.1.4