From 7693dd6c44943a8bf45e3932facc5ab6684fe845 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Mon, 13 Nov 2023 11:18:49 -0500 Subject: [PATCH] EX-7601 osc: only set compressed flag on compressed pages The code accidentally sets the compressed flag on all pages processed through fill_cpga, even if they're not compressed. Oops. Also stop setting pg->index on the pages in the compressed pga, this is only used by encryption and that's no longer supported with compression. Signed-off-by: Patrick Farrell Change-Id: I313fd943a18b71cd52493852a6884f30d187e52f Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53118 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko --- lustre/osc/osc_compress.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lustre/osc/osc_compress.c b/lustre/osc/osc_compress.c index 6fd717e..91b245e 100644 --- a/lustre/osc/osc_compress.c +++ b/lustre/osc/osc_compress.c @@ -91,20 +91,18 @@ int fill_cpga(struct brw_page **cpga, struct brw_page **pga, * part of the incomplete pages. This is a TODO for another * patch. */ - if (dst) { + if (dst) /* compressed page */ { pg->count = PAGE_SIZE; pg->pg = mem_to_page(dst + chunk_offset); + /* we get flags from the first page in the chunk and + * add COMPRESSED + */ + pg->flag = pga[src_from]->flag | OBD_BRW_COMPRESSED; } else { pg->count = pga[src_page]->count; pg->pg = pga[src_page]->pg; + pg->flag = pga[src_page]->flag; } - /* - * Compressed pages, flags are lost - * Let's choose first page in chunk - * flag to set to all pages - */ - pg->flag = pga[src_from]->flag | OBD_BRW_COMPRESSED; - pg->pg->index = pga[src_page]->pg->index; CDEBUG(D_SEC, "off 0x%llx, flag %x, pg %p, count %u\n", pg->off, pg->flag, pg->pg, pg->count); -- 1.8.3.1