From: Timothy Day Date: Tue, 2 Jul 2024 23:14:00 +0000 (+0000) Subject: LU-17848 osd-zfs: remove osd_ladvise()/falloc() X-Git-Tag: 2.15.65~91 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F55608%2F3;p=fs%2Flustre-release.git 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 --- 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, };