Whamcloud - gitweb
LU-18155 ptlrpc: use LASSERT/F instead of if () LBUG() 14/56114/5
authorTimothy Day <timday@amazon.com>
Thu, 22 Aug 2024 01:16:28 +0000 (21:16 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 2 Dec 2024 05:47:24 +0000 (05:47 +0000)
commitfa7cb6496dcfec5144e7893720c20fb3261e2f2d
treecd7dffc1616f12993064f4b790e87ef088bb3813
parentf714875b1be6c05c5cadd5bff046e9b78e940ab7
LU-18155 ptlrpc: use LASSERT/F instead of if () LBUG()

We should use a proper LASSERT statement rather than
more verbose if/LBUG blocks.

The patch has been generated with the coccinelle script below.
I manually inverted the logic in the asserts.

@@
expression L;
expression list F;
@@

- if (L) {
(
- CDEBUG(F);
|
- CWARN(F);
|
- CERROR(F);
|
- CEMERG(F);
|
- CNETERR(F);
|
- LCONSOLE(F);
|
- LCONSOLE_INFO(F);
|
- LCONSOLE_WARN(F);
|
- LCONSOLE_ERROR(F);
|
- LCONSOLE_EMERG(F);
)
- LBUG();
- }
+ LASSERTF(L, F);

@@
expression L;
@@

-if (L) LBUG();
+LASSERT(L);

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: If3b2d519239ec2c86bc940135346b37ebe1d050e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56114
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ldlm/ldlm_inodebits.c
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_request.c
lustre/ptlrpc/gss/gss_cli_upcall.c
lustre/ptlrpc/layout.c
lustre/ptlrpc/pack_generic.c