mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
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:
committed by
Brian Behlendorf
parent
1f8c39ddb2
commit
967b15b888
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
+1
-2
@@ -610,8 +610,7 @@ extern void zil_itx_destroy(itx_t *itx);
|
||||
extern void zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx);
|
||||
|
||||
extern void zil_async_to_sync(zilog_t *zilog, uint64_t oid);
|
||||
extern void zil_commit(zilog_t *zilog, uint64_t oid);
|
||||
extern void zil_commit_impl(zilog_t *zilog, uint64_t oid);
|
||||
extern int __must_check zil_commit(zilog_t *zilog, uint64_t oid);
|
||||
extern void zil_remove_async(zilog_t *zilog, uint64_t oid);
|
||||
|
||||
extern int zil_reset(const char *osname, void *txarg);
|
||||
|
||||
Reference in New Issue
Block a user