Whamcloud - gitweb
LU-17848 osd-zfs: remove osd_ladvise()/falloc() 08/55608/3
authorTimothy Day <timday@amazon.com>
Tue, 2 Jul 2024 23:14:00 +0000 (23:14 +0000)
committerOleg Drokin <green@whamcloud.com>
Sat, 13 Jul 2024 20:55:41 +0000 (20:55 +0000)
These are implemented as stub functions that return EOPNOTSUPP.
Remove the functions and add a check in the corresponding dt
functions instead.

Test-Parameters: trivial
Test-Parameters: trivial fstype=zfs
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I6fad0a9ca8b07e3d09701e71773dc896a3845b9e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55608
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/dt_object.h
lustre/osd-zfs/osd_io.c

index 33891e1..b100b0a 100644 (file)
@@ -2595,7 +2595,10 @@ static inline int dt_ladvise(const struct lu_env *env, struct dt_object *dt,
 {
        LASSERT(dt);
        LASSERT(dt->do_body_ops);
-       LASSERT(dt->do_body_ops->dbo_ladvise);
+
+       if (!dt->do_body_ops->dbo_ladvise)
+               return -EOPNOTSUPP;
+
        return dt->do_body_ops->dbo_ladvise(env, dt, start, end, advice);
 }
 
@@ -2604,10 +2607,13 @@ static inline int dt_declare_fallocate(const struct lu_env *env,
                                       __u64 end, int mode, struct thandle *th)
 {
        LASSERT(dt);
+
        if (!dt->do_body_ops)
                return -EOPNOTSUPP;
-       LASSERT(dt->do_body_ops);
-       LASSERT(dt->do_body_ops->dbo_declare_fallocate);
+
+       if (!dt->do_body_ops->dbo_declare_fallocate)
+               return -EOPNOTSUPP;
+
        return dt->do_body_ops->dbo_declare_fallocate(env, dt, start, end,
                                                      mode, th);
 }
@@ -2617,10 +2623,13 @@ static inline int dt_falloc(const struct lu_env *env, struct dt_object *dt,
                              struct thandle *th)
 {
        LASSERT(dt);
+
        if (!dt->do_body_ops)
                return -EOPNOTSUPP;
-       LASSERT(dt->do_body_ops);
-       LASSERT(dt->do_body_ops->dbo_fallocate);
+
+       if (!dt->do_body_ops->dbo_fallocate)
+               return -EOPNOTSUPP;
+
        return dt->do_body_ops->dbo_fallocate(env, dt, start, end, mode, th);
 }
 
index 560d333..d35b868 100644 (file)
@@ -1287,48 +1287,6 @@ static int osd_declare_punch(const struct lu_env *env, struct dt_object *dt,
                                 0, oh, NULL, OSD_QID_BLK));
 }
 
-static int osd_ladvise(const struct lu_env *env, struct dt_object *dt,
-                      __u64 start, __u64 end, enum lu_ladvise_type advice)
-{
-       int rc;
-
-       ENTRY;
-       switch (advice) {
-       default:
-               rc = -ENOTSUPP;
-               break;
-       }
-
-       RETURN(rc);
-}
-
-static int osd_fallocate(const struct lu_env *env, struct dt_object *dt,
-                        __u64 start, __u64 end, int mode, struct thandle *th)
-{
-       int rc = -EOPNOTSUPP;
-
-       ENTRY;
-        /*
-         * space preallocation is not supported for ZFS
-         * Returns -EOPNOTSUPP for now
-         */
-       RETURN(rc);
-}
-
-static int osd_declare_fallocate(const struct lu_env *env,
-                                struct dt_object *dt, __u64 start, __u64 end,
-                                int mode, struct thandle *th)
-{
-       int rc = -EOPNOTSUPP;
-
-       ENTRY;
-        /*
-         * space preallocation is not supported for ZFS
-         * Returns -EOPNOTSUPP for now
-         */
-       RETURN(rc);
-}
-
 static loff_t osd_lseek(const struct lu_env *env, struct dt_object *dt,
                        loff_t offset, int whence)
 {
@@ -1406,9 +1364,6 @@ const struct dt_body_operations osd_body_ops = {
        .dbo_read_prep                  = osd_read_prep,
        .dbo_declare_punch              = osd_declare_punch,
        .dbo_punch                      = osd_punch,
-       .dbo_ladvise                    = osd_ladvise,
-       .dbo_declare_fallocate          = osd_declare_fallocate,
-       .dbo_fallocate                  = osd_fallocate,
        .dbo_lseek                      = osd_lseek,
 };