From f1b39460a4712aa670567c8204b943f4423e6126 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Tue, 2 Jul 2024 23:14:00 +0000 Subject: [PATCH] LU-17848 osd-zfs: remove osd_ladvise()/falloc() 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 Change-Id: I6fad0a9ca8b07e3d09701e71773dc896a3845b9e Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55608 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/include/dt_object.h | 19 ++++++++++++++----- lustre/osd-zfs/osd_io.c | 45 --------------------------------------------- 2 files changed, 14 insertions(+), 50 deletions(-) diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 33891e1..b100b0a 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -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); } diff --git a/lustre/osd-zfs/osd_io.c b/lustre/osd-zfs/osd_io.c index 560d333..d35b868 100644 --- a/lustre/osd-zfs/osd_io.c +++ b/lustre/osd-zfs/osd_io.c @@ -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, }; -- 1.8.3.1