From 290813c05d363fdb2e2c72dae8d9a4304d3c80df Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Wed, 26 Jul 2023 13:04:20 -0400 Subject: [PATCH] EX-7601 llite: rename compr information in io The compression related information in the cl_io is named poorly. It's not that the IO is compressed, it's that the IO is to a compressed file. The compr_chunk_log_bits is the maximum from the entire file, not the maximum hit by this IO. (This is used by readahead, so the maximum in the whole file is what's desired.) Signed-off-by: Patrick Farrell Change-Id: I46981a98628f127e7b147280caaf7544fa288786 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51771 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger --- lustre/include/cl_object.h | 7 ++++--- lustre/llite/llite_mmap.c | 2 +- lustre/llite/rw.c | 8 ++++---- lustre/llite/rw26.c | 2 +- lustre/llite/vvp_io.c | 4 ++-- lustre/lov/lov_io.c | 2 +- lustre/lov/lov_object.c | 10 +++++----- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index d5a13da..2b32eb6 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -2027,11 +2027,12 @@ struct cl_io { /** * set if IO is on a compressed file */ - ci_compressed_io:1, + ci_compressed_file:1, /** - * Compression chunk size + * Maximum compression chunk size for this file - used by readahead to + * do rounding */ - ci_compr_chunk_bits:7, + ci_max_compr_chunk_bits:7, /** * Bypass quota check */ diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 449d8d5..78657ed 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -649,7 +649,7 @@ int ll_mmap_check_compression(struct file *file, loff_t off) rc = cl_io_init(env, io, CIT_MISC, lli->lli_clob); if (rc == 0) { - if (io->ci_compressed_io) + if (io->ci_compressed_file) rc = -EOPNOTSUPP; } else if (rc == 1 || rc == -ENODATA) { rc = 0; diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 826ade8..7e37afa 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -761,9 +761,9 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, RETURN(0); } - if (io->ci_compressed_io) + if (io->ci_compressed_file) chunk_pages_mask = - (COMPR_MIN_PAGES << io->ci_compr_chunk_bits) - 1; + (COMPR_MIN_PAGES << io->ci_max_compr_chunk_bits) - 1; spin_lock(&ras->ras_lock); @@ -780,7 +780,7 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, else *start_idx = ras->ras_next_readahead_idx; - if (io->ci_compressed_io) { + if (io->ci_compressed_file) { CDEBUG(D_SEC, "start_idx %lu\n", *start_idx); *start_idx &= ~chunk_pages_mask; CDEBUG(D_SEC, "start_idx %lu\n", *start_idx); @@ -808,7 +808,7 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, } } - if (io->ci_compressed_io) { + if (io->ci_compressed_file) { pgoff_t old_end_idx = end_idx; CDEBUG(D_SEC, "end_idx %lu\n", end_idx); diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 365c221..29e5ee6 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -515,7 +515,7 @@ ll_direct_IO_impl(struct kiocb *iocb, struct iov_iter *iter, int rw) /* compression is not supported with direct I/O yet, so we fall back to * buffered I/O by returning 0 to the kernel */ - if (io->ci_compressed_io) + if (io->ci_compressed_file) RETURN(0); ll_dio_aio = io->ci_dio_aio; diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index 8099940..6cdfdaa 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -1303,13 +1303,13 @@ static int vvp_io_write_start(const struct lu_env *env, if (pos >= inode_size) write_beyond_eof = true; - chunk_size = (1 << (io->ci_compr_chunk_bits + 16)); + chunk_size = (1 << (io->ci_max_compr_chunk_bits + 16)); /* compressed files require chunk-aligned writes for overwrites * writes at EOF are OK because they do not update existing data * EX-7601 */ - if (io->ci_compressed_io && !write_beyond_eof && + if (io->ci_compressed_file && !write_beyond_eof && (pos % chunk_size || cnt % chunk_size)) { CERROR("Compression preview requires writes to be chunk size aligned or at EOF, write pos: %llu, bytes: %lu, chunk_size: %d\n", pos, cnt, chunk_size); diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 206e8d1..63cc60c 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -590,7 +590,7 @@ static int lov_io_slice_init(struct lov_io *lio, } case CIT_LSEEK: { - if (io->ci_compressed_io) + if (io->ci_compressed_file) GOTO(out, result = -EOPNOTSUPP); lio->lis_pos = io->u.ci_lseek.ls_start; lio->lis_endpos = OBD_OBJECT_EOF; diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index 24daba6..7088d6a 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -1574,7 +1574,7 @@ static int lov_io_init(const struct lu_env *env, struct cl_object *obj, lov_foreach_layout_entry(lov, lle) { if (lle->lle_lsme->lsme_pattern & LOV_PATTERN_COMPRESS) { - io->ci_compressed_io = true; + io->ci_compressed_file = true; /* a single IO may hit different components with * different compression chunk sizes; since this is * used for chunk-alignment, we can take the largest @@ -1583,8 +1583,8 @@ static int lov_io_init(const struct lu_env *env, struct cl_object *obj, * smaller sizes */ if (lle->lle_lsme->lsme_compr_chunk_log_bits > - io->ci_compr_chunk_bits) { - io->ci_compr_chunk_bits = + io->ci_max_compr_chunk_bits) { + io->ci_max_compr_chunk_bits = lle->lle_lsme->lsme_compr_chunk_log_bits; } break; @@ -1595,8 +1595,8 @@ static int lov_io_init(const struct lu_env *env, struct cl_object *obj, DFID "io %p type %d ignore/verify layout %d/%d, compressed %x, chunk_size %d\n", PFID(lu_object_fid(&obj->co_lu)), io, io->ci_type, io->ci_ignore_layout, io->ci_verify_layout, - io->ci_compressed_io, - io->ci_compressed_io ? (1 << (io->ci_compr_chunk_bits + 16)) : 0); + io->ci_compressed_file, + io->ci_compressed_file ? (1 << (io->ci_max_compr_chunk_bits + 16)) : 0); /* IO type CIT_MISC with ci_ignore_layout set are usually invoked from * the OSC layer. It shouldn't take lov layout conf lock in that case, -- 1.8.3.1