From 5071655ae68402da9b079ea1fed27072611cf4d2 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Wed, 16 Aug 2023 12:41:54 -0400 Subject: [PATCH] EX-6269 osc: Add BRW_COMPRESSED flag to reads We need to add the BRW_COMPRESSED flag to reads so servers can know if the client is able to decompress data. This lets servers decide if a client can be sent compressed data and the result won't be nonsense/corruption. This is important for future support of GPU direct, where the server will need to do the decompression. Signed-off-by: Patrick Farrell Change-Id: I36b5b73f983ce8f2e5297c3e9dc778a5eca54e6a Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51960 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/osc/osc_request.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index d753165..0a06ece 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1528,8 +1528,7 @@ osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa, bool directio = false; bool enable_checksum = true; struct cl_page *clpage; - /* TDB: Get from settings */ - int compressed = 1; + bool compressed = false; ENTRY; if (pga[0]->pg) { @@ -1537,6 +1536,8 @@ osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa, inode = clpage->cp_inode; if (clpage->cp_type == CPT_TRANSIENT) directio = true; + + compressed = clpage->cp_comp_type != LL_COMPR_TYPE_NONE; } if (OBD_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ)) RETURN(-ENOMEM); /* Recoverable */ @@ -1587,6 +1588,13 @@ osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa, } *pcount = page_count; *orig_pga = pga; + } else if (opc == OST_READ && compressed) { + for (i = 0; i < page_count; i++) { + struct brw_page *brwpg = pga[i]; + struct osc_async_page *oap = brw_page2oap(brwpg); + + oap->oap_brw_flags |= OBD_BRW_COMPRESSED; + } } skip_compression: -- 1.8.3.1