From 96fca2a176ae855661c2636503f9474b9748a672 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Tue, 6 Feb 2024 17:13:27 +0800 Subject: [PATCH] EX-8927 csdc: check ocd flag for fiemap/lseek Currently client will not sending fiemap/lseek request to OST if the file is a compressed one. This patch will check the OBD_CONNECT2_COMPRESS flags and send the request if OST supports compression as server would do the fiemap/lseek check instead. Signed-off-by: Bobi Jam Change-Id: I478cbf161044165fa31d4caa2336e9949fc626fe Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53935 Tested-by: jenkins Tested-by: Andreas Dilger Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger --- lustre/lov/lov_io.c | 5 ++--- lustre/lov/lov_object.c | 7 +++---- lustre/osc/osc_io.c | 8 ++++++++ lustre/osc/osc_object.c | 9 +++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 2a0d91f..605ed4b 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -605,9 +605,6 @@ static int lov_io_slice_init(struct lov_io *lio, } case CIT_LSEEK: { - if (!OBD_FAIL_CHECK(OBD_FAIL_LOV_SKIP_CHECK_COMPR) && - io->ci_compressed_file) - GOTO(out, result = -EOPNOTSUPP); lio->lis_pos = io->u.ci_lseek.ls_start; lio->lis_endpos = OBD_OBJECT_EOF; break; @@ -810,6 +807,8 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio, int index = lov_comp_entry(sub->sub_subio_index); int stripe = lov_comp_stripe(sub->sub_subio_index); + io->ci_compressed_file = parent->ci_compressed_file; + switch (io->ci_type) { case CIT_SETATTR: { io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr; diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index 9188b40..678ce50 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -2076,10 +2076,6 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, } lsme = lsm->lsm_entries[0]; - /* No support for compressed yet. */ - if (!OBD_FAIL_CHECK(OBD_FAIL_LOV_SKIP_CHECK_COMPR) && - lsme->lsme_compr_type != LL_COMPR_TYPE_NONE) - GOTO(out_lsm, rc = -EOPNOTSUPP); if (!(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER)) { /** @@ -2246,6 +2242,9 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, &fs.fs_start_stripe); } + fmkey->lfik_oa.o_layout_compr.ol_compr_type = + lsme->lsme_compr_type; + /* Check each stripe */ for (cur_stripe = fs.fs_start_stripe; stripe_count > 0; --stripe_count, diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index 4a82ff3..d03e3d4 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -1185,6 +1185,14 @@ int osc_io_lseek_start(const struct lu_env *env, RETURN(0); } + if (!OBD_FAIL_CHECK_RESET(OBD_FAIL_LOV_SKIP_CHECK_COMPR, + OBD_FAIL_LOV_SKIP_CHECK_COMPR)) { + /* OST not support for compressed file */ + if (!(exp_connect_flags2(exp) & OBD_CONNECT2_COMPRESS) && + io->ci_compressed_file) + RETURN(-EOPNOTSUPP); + } + memset(oa, 0, sizeof(*oa)); oa->o_oi = loi->loi_oi; oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP; diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index ce48328..f9147df 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -264,6 +264,15 @@ static int osc_object_fiemap(const struct lu_env *env, struct cl_object *obj, int rc; ENTRY; + if (!OBD_FAIL_CHECK_RESET(OBD_FAIL_LOV_SKIP_CHECK_COMPR, + OBD_FAIL_LOV_SKIP_CHECK_COMPR)) { + /* OST not support for compressed file */ + if (!(exp_connect_flags2(exp) & OBD_CONNECT2_COMPRESS) && + (fmkey->lfik_oa.o_layout_compr.ol_compr_type != + LL_COMPR_TYPE_NONE)) + RETURN(-EOPNOTSUPP); + } + fmkey->lfik_oa.o_oi = cl2osc(obj)->oo_oinfo->loi_oi; if (!(fmkey->lfik_fiemap.fm_flags & FIEMAP_FLAG_SYNC)) goto skip_locking; -- 1.8.3.1