Re: [PATCH v2] btrfs: use %pe for error code output
Johannes Thumshirn <[email protected]> Wed, 22 Jul 2026 13:48:35 +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 Awesome, I didn't know we have a "strerror()" in the kernel now :). > 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. Or not blindly print return values that aren't errors. Reviewed-by: Johannes Thumshirn <[email protected]>