ZIL: allow zil_commit() to fail with error

This changes zil_commit() to have an int return, and updates all callers
to check it. There are no corresponding internal changes yet; it will
always return 0.

Since zil_commit() is an indication that the caller _really_ wants the
associated data to be durability stored, I've annotated it with the
__warn_unused_result__ compiler attribute (via __must_check), to emit a
warning if it's ever ussd without doing something with the return code.
I hope this will mean we never misuse it in the future.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #17398
This commit is contained in:
Rob Norris
2025-02-24 15:14:23 +11:00
committed by Brian Behlendorf
parent 1f8c39ddb2
commit 967b15b888
16 changed files with 147 additions and 85 deletions
+4
View File
@@ -69,6 +69,10 @@
#define __maybe_unused __attribute__((unused))
#endif
#ifndef __must_check
#define __must_check __attribute__((__warn_unused_result__))
#endif
/*
* Without this, we see warnings from objtool during normal Linux builds when
* the kernel is built with CONFIG_STACK_VALIDATION=y: