From 00d4408329e4699b4a7faf1bdd834a46a2ee963a Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Wed, 26 Feb 2025 00:37:57 -0500 Subject: [PATCH] LU-18753 obdclass: remove obsolete dt functions Remove: dt_path_parser() dt_store_resolve() dt_store_open() dt_reg_open() dt_find_entry() typedef dt_entry_func_t These are not called anywhere. Fixes: 29e98f581ab6 ("LU-2886 obdclass: remove obsoleted md_local_file.c") Fixes: 29adfde10ff2 ("LU-2886 mdd: create local files using local_storage lib") Fixes: 90d8e7fd2874 ("Land b_head_interop_disk on HEAD (20081119_1314)") Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: I5a79f665104c0526db1e328c0e682ce85b592028 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58227 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Aurelien Degremont Reviewed-by: Max Wang Reviewed-by: James Simmons Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/include/dt_object.h | 22 -------- lustre/obdclass/dt_object.c | 127 -------------------------------------------- 2 files changed, 149 deletions(-) diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 7414c0a..13262ef 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -2069,28 +2069,6 @@ int dt_txn_hook_stop(const struct lu_env *env, struct thandle *txn); int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj, bool check); -/* - * Callback function used for parsing path. - * see llo_store_resolve - */ -typedef int (*dt_entry_func_t)(const struct lu_env *env, - const char *name, - void *pvt); - -int dt_path_parser(const struct lu_env *env, - char *local, dt_entry_func_t entry_func, - void *data); - -struct dt_object * -dt_store_resolve(const struct lu_env *env, struct dt_device *dt, - const char *path, struct lu_fid *fid); - -struct dt_object *dt_store_open(const struct lu_env *env, - struct dt_device *dt, - const char *dirname, - const char *filename, - struct lu_fid *fid); - struct dt_object *dt_find_or_create(const struct lu_env *env, struct dt_device *dt, const struct lu_fid *fid, diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index ae79fc4..c243456 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -257,133 +257,6 @@ struct dt_object *dt_locate_at(const struct lu_env *env, } EXPORT_SYMBOL(dt_locate_at); -/** - * find an object named \a entry in given \a dfh->dfh_o directory. - */ -static int dt_find_entry(const struct lu_env *env, const char *entry, - void *data) -{ - struct dt_find_hint *dfh = data; - struct dt_device *dt = dfh->dfh_dt; - struct lu_fid *fid = dfh->dfh_fid; - struct dt_object *obj = dfh->dfh_o; - int rc; - - rc = dt_lookup_dir(env, obj, entry, fid); - dt_object_put(env, obj); - if (rc == 0) { - obj = dt_locate(env, dt, fid); - if (IS_ERR(obj)) - rc = PTR_ERR(obj); - } - dfh->dfh_o = obj; - - return rc; -} - -/** - * Abstract function which parses path name. This function feeds - * path component to \a entry_func. - */ -int dt_path_parser(const struct lu_env *env, - char *path, dt_entry_func_t entry_func, - void *data) -{ - char *e; - int rc = 0; - - while (1) { - e = strsep(&path, "/"); - if (e == NULL) - break; - - if (e[0] == 0) { - if (!path || path[0] == '\0') - break; - continue; - } - rc = entry_func(env, e, data); - if (rc) - break; - } - - return rc; -} - -struct dt_object * -dt_store_resolve(const struct lu_env *env, struct dt_device *dt, - const char *path, struct lu_fid *fid) -{ - struct dt_thread_info *info = dt_info(env); - struct dt_find_hint *dfh = &info->dti_dfh; - struct dt_object *obj; - int result; - - - dfh->dfh_dt = dt; - dfh->dfh_fid = fid; - - strscpy(info->dti_buf, path, sizeof(info->dti_buf)); - - result = dt->dd_ops->dt_root_get(env, dt, fid); - if (result == 0) { - obj = dt_locate(env, dt, fid); - if (!IS_ERR(obj)) { - dfh->dfh_o = obj; - result = dt_path_parser(env, info->dti_buf, - dt_find_entry, dfh); - if (result != 0) - obj = ERR_PTR(result); - else - obj = dfh->dfh_o; - } - } else { - obj = ERR_PTR(result); - } - return obj; -} - -static struct dt_object *dt_reg_open(const struct lu_env *env, - struct dt_device *dt, - struct dt_object *p, - const char *name, - struct lu_fid *fid) -{ - struct dt_object *o; - int result; - - result = dt_lookup_dir(env, p, name, fid); - if (result == 0) - o = dt_locate(env, dt, fid); - else - o = ERR_PTR(result); - - return o; -} - -/** - * Open dt object named \a filename from \a dirname directory. - * \param dt dt device - * \param fid on success, object fid is stored in *fid - */ -struct dt_object *dt_store_open(const struct lu_env *env, struct dt_device *dt, - const char *dirname, const char *filename, - struct lu_fid *fid) -{ - struct dt_object *file; - struct dt_object *dir; - - dir = dt_store_resolve(env, dt, dirname, fid); - if (!IS_ERR(dir)) { - file = dt_reg_open(env, dt, dir, filename, fid); - dt_object_put(env, dir); - } else { - file = dir; - } - - return file; -} - struct dt_object *dt_find_or_create(const struct lu_env *env, struct dt_device *dt, const struct lu_fid *fid, -- 1.8.3.1