On 14/10/2019 14:22, David Sterba wrote:
> +static int compression_decompress_bio(int type, struct list_head *ws,
> + struct compressed_bio *cb)
> +{
> + switch (type) {
> + case BTRFS_COMPRESS_ZLIB: return zlib_decompress_bio(ws, cb);
> + case BTRFS_COMPRESS_LZO: return lzo_decompress_bio(ws, cb);
> + case BTRFS_COMPRESS_ZSTD: return zstd_decompress_bio(ws, cb);
> + case BTRFS_COMPRESS_NONE:
> + default:
> + /*
> + * This can't happen, the type is validated several times
> + * before we get here.
> + */
> + BUG();
> + }
> +}
> +
> +static int compression_decompress(int type, struct list_head *ws,
> + unsigned char *data_in, struct page *dest_page,
> + unsigned long start_byte, size_t srclen, size_t destlen)
> +{
> + switch (type) {
> + case BTRFS_COMPRESS_ZLIB: return zlib_decompress(ws, data_in, dest_page,
> + start_byte, srclen, destlen);
> + case BTRFS_COMPRESS_LZO: return lzo_decompress(ws, data_in, dest_page,
> + start_byte, srclen, destlen);
> + case BTRFS_COMPRESS_ZSTD: return zstd_decompress(ws, data_in, dest_page,
> + start_byte, srclen, destlen);
> + case BTRFS_COMPRESS_NONE:
> + default:
> + /*
> + * This can't happen, the type is validated several times
> + * before we get here.
> + */
> + BUG();
> + }
> +}
Hmm should we really BUG() here? Maybe throw in an ASSERT(), so we can
catch it in debug builds but not halt the machine (even if it
theoretically can't happen).
--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@xxxxxxx +49 911 74053 689
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850