Whamcloud - gitweb
EX-8927 csdc: check ocd flag for fiemap/lseek
authorBobi Jam <bobijam@whamcloud.com>
Tue, 6 Feb 2024 09:13:27 +0000 (17:13 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 14 Feb 2024 19:19:46 +0000 (19:19 +0000)
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 <bobijam@whamcloud.com>
Change-Id: I478cbf161044165fa31d4caa2336e9949fc626fe
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53935
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/lov/lov_io.c
lustre/lov/lov_object.c
lustre/osc/osc_io.c
lustre/osc/osc_object.c

index 2a0d91f..605ed4b 100644 (file)
@@ -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;
index 9188b40..678ce50 100644 (file)
@@ -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,
index 4a82ff3..d03e3d4 100644 (file)
@@ -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;
index ce48328..f9147df 100644 (file)
@@ -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;