Re: [PATCH 2/2] btrfs: clean up transaction abort messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> * print the exact negative errno from btrfs_decode_error and
>   don't expect a simple snprintf to fail

What an.. odd function.  Looks like it was inherited from ext*.  And the
callers over in that neck of the woods also don't check for the
implemented-but-basically-impossible snprintf failure that leads to
returning null.

> +		snprintf(nbuf, 16, "error %d", errno);

The buffer is only used to print the error number for unknown errors?

If changing this function anyway, maybe you can find a few minutes to:

 - drop the nbuf arugment
 - just return static strings for known errnos
 - return "unknown" for unknown errors
 - and have the callers always print the string and error
   ": %s (errno %d)"

No worries if you're not keen to fix it up, but it'd be nice.  One less
wart to be distracted by when stumbling through the code.

- z
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux