From d1f2e535b44ef6ac2c962abd9c414496aa9de917 Mon Sep 17 00:00:00 2001 From: Artem Blagodarenko Date: Mon, 4 Mar 2024 13:01:09 +0000 Subject: [PATCH] EX-7729 osc: Do not iterate over chunk pages If osc_decompress() knows chunk size, no need to iterate other all pages in chunk. Thay can be skipped. Signed-off-by: Artem Blagodarenko Change-Id: Ib84b060075c55c97eba9f74ef017c0a956e85b12 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54270 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Vitaliy Kuznetsov Reviewed-by: Andreas Dilger --- lustre/osc/osc_compress.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lustre/osc/osc_compress.c b/lustre/osc/osc_compress.c index ece3899..c39c997 100644 --- a/lustre/osc/osc_compress.c +++ b/lustre/osc/osc_compress.c @@ -358,7 +358,7 @@ int decompress_request(struct osc_brw_async_args *aa, int page_count) buf_bits = chunk_bits + 1; pages_per_chunk = chunk_size / PAGE_SIZE; - for (i = 0; i < page_count; i++) { + while (i < page_count) { int decompressed_pages; int compressed_pages; int compressed_bytes; @@ -370,8 +370,10 @@ int decompress_request(struct osc_brw_async_args *aa, int page_count) /* not aligned to chunk size, so can't be the start of a * compressed chunk - continue */ - if (oap->oap_obj_off & (chunk_size - 1)) + if (oap->oap_obj_off & (chunk_size - 1)) { + i++; continue; + } LASSERT(ergo(next_chunk_min, i >= next_chunk_min)); @@ -382,6 +384,7 @@ int decompress_request(struct osc_brw_async_args *aa, int page_count) rc); GOTO(out, rc); } + i++; continue; } @@ -494,6 +497,7 @@ int decompress_request(struct osc_brw_async_args *aa, int page_count) /* start of the next chunk is at least compressed pages away*/ next_chunk_min = i + compressed_pages - 1; + i += decompressed_pages; CDEBUG(D_SEC, "next chunk min %d\n", next_chunk_min); count++; } -- 1.8.3.1