diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/compress.c | 20 | ||||
-rw-r--r-- | fs/bcachefs/fs-io.c | 17 |
2 files changed, 14 insertions, 23 deletions
diff --git a/fs/bcachefs/compress.c b/fs/bcachefs/compress.c index 7d9ebcc9a445..482fcff93b62 100644 --- a/fs/bcachefs/compress.c +++ b/fs/bcachefs/compress.c @@ -197,11 +197,11 @@ static int __bio_uncompress(struct bch_fs *c, struct bio *src, goto err; workspace = mempool_alloc(&c->decompress_workspace, GFP_NOIO); - ctx = zstd_init_dctx(workspace, zstd_dctx_workspace_bound()); + ctx = ZSTD_initDCtx(workspace, ZSTD_DCtxWorkspaceBound()); src_len = le32_to_cpup(src_data.b); - ret = zstd_decompress_dctx(ctx, + ret = ZSTD_decompressDCtx(ctx, dst_data, dst_len, src_data.b + 4, real_src_len); @@ -335,8 +335,8 @@ static int attempt_compress(struct bch_fs *c, return strm.total_out; } case BCH_COMPRESSION_TYPE_zstd: { - ZSTD_CCtx *ctx = zstd_init_cctx(workspace, - zstd_cctx_workspace_bound(&c->zstd_params.cParams)); + ZSTD_CCtx *ctx = ZSTD_initCCtx(workspace, + ZSTD_CCtxWorkspaceBound(c->zstd_params.cParams)); /* * ZSTD requires that when we decompress we pass in the exact @@ -349,11 +349,11 @@ static int attempt_compress(struct bch_fs *c, * factor (7 bytes) from the dst buffer size to account for * that. */ - size_t len = zstd_compress_cctx(ctx, + size_t len = ZSTD_compressCCtx(ctx, dst + 4, dst_len - 4 - 7, src, src_len, - &c->zstd_params); - if (zstd_is_error(len)) + c->zstd_params); + if (ZSTD_isError(len)) return 0; *((__le32 *) dst) = cpu_to_le32(len); @@ -548,7 +548,7 @@ static int __bch2_fs_compress_init(struct bch_fs *c, u64 features) { size_t decompress_workspace_size = 0; bool decompress_workspace_needed; - ZSTD_parameters params = zstd_get_params(0, c->opts.encoded_extent_max); + ZSTD_parameters params = ZSTD_getParams(0, c->opts.encoded_extent_max, 0); struct { unsigned feature; unsigned type; @@ -560,8 +560,8 @@ static int __bch2_fs_compress_init(struct bch_fs *c, u64 features) zlib_deflate_workspacesize(MAX_WBITS, DEF_MEM_LEVEL), zlib_inflate_workspacesize(), }, { BCH_FEATURE_zstd, BCH_COMPRESSION_TYPE_zstd, - zstd_cctx_workspace_bound(¶ms.cParams), - zstd_dctx_workspace_bound() }, + ZSTD_CCtxWorkspaceBound(params.cParams), + ZSTD_DCtxWorkspaceBound() }, }, *i; int ret = 0; diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index 051372b88347..4004fa5c1cc9 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -35,15 +35,6 @@ #include <trace/events/bcachefs.h> #include <trace/events/writeback.h> -static inline bool bio_full(struct bio *bio, unsigned len) -{ - if (bio->bi_vcnt >= bio->bi_max_vecs) - return true; - if (bio->bi_iter.bi_size > UINT_MAX - len) - return true; - return false; -} - static inline struct address_space *faults_disabled_mapping(void) { return (void *) (((unsigned long) current->faults_disabled_mapping) & ~1UL); @@ -1817,11 +1808,11 @@ again: * to check that the address is actually valid, when atomic * usercopies are used, below. */ - if (unlikely(fault_in_iov_iter_readable(iter, bytes))) { + if (unlikely(iov_iter_fault_in_readable(iter, bytes))) { bytes = min_t(unsigned long, iov_iter_count(iter), PAGE_SIZE - offset); - if (unlikely(fault_in_iov_iter_readable(iter, bytes))) { + if (unlikely(iov_iter_fault_in_readable(iter, bytes))) { ret = -EFAULT; break; } @@ -1879,7 +1870,7 @@ static void bch2_dio_read_complete(struct closure *cl) { struct dio_read *dio = container_of(cl, struct dio_read, cl); - dio->req->ki_complete(dio->req, dio->ret); + dio->req->ki_complete(dio->req, dio->ret, 0); bio_check_or_release(&dio->rbio.bio, dio->should_dirty); } @@ -2253,7 +2244,7 @@ err: inode_dio_end(&inode->v); if (!sync) { - req->ki_complete(req, ret); + req->ki_complete(req, ret, 0); ret = -EIOCBQUEUED; } return ret; |