Re: [PATCH v2] btrfs: use %pe for error code output
David Sterba <[email protected]> Wed, 22 Jul 2026 16:04:56 +0200
| Newsgroups | org.kernel.vger.linux-btrfs |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jul 22, 2026 at 05:04:07PM +0930, Qu Wenruo wrote: > During an interrupted mount, I got the following messages: > > workqueue: Failed to create a rescuer kthread for wq "btrfs-qgroup-rescan": -EINTR > BTRFS error (device dm-3): open_ctree failed: -12 > > Workqueue code is outputting a human readable error string, meanwhile > we're still using a numeric error code. > > So follow the workqueue code to use "%pe" format, which will > automatically convert an error pointer to the human readable string. > > However this is a minor pitfall, if the return value is not an error > code, e.g. a positive number, "%pe" with "ERR_PTR(ret)" will output the > pointer as a hash value, e.g.: > > ret=1 %pe out=0000000019414716 > ret=-22 %pe out=-EINVAL > > So we should not use this "%pe" output for callsites that are known to > return positive values. > > Signed-off-by: Qu Wenruo <[email protected]> We have btrfs_decode_error() with selected errors so the %pe is better because it covers more of them. The good thing about our helper is that we can adjust the wording, namely for EUCLEAN. This is "Structure needs cleaning" and is quite confusing. The EFSCORRUPTED error code is only alias of the value, otherwise the string is unchanged.