Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- staging/lustre: remove lots of dead code
- All these functions are never called in lustre and can be removed.
- Signed-off-by: Arnd Bergmann <[email protected]>
- drivers/staging/lustre/lustre/fid/lproc_fid.c | 1 -
- drivers/staging/lustre/lustre/fld/fld_cache.c | 1 -
- drivers/staging/lustre/lustre/fld/fld_internal.h | 3 -
- drivers/staging/lustre/lustre/fld/fld_request.c | 1 -
- drivers/staging/lustre/lustre/fld/lproc_fld.c | 1 -
- drivers/staging/lustre/lustre/include/cl_object.h | 25 -
- drivers/staging/lustre/lustre/include/dt_object.h | 144 ---
- .../staging/lustre/lustre/include/lprocfs_status.h | 39 +-
- drivers/staging/lustre/lustre/include/lu_object.h | 27 -
- .../lustre/lustre/include/lustre/lustre_idl.h | 8 -
- .../lustre/lustre/include/lustre/lustre_user.h | 2 -
- .../staging/lustre/lustre/include/lustre_capa.h | 9 -
- .../staging/lustre/lustre/include/lustre_debug.h | 1 -
- .../staging/lustre/lustre/include/lustre_disk.h | 2 -
- .../staging/lustre/lustre/include/lustre_eacl.h | 4 -
- .../staging/lustre/lustre/include/lustre_export.h | 7 -
- .../staging/lustre/lustre/include/lustre_handles.h | 1 -
- .../staging/lustre/lustre/include/lustre_import.h | 1 -
- drivers/staging/lustre/lustre/include/lustre_lib.h | 1 -
- drivers/staging/lustre/lustre/include/lustre_log.h | 47 +-
- drivers/staging/lustre/lustre/include/lustre_net.h | 41 -
- .../staging/lustre/lustre/include/lustre_param.h | 6 -
- .../lustre/lustre/include/lustre_req_layout.h | 7 -
- drivers/staging/lustre/lustre/include/lustre_sec.h | 20 -
- drivers/staging/lustre/lustre/include/obd.h | 1 -
- drivers/staging/lustre/lustre/include/obd_class.h | 29 -
- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 5 -
- drivers/staging/lustre/lustre/obdclass/acl.c | 119 ---
- drivers/staging/lustre/lustre/obdclass/capa.c | 323 -------
- drivers/staging/lustre/lustre/obdclass/cl_io.c | 65 --
- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 37 +-
- drivers/staging/lustre/lustre/obdclass/cl_object.c | 41 -
- drivers/staging/lustre/lustre/obdclass/debug.c | 10 -
- drivers/staging/lustre/lustre/obdclass/dt_object.c | 1001 --------------------
- drivers/staging/lustre/lustre/obdclass/genops.c | 239 -----
- .../lustre/lustre/obdclass/linux/linux-obdo.c | 137 ---
- .../lustre/lustre/obdclass/linux/linux-sysctl.c | 4 -
- drivers/staging/lustre/lustre/obdclass/llog.c | 378 +-------
- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 499 ----------
- .../staging/lustre/lustre/obdclass/llog_internal.h | 10 -
- drivers/staging/lustre/lustre/obdclass/llog_obd.c | 30 -
- .../lustre/lustre/obdclass/lprocfs_status.c | 334 -------
- drivers/staging/lustre/lustre/obdclass/lu_object.c | 241 -----
- .../lustre/lustre/obdclass/lustre_handles.c | 13 -
- .../staging/lustre/lustre/obdclass/obd_config.c | 257 -----
- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 27 -
- drivers/staging/lustre/lustre/obdclass/obdo.c | 170 ----
- .../staging/lustre/lustre/obdclass/statfs_pack.c | 14 -
- drivers/staging/lustre/lustre/ptlrpc/client.c | 95 --
- drivers/staging/lustre/lustre/ptlrpc/import.c | 11 -
- drivers/staging/lustre/lustre/ptlrpc/layout.c | 126 ---
- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 30 -
- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 123 ---
- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 197 ----
- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 154 ---
- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 2 -
- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 42 -
- drivers/staging/lustre/lustre/ptlrpc/sec.c | 116 ---
- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 329 -------
- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 48 -
- drivers/staging/lustre/lustre/ptlrpc/sec_gc.c | 15 -
- drivers/staging/lustre/lustre/ptlrpc/service.c | 282 ------
- 62 files changed, 19 insertions(+), 5934 deletions(-)
- diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c
- index cc2201c25339..bf12723c9b1c 100644
- --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
- +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
- @@ -47,7 +47,6 @@
- #include "../include/obd.h"
- #include "../include/obd_class.h"
- -#include "../include/dt_object.h"
- #include "../include/obd_support.h"
- #include "../include/lustre_req_layout.h"
- #include "../include/lustre_fid.h"
- diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c
- index 5eeb36dc988f..446917484637 100644
- --- a/drivers/staging/lustre/lustre/fld/fld_cache.c
- +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
- @@ -53,7 +53,6 @@
- #include "../include/obd_support.h"
- #include "../include/lprocfs_status.h"
- -#include "../include/dt_object.h"
- #include "../include/lustre_req_layout.h"
- #include "../include/lustre_fld.h"
- #include "fld_internal.h"
- diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h
- index 844576b9bc6f..fbb232de6c74 100644
- --- a/drivers/staging/lustre/lustre/fld/fld_internal.h
- +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h
- @@ -42,7 +42,6 @@
- #define __FLD_INTERNAL_H
- #include "../include/lustre/lustre_idl.h"
- -#include "../include/dt_object.h"
- #include "../../include/linux/libcfs/libcfs.h"
- #include "../include/lustre_req_layout.h"
- @@ -175,8 +174,6 @@ void fld_dump_cache_entries(struct fld_cache *cache);
- struct fld_cache_entry
- *fld_cache_entry_lookup_nolock(struct fld_cache *cache,
- struct lu_seq_range *range);
- -int fld_write_range(const struct lu_env *env, struct dt_object *dt,
- - const struct lu_seq_range *range, struct thandle *th);
- static inline const char *
- fld_target_name(struct lu_fld_target *tar)
- diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c
- index 1e450bf95383..3fd91bc77da5 100644
- --- a/drivers/staging/lustre/lustre/fld/fld_request.c
- +++ b/drivers/staging/lustre/lustre/fld/fld_request.c
- @@ -52,7 +52,6 @@
- #include "../include/obd_support.h"
- #include "../include/lprocfs_status.h"
- -#include "../include/dt_object.h"
- #include "../include/lustre_req_layout.h"
- #include "../include/lustre_fld.h"
- #include "../include/lustre_mdc.h"
- diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c b/drivers/staging/lustre/lustre/fld/lproc_fld.c
- index da822101e005..603f56e6095b 100644
- --- a/drivers/staging/lustre/lustre/fld/lproc_fld.c
- +++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c
- @@ -48,7 +48,6 @@
- #include "../include/obd.h"
- #include "../include/obd_class.h"
- -#include "../include/dt_object.h"
- #include "../include/obd_support.h"
- #include "../include/lustre_req_layout.h"
- #include "../include/lustre_fld.h"
- diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h
- index 90fbaa22e510..1ee4b185a35f 100644
- --- a/drivers/staging/lustre/lustre/include/cl_object.h
- +++ b/drivers/staging/lustre/lustre/include/cl_object.h
- @@ -2737,7 +2737,6 @@ struct cl_object *cl_object_find(const struct lu_env *env, struct cl_device *cd,
- const struct cl_object_conf *c);
- int cl_object_header_init(struct cl_object_header *h);
- -void cl_object_header_fini(struct cl_object_header *h);
- void cl_object_put (const struct lu_env *env, struct cl_object *o);
- void cl_object_get (struct cl_object *o);
- void cl_object_attr_lock (struct cl_object *o);
- @@ -2752,7 +2751,6 @@ int cl_conf_set (const struct lu_env *env, struct cl_object *obj,
- const struct cl_object_conf *conf);
- void cl_object_prune (const struct lu_env *env, struct cl_object *obj);
- void cl_object_kill (const struct lu_env *env, struct cl_object *obj);
- -int cl_object_has_locks (struct cl_object *obj);
- /**
- * Returns true, iff \a o0 and \a o1 are slices of the same object.
- @@ -2939,10 +2937,6 @@ void cl_lock_release (const struct lu_env *env, struct cl_lock *lock,
- void cl_lock_user_add (const struct lu_env *env, struct cl_lock *lock);
- void cl_lock_user_del (const struct lu_env *env, struct cl_lock *lock);
- -enum cl_lock_state cl_lock_intransit(const struct lu_env *env,
- - struct cl_lock *lock);
- -void cl_lock_extransit(const struct lu_env *env, struct cl_lock *lock,
- - enum cl_lock_state state);
- int cl_lock_is_intransit(struct cl_lock *lock);
- int cl_lock_enqueue_wait(const struct lu_env *env, struct cl_lock *lock,
- @@ -2980,8 +2974,6 @@ int cl_lock_enqueue_wait(const struct lu_env *env, struct cl_lock *lock,
- *
- * @{ */
- -int cl_enqueue (const struct lu_env *env, struct cl_lock *lock,
- - struct cl_io *io, __u32 flags);
- int cl_wait (const struct lu_env *env, struct cl_lock *lock);
- void cl_unuse (const struct lu_env *env, struct cl_lock *lock);
- int cl_enqueue_try(const struct lu_env *env, struct cl_lock *lock,
- @@ -2993,14 +2985,12 @@ int cl_use_try (const struct lu_env *env, struct cl_lock *lock, int atomic)
- /** @} statemachine */
- void cl_lock_signal (const struct lu_env *env, struct cl_lock *lock);
- -int cl_lock_state_wait (const struct lu_env *env, struct cl_lock *lock);
- void cl_lock_state_set (const struct lu_env *env, struct cl_lock *lock,
- enum cl_lock_state state);
- int cl_queue_match (const struct list_head *queue,
- const struct cl_lock_descr *need);
- void cl_lock_mutex_get (const struct lu_env *env, struct cl_lock *lock);
- -int cl_lock_mutex_try (const struct lu_env *env, struct cl_lock *lock);
- void cl_lock_mutex_put (const struct lu_env *env, struct cl_lock *lock);
- int cl_lock_is_mutexed (struct cl_lock *lock);
- int cl_lock_nr_mutexed (const struct lu_env *env);
- @@ -3021,8 +3011,6 @@ int cl_lock_closure_build(const struct lu_env *env, struct cl_lock *lock,
- struct cl_lock_closure *closure);
- void cl_lock_disclosure (const struct lu_env *env,
- struct cl_lock_closure *closure);
- -int cl_lock_enclosure (const struct lu_env *env, struct cl_lock *lock,
- - struct cl_lock_closure *closure);
- void cl_lock_cancel(const struct lu_env *env, struct cl_lock *lock);
- void cl_lock_delete(const struct lu_env *env, struct cl_lock *lock);
- @@ -3066,10 +3054,6 @@ int cl_io_submit_rw (const struct lu_env *env, struct cl_io *io,
- int cl_io_submit_sync (const struct lu_env *env, struct cl_io *io,
- enum cl_req_type iot, struct cl_2queue *queue,
- long timeout);
- -void cl_io_rw_advance (const struct lu_env *env, struct cl_io *io,
- - size_t nob);
- -int cl_io_cancel (const struct lu_env *env, struct cl_io *io,
- - struct cl_page_list *queue);
- int cl_io_is_going (const struct lu_env *env);
- /**
- @@ -3101,9 +3085,6 @@ static inline int cl_io_is_trunc(const struct cl_io *io)
- struct cl_io *cl_io_top(struct cl_io *io);
- -void cl_io_print(const struct lu_env *env, void *cookie,
- - lu_printer_t printer, const struct cl_io *io);
- -
- #define CL_IO_SLICE_CLEAN(foo_io, base) \
- do { \
- typeof(foo_io) __foo_io = (foo_io); \
- @@ -3151,8 +3132,6 @@ void cl_page_list_disown (const struct lu_env *env,
- struct cl_io *io, struct cl_page_list *plist);
- int cl_page_list_own (const struct lu_env *env,
- struct cl_io *io, struct cl_page_list *plist);
- -void cl_page_list_assume (const struct lu_env *env,
- - struct cl_io *io, struct cl_page_list *plist);
- void cl_page_list_discard(const struct lu_env *env,
- struct cl_io *io, struct cl_page_list *plist);
- int cl_page_list_unmap (const struct lu_env *env,
- @@ -3163,8 +3142,6 @@ void cl_2queue_init (struct cl_2queue *queue);
- void cl_2queue_add (struct cl_2queue *queue, struct cl_page *page);
- void cl_2queue_disown (const struct lu_env *env,
- struct cl_io *io, struct cl_2queue *queue);
- -void cl_2queue_assume (const struct lu_env *env,
- - struct cl_io *io, struct cl_2queue *queue);
- void cl_2queue_discard (const struct lu_env *env,
- struct cl_io *io, struct cl_2queue *queue);
- void cl_2queue_fini (const struct lu_env *env, struct cl_2queue *queue);
- @@ -3257,7 +3234,6 @@ struct cl_env_nest {
- void *cen_cookie;
- };
- -struct lu_env *cl_env_peek (int *refcheck);
- struct lu_env *cl_env_get (int *refcheck);
- struct lu_env *cl_env_alloc (int *refcheck, __u32 tags);
- struct lu_env *cl_env_nested_get (struct cl_env_nest *nest);
- @@ -3273,7 +3249,6 @@ void cl_env_unplant (struct lu_env *env, int *refcheck);
- /*
- * Misc
- */
- -void cl_attr2lvb(struct ost_lvb *lvb, const struct cl_attr *attr);
- void cl_lvb2attr(struct cl_attr *attr, const struct ost_lvb *lvb);
- struct cl_device *cl_type_setup(const struct lu_env *env, struct lu_site *site,
- diff --git a/drivers/staging/lustre/lustre/include/dt_object.h b/drivers/staging/lustre/lustre/include/dt_object.h
- index abae31b41e74..4fc92cd29be6 100644
- --- a/drivers/staging/lustre/lustre/include/dt_object.h
- +++ b/drivers/staging/lustre/lustre/include/dt_object.h
- @@ -207,23 +207,6 @@ enum dt_index_flags {
- };
- /**
- - * Features, required from index to support file system directories (mapping
- - * names to fids).
- - */
- -extern const struct dt_index_features dt_directory_features;
- -extern const struct dt_index_features dt_otable_features;
- -extern const struct dt_index_features dt_lfsck_features;
- -
- -/* index features supported by the accounting objects */
- -extern const struct dt_index_features dt_acct_features;
- -
- -/* index features supported by the quota global indexes */
- -extern const struct dt_index_features dt_quota_glb_features;
- -
- -/* index features supported by the quota slave indexes */
- -extern const struct dt_index_features dt_quota_slv_features;
- -
- -/**
- * This is a general purpose dt allocation hint.
- * It now contains the parent object.
- * It can contain any allocation hint in the future.
- @@ -272,8 +255,6 @@ struct dt_object_format {
- } u;
- };
- -enum dt_format_type dt_mode_to_dft(__u32 mode);
- -
- typedef __u64 dt_obj_version_t;
- /**
- @@ -658,9 +639,6 @@ struct dt_device {
- struct list_head dd_txn_callbacks;
- };
- -int dt_device_init(struct dt_device *dev, struct lu_device_type *t);
- -void dt_device_fini(struct dt_device *dev);
- -
- static inline int lu_device_is_dt(const struct lu_device *d)
- {
- return ergo(d != NULL, d->ld_type->ldt_tags & LU_DEVICE_DT);
- @@ -703,11 +681,6 @@ static inline struct dt_object *lu2dt(struct lu_object *l)
- return container_of0(l, struct dt_object, do_lu);
- }
- -int dt_object_init(struct dt_object *obj,
- - struct lu_object_header *h, struct lu_device *d);
- -
- -void dt_object_fini(struct dt_object *obj);
- -
- static inline int dt_object_exists(const struct dt_object *dt)
- {
- return lu_object_exists(&dt->do_lu);
- @@ -789,16 +762,6 @@ struct dt_txn_callback {
- struct list_head dtc_linkage;
- };
- -void dt_txn_callback_add(struct dt_device *dev, struct dt_txn_callback *cb);
- -void dt_txn_callback_del(struct dt_device *dev, struct dt_txn_callback *cb);
- -
- -int dt_txn_hook_start(const struct lu_env *env,
- - struct dt_device *dev, struct thandle *txn);
- -int dt_txn_hook_stop(const struct lu_env *env, struct thandle *txn);
- -void dt_txn_hook_commit(struct thandle *txn);
- -
- -int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj);
- -
- /**
- * Callback function used for parsing path.
- * \see llo_store_resolve
- @@ -809,10 +772,6 @@ typedef int (*dt_entry_func_t)(const struct lu_env *env,
- #define DT_MAX_PATH 1024
- -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);
- @@ -823,24 +782,6 @@ struct dt_object *dt_store_open(const struct lu_env *env,
- 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,
- - struct dt_object_format *dof,
- - struct lu_attr *attr);
- -
- -struct dt_object *dt_locate_at(const struct lu_env *env,
- - struct dt_device *dev,
- - const struct lu_fid *fid,
- - struct lu_device *top_dev);
- -static inline struct dt_object *
- -dt_locate(const struct lu_env *env, struct dt_device *dev,
- - const struct lu_fid *fid)
- -{
- - return dt_locate_at(env, dev, fid, dev->dd_lu_dev.ld_site->ls_top_dev);
- -}
- -
- -
- int local_oid_storage_init(const struct lu_env *env, struct dt_device *dev,
- const struct lu_fid *first_fid,
- struct local_oid_storage **los);
- @@ -886,51 +827,10 @@ local_index_find_or_create_with_fid(const struct lu_env *env,
- int local_object_unlink(const struct lu_env *env, struct dt_device *dt,
- struct dt_object *parent, const char *name);
- -static inline int dt_object_lock(const struct lu_env *env,
- - struct dt_object *o, struct lustre_handle *lh,
- - struct ldlm_enqueue_info *einfo,
- - void *policy)
- -{
- - LASSERT(o);
- - LASSERT(o->do_ops);
- - LASSERT(o->do_ops->do_object_lock);
- - return o->do_ops->do_object_lock(env, o, lh, einfo, policy);
- -}
- -
- -int dt_lookup_dir(const struct lu_env *env, struct dt_object *dir,
- - const char *name, struct lu_fid *fid);
- -
- -static inline int dt_object_sync(const struct lu_env *env, struct dt_object *o,
- - __u64 start, __u64 end)
- -{
- - LASSERT(o);
- - LASSERT(o->do_ops);
- - LASSERT(o->do_ops->do_object_sync);
- - return o->do_ops->do_object_sync(env, o, start, end);
- -}
- -
- -int dt_declare_version_set(const struct lu_env *env, struct dt_object *o,
- - struct thandle *th);
- -void dt_version_set(const struct lu_env *env, struct dt_object *o,
- - dt_obj_version_t version, struct thandle *th);
- -dt_obj_version_t dt_version_get(const struct lu_env *env, struct dt_object *o);
- -
- -
- -int dt_read(const struct lu_env *env, struct dt_object *dt,
- - struct lu_buf *buf, loff_t *pos);
- -int dt_record_read(const struct lu_env *env, struct dt_object *dt,
- - struct lu_buf *buf, loff_t *pos);
- -int dt_record_write(const struct lu_env *env, struct dt_object *dt,
- - const struct lu_buf *buf, loff_t *pos, struct thandle *th);
- typedef int (*dt_index_page_build_t)(const struct lu_env *env,
- union lu_page *lp, int nob,
- const struct dt_it_ops *iops,
- struct dt_it *it, __u32 attr, void *arg);
- -int dt_index_walk(const struct lu_env *env, struct dt_object *obj,
- - const struct lu_rdpg *rdpg, dt_index_page_build_t filler,
- - void *arg);
- -int dt_index_read(const struct lu_env *env, struct dt_device *dev,
- - struct idx_info *ii, const struct lu_rdpg *rdpg);
- static inline struct thandle *dt_trans_create(const struct lu_env *env,
- struct dt_device *d)
- @@ -1449,48 +1349,4 @@ static inline int dt_lookup(const struct lu_env *env,
- #define LU221_BAD_TIME (0x80000000U + 24 * 3600)
- -struct dt_find_hint {
- - struct lu_fid *dfh_fid;
- - struct dt_device *dfh_dt;
- - struct dt_object *dfh_o;
- -};
- -
- -struct dt_thread_info {
- - char dti_buf[DT_MAX_PATH];
- - struct dt_find_hint dti_dfh;
- - struct lu_attr dti_attr;
- - struct lu_fid dti_fid;
- - struct dt_object_format dti_dof;
- - struct lustre_mdt_attrs dti_lma;
- - struct lu_buf dti_lb;
- - loff_t dti_off;
- -};
- -
- -extern struct lu_context_key dt_key;
- -
- -static inline struct dt_thread_info *dt_info(const struct lu_env *env)
- -{
- - struct dt_thread_info *dti;
- -
- - dti = lu_context_key_get(&env->le_ctx, &dt_key);
- - LASSERT(dti);
- - return dti;
- -}
- -
- -int dt_global_init(void);
- -void dt_global_fini(void);
- -
- -int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
- - int count, int *eof, void *data);
- -int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off,
- - int count, int *eof, void *data);
- -int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off,
- - int count, int *eof, void *data);
- -int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off,
- - int count, int *eof, void *data);
- -int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off,
- - int count, int *eof, void *data);
- -int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
- - int count, int *eof, void *data);
- -
- #endif /* __LUSTRE_DT_OBJECT_H */
- diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
- index 36c0690361fb..3deff28b2c7f 100644
- --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
- +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
- @@ -537,26 +537,17 @@ extern struct lprocfs_stats *
- lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
- void lprocfs_clear_stats(struct lprocfs_stats *stats);
- void lprocfs_free_stats(struct lprocfs_stats **stats);
- -void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats);
- -void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats);
- -void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
- int lprocfs_alloc_obd_stats(struct obd_device *obddev,
- unsigned int num_private_stats);
- -int lprocfs_alloc_md_stats(struct obd_device *obddev,
- - unsigned int num_private_stats);
- void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
- unsigned conf, const char *name, const char *units);
- void lprocfs_free_obd_stats(struct obd_device *obddev);
- -void lprocfs_free_md_stats(struct obd_device *obddev);
- struct obd_export;
- int lprocfs_exp_cleanup(struct obd_export *exp);
- struct dentry *ldebugfs_add_simple(struct dentry *root,
- char *name,
- void *data,
- struct file_operations *fops);
- -struct dentry *
- -ldebugfs_add_symlink(const char *name, struct dentry *parent,
- - const char *format, ...);
- int ldebugfs_register_stats(struct dentry *parent,
- const char *name,
- @@ -591,14 +582,12 @@ int ldebugfs_obd_seq_create(struct obd_device *dev,
- /* Generic callbacks */
- -int lprocfs_rd_u64(struct seq_file *m, void *data);
- -int lprocfs_rd_atomic(struct seq_file *m, void *data);
- -int lprocfs_wr_atomic(struct file *file, const char __user *buffer,
- - unsigned long count, void *data);
- +
- + /* Generic callbacks */
- +
- int lprocfs_rd_uint(struct seq_file *m, void *data);
- int lprocfs_wr_uint(struct file *file, const char __user *buffer,
- - unsigned long count, void *data);
- -int lprocfs_rd_name(struct seq_file *m, void *data);
- + unsigned long count, void *data);
- int lprocfs_rd_server_uuid(struct seq_file *m, void *data);
- int lprocfs_rd_conn_uuid(struct seq_file *m, void *data);
- int lprocfs_rd_import(struct seq_file *m, void *data);
- @@ -609,22 +598,21 @@ struct adaptive_timeout;
- int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at);
- int lprocfs_rd_timeouts(struct seq_file *m, void *data);
- int lprocfs_wr_timeouts(struct file *file, const char __user *buffer,
- - unsigned long count, void *data);
- + unsigned long count, void *data);
- int lprocfs_wr_evict_client(struct file *file, const char __user *buffer,
- - size_t count, loff_t *off);
- + size_t count, loff_t *off);
- int lprocfs_wr_ping(struct file *file, const char __user *buffer,
- - size_t count, loff_t *off);
- + size_t count, loff_t *off);
- int lprocfs_wr_import(struct file *file, const char __user *buffer,
- - size_t count, loff_t *off);
- + size_t count, loff_t *off);
- int lprocfs_rd_pinger_recov(struct seq_file *m, void *n);
- int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer,
- - size_t count, loff_t *off);
- + size_t count, loff_t *off);
- /* Statfs helpers */
- int lprocfs_write_helper(const char __user *buffer, unsigned long count,
- int *val);
- -int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
- int lprocfs_write_u64_helper(const char __user *buffer,
- unsigned long count, __u64 *val);
- int lprocfs_write_frac_u64_helper(const char *buffer,
- @@ -738,15 +726,6 @@ ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,
- extern const struct sysfs_ops lustre_sysfs_ops;
- -/* lproc_ptlrpc.c */
- -struct ptlrpc_request;
- -void target_print_req(void *seq_file, struct ptlrpc_request *req);
- -
- -/* lproc_status.c */
- -int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data);
- -int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
- - size_t count, loff_t *off);
- -
- /* all quota proc functions */
- int lprocfs_quota_rd_bunit(char *page, char **start,
- loff_t off, int count,
- diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h
- index 77560085082a..e2199c2cea44 100644
- --- a/drivers/staging/lustre/lustre/include/lu_object.h
- +++ b/drivers/staging/lustre/lustre/include/lu_object.h
- @@ -672,7 +672,6 @@ void lu_object_add_top (struct lu_object_header *h, struct lu_object *o);
- void lu_object_add (struct lu_object *before, struct lu_object *o);
- void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d);
- -void lu_dev_del_linkage(struct lu_site *s, struct lu_device *d);
- /**
- * Helpers to initialize and finalize device types.
- @@ -710,7 +709,6 @@ static inline int lu_object_is_dying(const struct lu_object_header *h)
- }
- void lu_object_put(const struct lu_env *env, struct lu_object *o);
- -void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o);
- void lu_object_unhash(const struct lu_env *env, struct lu_object *o);
- int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr);
- @@ -1241,14 +1239,6 @@ void lu_context_key_degister_many(struct lu_context_key *k, ...);
- void lu_context_key_revive_many (struct lu_context_key *k, ...);
- void lu_context_key_quiesce_many (struct lu_context_key *k, ...);
- -/*
- - * update/clear ctx/ses tags.
- - */
- -void lu_context_tags_update(__u32 tags);
- -void lu_context_tags_clear(__u32 tags);
- -void lu_session_tags_update(__u32 tags);
- -void lu_session_tags_clear(__u32 tags);
- -
- /**
- * Environment.
- */
- @@ -1266,7 +1256,6 @@ struct lu_env {
- int lu_env_init (struct lu_env *env, __u32 tags);
- void lu_env_fini (struct lu_env *env);
- int lu_env_refill(struct lu_env *env);
- -int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, __u32 stags);
- /** @} lu_context */
- @@ -1319,21 +1308,5 @@ struct lu_kmem_descr {
- int lu_kmem_init(struct lu_kmem_descr *caches);
- void lu_kmem_fini(struct lu_kmem_descr *caches);
- -void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o,
- - const struct lu_fid *fid);
- -struct lu_object *lu_object_anon(const struct lu_env *env,
- - struct lu_device *dev,
- - const struct lu_object_conf *conf);
- -
- -/** null buffer */
- -extern struct lu_buf LU_BUF_NULL;
- -
- -void lu_buf_free(struct lu_buf *buf);
- -void lu_buf_alloc(struct lu_buf *buf, int size);
- -void lu_buf_realloc(struct lu_buf *buf, int size);
- -
- -int lu_buf_check_and_grow(struct lu_buf *buf, int len);
- -struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, int len);
- -
- /** @} lu */
- #endif /* __LUSTRE_LU_OBJECT_H */
- diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
- index e0cec23e8344..50390414b677 100644
- --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
- +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
- @@ -2587,8 +2587,6 @@ struct lmv_desc {
- struct obd_uuid ld_uuid;
- };
- -void lustre_swab_lmv_desc(struct lmv_desc *ld);
- -
- /* TODO: lmv_stripe_md should contain mds capabilities for all slave fids */
- struct lmv_stripe_md {
- __u32 mea_magic;
- @@ -2599,8 +2597,6 @@ struct lmv_stripe_md {
- struct lu_fid mea_ids[0];
- };
- -void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea);
- -
- /* lmv structures */
- #define MEA_MAGIC_LAST_CHAR 0xb2221ca1
- #define MEA_MAGIC_ALL_CHARS 0xb222a11c
- @@ -3442,8 +3438,6 @@ struct lu_idxpage {
- char lip_entries[0];
- };
- -void lustre_swab_lip_header(struct lu_idxpage *lip);
- -
- #define LIP_HDR_SIZE (offsetof(struct lu_idxpage, lip_entries))
- /* Gather all possible type associated with a 4KB container */
- @@ -3541,8 +3535,6 @@ struct lustre_capa_key {
- __u8 lk_key[CAPA_HMAC_KEY_MAX_LEN]; /**< key */
- } __attribute__((packed));
- -void lustre_swab_lustre_capa_key(struct lustre_capa_key *k);
- -
- /** The link ea holds 1 \a link_ea_entry for each hardlink */
- #define LINK_EA_MAGIC 0x11EAF1DFUL
- struct link_ea_header {
- diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
- index e9925ef1dbee..1a41366322fe 100644
- --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
- +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
- @@ -406,8 +406,6 @@ static inline int lmv_user_md_size(int stripes, int lmm_magic)
- stripes * sizeof(struct lmv_user_mds_data);
- }
- -void lustre_swab_lmv_user_md(struct lmv_user_md *lum);
- -
- struct ll_recreate_obj {
- __u64 lrc_id;
- __u32 lrc_ost_idx;
- diff --git a/drivers/staging/lustre/lustre/include/lustre_capa.h b/drivers/staging/lustre/lustre/include/lustre_capa.h
- index b75f7308d777..2454481735b5 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_capa.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_capa.h
- @@ -180,16 +180,7 @@ extern int capa_count[];
- extern struct kmem_cache *capa_cachep;
- struct hlist_head *init_capa_hash(void);
- -void cleanup_capa_hash(struct hlist_head *hash);
- -struct obd_capa *capa_add(struct hlist_head *hash,
- - struct lustre_capa *capa);
- -struct obd_capa *capa_lookup(struct hlist_head *hash,
- - struct lustre_capa *capa, int alive);
- -
- -int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key);
- -int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen);
- -int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen);
- void capa_cpy(void *dst, struct obd_capa *ocapa);
- static inline struct obd_capa *alloc_capa(int site)
- {
- diff --git a/drivers/staging/lustre/lustre/include/lustre_debug.h b/drivers/staging/lustre/lustre/include/lustre_debug.h
- index 6c92d0bc943b..8a089413c92e 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_debug.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_debug.h
- @@ -46,7 +46,6 @@
- #include "obd.h"
- /* lib/debug.c */
- -void dump_lniobuf(struct niobuf_local *lnb);
- int dump_req(struct ptlrpc_request *req);
- int block_debug_setup(void *addr, int len, __u64 off, __u64 id);
- int block_debug_check(char *who, void *addr, int len, __u64 off, __u64 id);
- diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h
- index ec33259ca7df..4178c8563dd3 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_disk.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_disk.h
- @@ -385,8 +385,6 @@ struct lustre_mount_info {
- /* obd_mount.c */
- int server_name2fsname(const char *svname, char *fsname, const char **endptr);
- int server_name2index(const char *svname, __u32 *idx, const char **endptr);
- -int server_name2svname(const char *label, char *svname, const char **endptr,
- - size_t svsize);
- int lustre_put_lsi(struct super_block *sb);
- int lustre_start_simple(char *obdname, char *type, char *uuid,
- diff --git a/drivers/staging/lustre/lustre/include/lustre_eacl.h b/drivers/staging/lustre/lustre/include/lustre_eacl.h
- index 0f8f76c43ee1..499f9c8e1ae1 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_eacl.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_eacl.h
- @@ -80,10 +80,6 @@ extern void
- lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size);
- extern void
- lustre_ext_acl_xattr_free(ext_acl_xattr_header *header);
- -extern int
- -lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size,
- - ext_acl_xattr_header *ext_header,
- - posix_acl_xattr_header **out);
- extern ext_acl_xattr_header *
- lustre_acl_xattr_merge2ext(posix_acl_xattr_header *posix_header, int size,
- ext_acl_xattr_header *ext_header);
- diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h
- index b06ee9ff22ae..e0fddaf4eda5 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_export.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_export.h
- @@ -265,12 +265,6 @@ static inline int exp_connect_multibulk(struct obd_export *exp)
- return exp_max_brw_size(exp) > ONE_MB_BRW_SIZE;
- }
- -static inline int exp_expired(struct obd_export *exp, long age)
- -{
- - LASSERT(exp->exp_delayed);
- - return exp->exp_last_request_time + age < ktime_get_real_seconds();
- -}
- -
- static inline int exp_connect_cancelset(struct obd_export *exp)
- {
- LASSERT(exp != NULL);
- @@ -368,7 +362,6 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp)
- }
- struct obd_export *class_conn2export(struct lustre_handle *conn);
- -struct obd_device *class_conn2obd(struct lustre_handle *conn);
- /** @} export */
- diff --git a/drivers/staging/lustre/lustre/include/lustre_handles.h b/drivers/staging/lustre/lustre/include/lustre_handles.h
- index 726bbd3eaf55..4d51c8ac3906 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_handles.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_handles.h
- @@ -86,7 +86,6 @@ struct portals_handle {
- void class_handle_hash(struct portals_handle *,
- struct portals_handle_ops *ops);
- void class_handle_unhash(struct portals_handle *);
- -void class_handle_hash_back(struct portals_handle *);
- void *class_handle2object(__u64 cookie);
- void class_handle_free_cb(struct rcu_head *rcu);
- int class_handle_init(void);
- diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h
- index 079db528ba74..660d29032ad4 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_import.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_import.h
- @@ -374,7 +374,6 @@ extern unsigned int at_max;
- /* genops.c */
- struct obd_export;
- struct obd_import *class_exp2cliimp(struct obd_export *);
- -struct obd_import *class_conn2cliimp(struct lustre_handle *);
- /** @} import */
- diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
- index b380359cadab..35175fd3da88 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_lib.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
- @@ -100,7 +100,6 @@ struct obd_client_handle {
- #define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed
- /* statfs_pack.c */
- -void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs);
- void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs);
- /*
- diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h
- index 2187fb615e9a..4bece1871c30 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_log.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_log.h
- @@ -58,7 +58,6 @@
- #include "obd_class.h"
- #include "lustre/lustre_idl.h"
- -#include "dt_object.h"
- #define LOG_NAME_LIMIT(logname, name) \
- snprintf(logname, sizeof(logname), "LOGS/%s", name)
- @@ -117,24 +116,17 @@ struct llog_handle;
- /* llog.c - general API */
- int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,
- int flags, struct obd_uuid *uuid);
- -int llog_copy_handler(const struct lu_env *env, struct llog_handle *llh,
- - struct llog_rec_hdr *rec, void *data);
- int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
- llog_cb_t cb, void *data, void *catdata);
- int llog_process_or_fork(const struct lu_env *env,
- struct llog_handle *loghandle,
- llog_cb_t cb, void *data, void *catdata, bool fork);
- -int llog_reverse_process(const struct lu_env *env,
- - struct llog_handle *loghandle, llog_cb_t cb,
- - void *data, void *catdata);
- int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle,
- int index);
- int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt,
- struct llog_handle **lgh, struct llog_logid *logid,
- char *name, enum llog_open_param open_param);
- int llog_close(const struct lu_env *env, struct llog_handle *cathandle);
- -int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt,
- - char *name);
- int llog_backup(const struct lu_env *env, struct obd_device *obd,
- struct llog_ctxt *ctxt, struct llog_ctxt *bak_ctxt,
- char *name, char *backup);
- @@ -172,29 +164,14 @@ struct llog_process_cat_data {
- int lpcd_last_idx;
- };
- +struct thandle;
- +
- int llog_cat_close(const struct lu_env *env, struct llog_handle *cathandle);
- -int llog_cat_add_rec(const struct lu_env *env, struct llog_handle *cathandle,
- - struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
- - void *buf, struct thandle *th);
- -int llog_cat_declare_add_rec(const struct lu_env *env,
- - struct llog_handle *cathandle,
- - struct llog_rec_hdr *rec, struct thandle *th);
- -int llog_cat_add(const struct lu_env *env, struct llog_handle *cathandle,
- - struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
- - void *buf);
- -int llog_cat_cancel_records(const struct lu_env *env,
- - struct llog_handle *cathandle, int count,
- - struct llog_cookie *cookies);
- int llog_cat_process_or_fork(const struct lu_env *env,
- struct llog_handle *cat_llh, llog_cb_t cb,
- void *data, int startcat, int startidx, bool fork);
- int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
- llog_cb_t cb, void *data, int startcat, int startidx);
- -int llog_cat_reverse_process(const struct lu_env *env,
- - struct llog_handle *cat_llh, llog_cb_t cb,
- - void *data);
- -int llog_cat_init_and_process(const struct lu_env *env,
- - struct llog_handle *llh);
- /* llog_obd.c */
- int llog_setup(const struct lu_env *env, struct obd_device *obd,
- @@ -202,9 +179,6 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
- struct obd_device *disk_obd, struct llog_operations *op);
- int __llog_ctxt_put(const struct lu_env *env, struct llog_ctxt *ctxt);
- int llog_cleanup(const struct lu_env *env, struct llog_ctxt *);
- -int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
- -int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
- - struct llog_cookie *cookies, int flags);
- /* llog_net.c */
- int llog_initiator_connect(struct llog_ctxt *ctxt);
- @@ -254,8 +228,6 @@ struct llog_operations {
- int (*lop_declare_create)(const struct lu_env *env,
- struct llog_handle *handle,
- struct thandle *th);
- - int (*lop_create)(const struct lu_env *env, struct llog_handle *handle,
- - struct thandle *th);
- /**
- * write new record in llog. It appends records usually but can edit
- * existing records too.
- @@ -510,11 +482,6 @@ static inline int llog_connect(struct llog_ctxt *ctxt,
- }
- /* llog.c */
- -int llog_exist(struct llog_handle *loghandle);
- -int llog_declare_create(const struct lu_env *env,
- - struct llog_handle *loghandle, struct thandle *th);
- -int llog_create(const struct lu_env *env, struct llog_handle *handle,
- - struct thandle *th);
- int llog_declare_write_rec(const struct lu_env *env,
- struct llog_handle *handle,
- struct llog_rec_hdr *rec, int idx,
- @@ -522,20 +489,10 @@ int llog_declare_write_rec(const struct lu_env *env,
- int llog_write_rec(const struct lu_env *env, struct llog_handle *handle,
- struct llog_rec_hdr *rec, struct llog_cookie *logcookies,
- int numcookies, void *buf, int idx, struct thandle *th);
- -int llog_add(const struct lu_env *env, struct llog_handle *lgh,
- - struct llog_rec_hdr *rec, struct llog_cookie *logcookies,
- - void *buf, struct thandle *th);
- -int llog_declare_add(const struct lu_env *env, struct llog_handle *lgh,
- - struct llog_rec_hdr *rec, struct thandle *th);
- int lustre_process_log(struct super_block *sb, char *logname,
- struct config_llog_instance *cfg);
- int lustre_end_log(struct super_block *sb, char *logname,
- struct config_llog_instance *cfg);
- -int llog_open_create(const struct lu_env *env, struct llog_ctxt *ctxt,
- - struct llog_handle **res, struct llog_logid *logid,
- - char *name);
- -int llog_erase(const struct lu_env *env, struct llog_ctxt *ctxt,
- - struct llog_logid *logid, char *name);
- int llog_write(const struct lu_env *env, struct llog_handle *loghandle,
- struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
- int cookiecount, void *buf, int idx);
- diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h
- index 0db7810f7d6f..16e606ddfb10 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_net.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_net.h
- @@ -643,7 +643,6 @@ struct ptlrpc_nrs_pol_ops {
- *
- * \see ptlrpc_nrs_req_initialize()
- * \see ptlrpc_nrs_hpreq_add_nolock()
- - * \see ptlrpc_nrs_req_hp_move()
- */
- int (*op_res_get) (struct ptlrpc_nrs_policy *policy,
- struct ptlrpc_nrs_request *nrq,
- @@ -659,7 +658,6 @@ struct ptlrpc_nrs_pol_ops {
- *
- * \see ptlrpc_nrs_req_finalize()
- * \see ptlrpc_nrs_hpreq_add_nolock()
- - * \see ptlrpc_nrs_req_hp_move()
- */
- void (*op_res_put) (struct ptlrpc_nrs_policy *policy,
- const struct ptlrpc_nrs_resource *res);
- @@ -704,8 +702,6 @@ struct ptlrpc_nrs_pol_ops {
- *
- * \param[in,out] policy The policy the request \a nrq belongs to
- * \param[in,out] nrq The request to dequeue
- - *
- - * \see ptlrpc_nrs_req_del_nolock()
- */
- void (*op_req_dequeue) (struct ptlrpc_nrs_policy *policy,
- struct ptlrpc_nrs_request *nrq);
- @@ -1537,10 +1533,6 @@ static inline int ptlrpc_req_interpret(const struct lu_env *env,
- * @{
- */
- int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf);
- -int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf);
- -void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req);
- -void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
- - struct ptlrpc_nrs_pol_info *info);
- /*
- * Can the request be moved from the regular NRS head to the high-priority NRS
- @@ -2357,22 +2349,17 @@ void ptlrpc_request_committed(struct ptlrpc_request *req, int force);
- void ptlrpc_init_client(int req_portal, int rep_portal, char *name,
- struct ptlrpc_client *);
- -void ptlrpc_cleanup_client(struct obd_import *imp);
- struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid);
- int ptlrpc_queue_wait(struct ptlrpc_request *req);
- int ptlrpc_replay_req(struct ptlrpc_request *req);
- int ptlrpc_unregister_reply(struct ptlrpc_request *req, int async);
- -void ptlrpc_restart_req(struct ptlrpc_request *req);
- void ptlrpc_abort_inflight(struct obd_import *imp);
- -void ptlrpc_cleanup_imp(struct obd_import *imp);
- void ptlrpc_abort_set(struct ptlrpc_request_set *set);
- struct ptlrpc_request_set *ptlrpc_prep_set(void);
- struct ptlrpc_request_set *ptlrpc_prep_fcset(int max, set_producer_func func,
- void *arg);
- -int ptlrpc_set_add_cb(struct ptlrpc_request_set *set,
- - set_interpreter_func fn, void *data);
- int ptlrpc_set_next_timeout(struct ptlrpc_request_set *);
- int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set);
- int ptlrpc_set_wait(struct ptlrpc_request_set *);
- @@ -2406,15 +2393,7 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp,
- int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
- __u32 version, int opcode, char **bufs,
- struct ptlrpc_cli_ctx *ctx);
- -struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, __u32 version,
- - int opcode, int count, __u32 *lengths,
- - char **bufs);
- -struct ptlrpc_request *ptlrpc_prep_req_pool(struct obd_import *imp,
- - __u32 version, int opcode,
- - int count, __u32 *lengths, char **bufs,
- - struct ptlrpc_request_pool *pool);
- void ptlrpc_req_finished(struct ptlrpc_request *request);
- -void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request);
- struct ptlrpc_request *ptlrpc_request_addref(struct ptlrpc_request *req);
- struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req,
- unsigned npages, unsigned max_brw,
- @@ -2525,12 +2504,8 @@ struct ptlrpc_service_conf {
- *
- * @{
- */
- -void ptlrpc_save_lock(struct ptlrpc_request *req,
- - struct lustre_handle *lock, int mode, int no_ack);
- -void ptlrpc_commit_replies(struct obd_export *exp);
- void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs);
- void ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs);
- -int ptlrpc_hpreq_handler(struct ptlrpc_request *req);
- struct ptlrpc_service *ptlrpc_register_service(
- struct ptlrpc_service_conf *conf,
- struct kset *parent,
- @@ -2540,11 +2515,7 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc);
- int ptlrpc_start_threads(struct ptlrpc_service *svc);
- int ptlrpc_unregister_service(struct ptlrpc_service *service);
- int liblustre_check_services(void *arg);
- -void ptlrpc_daemonize(char *name);
- -int ptlrpc_service_health_check(struct ptlrpc_service *);
- void ptlrpc_server_drop_request(struct ptlrpc_request *req);
- -void ptlrpc_request_change_export(struct ptlrpc_request *req,
- - struct obd_export *export);
- int ptlrpc_hr_init(void);
- void ptlrpc_hr_fini(void);
- @@ -2579,7 +2550,6 @@ void ptlrpc_buf_set_swabbed(struct ptlrpc_request *req, const int inout,
- int ptlrpc_unpack_rep_msg(struct ptlrpc_request *req, int len);
- int ptlrpc_unpack_req_msg(struct ptlrpc_request *req, int len);
- -int lustre_msg_check_version(struct lustre_msg *msg, __u32 version);
- void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens,
- char **bufs);
- int lustre_pack_request(struct ptlrpc_request *, __u32 magic, int count,
- @@ -2603,7 +2573,6 @@ int lustre_msg_early_size(void);
- void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size);
- void *lustre_msg_buf(struct lustre_msg *m, int n, int minlen);
- int lustre_msg_buflen(struct lustre_msg *m, int n);
- -void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len);
- int lustre_msg_bufcount(struct lustre_msg *m);
- char *lustre_msg_string(struct lustre_msg *m, int n, int max_len);
- __u32 lustre_msghdr_get_flags(struct lustre_msg *msg);
- @@ -2616,10 +2585,8 @@ __u32 lustre_msg_get_op_flags(struct lustre_msg *msg);
- void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags);
- struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg);
- __u32 lustre_msg_get_type(struct lustre_msg *msg);
- -__u32 lustre_msg_get_version(struct lustre_msg *msg);
- void lustre_msg_add_version(struct lustre_msg *msg, int version);
- __u32 lustre_msg_get_opc(struct lustre_msg *msg);
- -__u64 lustre_msg_get_last_xid(struct lustre_msg *msg);
- __u64 lustre_msg_get_last_committed(struct lustre_msg *msg);
- __u64 *lustre_msg_get_versions(struct lustre_msg *msg);
- __u64 lustre_msg_get_transno(struct lustre_msg *msg);
- @@ -2632,21 +2599,16 @@ __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg);
- __u32 lustre_msg_get_magic(struct lustre_msg *msg);
- __u32 lustre_msg_get_timeout(struct lustre_msg *msg);
- __u32 lustre_msg_get_service_time(struct lustre_msg *msg);
- -char *lustre_msg_get_jobid(struct lustre_msg *msg);
- __u32 lustre_msg_get_cksum(struct lustre_msg *msg);
- __u32 lustre_msg_calc_cksum(struct lustre_msg *msg);
- void lustre_msg_set_handle(struct lustre_msg *msg,
- struct lustre_handle *handle);
- void lustre_msg_set_type(struct lustre_msg *msg, __u32 type);
- void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc);
- -void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid);
- -void lustre_msg_set_last_committed(struct lustre_msg *msg,
- - __u64 last_committed);
- void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions);
- void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno);
- void lustre_msg_set_status(struct lustre_msg *msg, __u32 status);
- void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt);
- -void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *sizes);
- void ptlrpc_request_set_replen(struct ptlrpc_request *req);
- void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout);
- void lustre_msg_set_service_time(struct lustre_msg *msg, __u32 service_time);
- @@ -2900,8 +2862,6 @@ int ptlrpc_del_timeout_client(struct list_head *obd_list,
- enum timeout_event event);
- struct ptlrpc_request *ptlrpc_prep_ping(struct obd_import *imp);
- int ptlrpc_obd_ping(struct obd_device *obd);
- -void ping_evictor_start(void);
- -void ping_evictor_stop(void);
- void ptlrpc_pinger_ir_up(void);
- void ptlrpc_pinger_ir_down(void);
- /** @} */
- @@ -2912,7 +2872,6 @@ void ptlrpcd_stop(struct ptlrpcd_ctl *pc, int force);
- void ptlrpcd_free(struct ptlrpcd_ctl *pc);
- void ptlrpcd_wake(struct ptlrpc_request *req);
- void ptlrpcd_add_req(struct ptlrpc_request *req);
- -void ptlrpcd_add_rqset(struct ptlrpc_request_set *set);
- int ptlrpcd_addref(void);
- void ptlrpcd_decref(void);
- diff --git a/drivers/staging/lustre/lustre/include/lustre_param.h b/drivers/staging/lustre/lustre/include/lustre_param.h
- index ed654684cb64..de49b414e912 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_param.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_param.h
- @@ -56,15 +56,9 @@ struct cfg_interop_param {
- /* obd_config.c */
- int class_find_param(char *buf, char *key, char **valp);
- -struct cfg_interop_param *class_find_old_param(const char *param,
- - struct cfg_interop_param *ptr);
- -int class_get_next_param(char **params, char *copy);
- int class_match_param(char *buf, char *key, char **valp);
- int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh);
- int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh);
- -int class_parse_net(char *buf, __u32 *net, char **endh);
- -int class_match_nid(char *buf, char *key, lnet_nid_t nid);
- -int class_match_net(char *buf, char *key, __u32 net);
- /* obd_mount.c */
- int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
- char *s1, char *s2, char *s3, char *s4);
- diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h
- index c6457b27c4e7..cfcc995585c0 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h
- @@ -80,8 +80,6 @@ void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req,
- void req_capsule_fini(struct req_capsule *pill);
- void req_capsule_set(struct req_capsule *pill, const struct req_format *fmt);
- -void req_capsule_client_dump(struct req_capsule *pill);
- -void req_capsule_server_dump(struct req_capsule *pill);
- void req_capsule_init_area(struct req_capsule *pill);
- int req_capsule_filled_sizes(struct req_capsule *pill, enum req_location loc);
- int req_capsule_server_pack(struct req_capsule *pill);
- @@ -105,8 +103,6 @@ void *req_capsule_server_swab_get(struct req_capsule *pill,
- void *req_capsule_server_sized_swab_get(struct req_capsule *pill,
- const struct req_msg_field *field,
- int len, void *swabber);
- -const void *req_capsule_other_get(struct req_capsule *pill,
- - const struct req_msg_field *field);
- void req_capsule_set_size(struct req_capsule *pill,
- const struct req_msg_field *field,
- @@ -129,9 +125,6 @@ void req_capsule_shrink(struct req_capsule *pill,
- const struct req_msg_field *field,
- unsigned int newlen,
- enum req_location loc);
- -int req_capsule_server_grow(struct req_capsule *pill,
- - const struct req_msg_field *field,
- - unsigned int newlen);
- int req_layout_init(void);
- void req_layout_fini(void);
- diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h
- index 871185cd52b3..1d2c5724d1df 100644
- --- a/drivers/staging/lustre/lustre/include/lustre_sec.h
- +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
- @@ -295,7 +295,6 @@ enum lustre_sec_part {
- LUSTRE_SP_ANY = 0xFF
- };
- -const char *sptlrpc_part2name(enum lustre_sec_part sp);
- enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd);
- /**
- @@ -339,7 +338,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
- enum lustre_sec_part to,
- lnet_nid_t nid,
- struct sptlrpc_flavor *sf);
- -void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *set);
- int sptlrpc_process_config(struct lustre_cfg *lcfg);
- void sptlrpc_conf_log_start(const char *logname);
- @@ -347,10 +345,6 @@ void sptlrpc_conf_log_stop(const char *logname);
- void sptlrpc_conf_log_update_begin(const char *logname);
- void sptlrpc_conf_log_update_end(const char *logname);
- void sptlrpc_conf_client_adapt(struct obd_device *obd);
- -void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
- - enum lustre_sec_part from,
- - lnet_nid_t nid,
- - struct sptlrpc_flavor *flavor);
- /* The maximum length of security payload. 1024 is enough for Kerberos 5,
- * and should be enough for other future mechanisms but not sure.
- @@ -1002,16 +996,12 @@ void sptlrpc_sec_put(struct ptlrpc_sec *sec);
- * internal apis which only used by policy implementation
- */
- int sptlrpc_get_next_secid(void);
- -void sptlrpc_sec_destroy(struct ptlrpc_sec *sec);
- /*
- * exported client context api
- */
- struct ptlrpc_cli_ctx *sptlrpc_cli_ctx_get(struct ptlrpc_cli_ctx *ctx);
- void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync);
- -void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx);
- -void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx);
- -int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize);
- /*
- * exported client context wrap/buffers
- @@ -1054,7 +1044,6 @@ int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule);
- /* gc */
- void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec);
- void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec);
- -void sptlrpc_gc_add_ctx(struct ptlrpc_cli_ctx *ctx);
- /* misc */
- const char *sec2target_str(struct ptlrpc_sec *sec);
- @@ -1078,25 +1067,16 @@ int sptlrpc_svc_wrap_reply(struct ptlrpc_request *req);
- void sptlrpc_svc_free_rs(struct ptlrpc_reply_state *rs);
- void sptlrpc_svc_ctx_addref(struct ptlrpc_request *req);
- void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req);
- -void sptlrpc_svc_ctx_invalidate(struct ptlrpc_request *req);
- int sptlrpc_target_export_check(struct obd_export *exp,
- struct ptlrpc_request *req);
- -void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
- - struct sptlrpc_rule_set *rset);
- -
- /*
- * reverse context
- */
- int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp,
- struct ptlrpc_svc_ctx *ctx);
- -int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp,
- - struct ptlrpc_cli_ctx *ctx);
- /* bulk security api */
- -int sptlrpc_enc_pool_add_user(void);
- -int sptlrpc_enc_pool_del_user(void);
- -int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc);
- void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc);
- int sptlrpc_cli_wrap_bulk(struct ptlrpc_request *req,
- diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
- index 57b5e1123b4f..c12edc5cd032 100644
- --- a/drivers/staging/lustre/lustre/include/obd.h
- +++ b/drivers/staging/lustre/lustre/include/obd.h
- @@ -779,7 +779,6 @@ struct obd_device {
- struct obd_export *obd_self_export;
- /* list of exports in LRU order, for ping evictor, with obd_dev_lock */
- struct list_head obd_exports_timed;
- - time64_t obd_eviction_timer; /* for ping evictor */
- int obd_max_recoverable_clients;
- atomic_t obd_connected_clients;
- diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
- index 7308cda6f5e6..69349eaf07ca 100644
- --- a/drivers/staging/lustre/lustre/include/obd_class.h
- +++ b/drivers/staging/lustre/lustre/include/obd_class.h
- @@ -64,7 +64,6 @@ extern struct obd_device *obd_devs[MAX_OBD_DEVICES];
- extern rwlock_t obd_dev_lock;
- /* OBD Operations Declarations */
- -struct obd_device *class_conn2obd(struct lustre_handle *);
- struct obd_device *class_exp2obd(struct obd_export *);
- int class_handle_ioctl(unsigned int cmd, unsigned long arg);
- int lustre_get_jobid(char *jobid);
- @@ -84,15 +83,12 @@ void class_release_dev(struct obd_device *obd);
- int class_name2dev(const char *name);
- struct obd_device *class_name2obd(const char *name);
- int class_uuid2dev(struct obd_uuid *uuid);
- -struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
- -void class_obd_list(void);
- struct obd_device *class_find_client_obd(struct obd_uuid *tgt_uuid,
- const char *typ_name,
- struct obd_uuid *grp_uuid);
- struct obd_device *class_devices_in_group(struct obd_uuid *grp_uuid,
- int *next);
- struct obd_device *class_num2obd(int num);
- -int get_devices_count(void);
- int class_notify_sptlrpc_conf(const char *fsname, int namelen);
- @@ -106,20 +102,12 @@ int obd_zombie_impexp_init(void);
- void obd_zombie_impexp_stop(void);
- void obd_zombie_impexp_cull(void);
- void obd_zombie_barrier(void);
- -void obd_exports_barrier(struct obd_device *obd);
- -int kuc_len(int payload_len);
- -struct kuc_hdr *kuc_ptr(void *p);
- -int kuc_ispayload(void *p);
- -void *kuc_alloc(int payload_len, int transport, int type);
- -void kuc_free(void *p, int payload_len);
- struct llog_handle;
- struct llog_rec_hdr;
- typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *,
- struct llog_rec_hdr *, void *);
- /* obd_config.c */
- -struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg,
- - const char *new_name);
- int class_process_config(struct lustre_cfg *lcfg);
- int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
- struct lustre_cfg *lcfg, void *data);
- @@ -159,9 +147,6 @@ struct config_llog_instance {
- };
- int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
- char *name, struct config_llog_instance *cfg);
- -int class_config_dump_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
- - char *name, struct config_llog_instance *cfg);
- -
- enum {
- CONFIG_T_CONFIG = 0,
- CONFIG_T_SPTLRPC = 1,
- @@ -285,11 +270,8 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd,
- struct obd_uuid *cluuid);
- int class_disconnect(struct obd_export *exp);
- void class_fail_export(struct obd_export *exp);
- -int class_connected_export(struct obd_export *exp);
- void class_disconnect_exports(struct obd_device *obddev);
- int class_manual_cleanup(struct obd_device *obd);
- -void class_disconnect_stale_exports(struct obd_device *,
- - int (*test_export)(struct obd_export *));
- static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
- {
- return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
- @@ -301,22 +283,11 @@ static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
- struct inode;
- struct lu_attr;
- struct obdo;
- -void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid);
- -void la_from_obdo(struct lu_attr *la, struct obdo *dst, u32 valid);
- void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid);
- -void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid);
- -void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid);
- void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj);
- -void obdo_from_iattr(struct obdo *oa, struct iattr *attr,
- - unsigned int ia_valid);
- void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid);
- void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid);
- -void obdo_from_md(struct obdo *oa, struct md_op_data *op_data,
- - unsigned int valid);
- -
- -void obdo_cpu_to_le(struct obdo *dobdo, struct obdo *sobdo);
- -void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo);
- #define OBT(dev) (dev)->obd_type
- #define OBP(dev, op) (dev)->obd_type->typ_dt_ops->o_ ## op
- diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
- index ac79db952da7..a78c4a4c9bd4 100644
- --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
- +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
- @@ -71,11 +71,6 @@ struct ldlm_cb_async_args {
- static struct ldlm_state *ldlm_state;
- -inline unsigned long round_timeout(unsigned long timeout)
- -{
- - return cfs_time_seconds((int)cfs_duration_sec(cfs_time_sub(timeout, 0)) + 1);
- -}
- -
- #define ELT_STOPPED 0
- #define ELT_READY 1
- #define ELT_TERMINATE 2
- diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c b/drivers/staging/lustre/lustre/obdclass/acl.c
- index 933456c502d1..1dace1419530 100644
- --- a/drivers/staging/lustre/lustre/obdclass/acl.c
- +++ b/drivers/staging/lustre/lustre/obdclass/acl.c
- @@ -287,125 +287,6 @@ again:
- }
- /*
- - * Merge the posix ACL and the extended ACL into new posix ACL.
- - */
- -int lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size,
- - ext_acl_xattr_header *ext_header,
- - posix_acl_xattr_header **out)
- -{
- - int posix_count, posix_size, i, j;
- - int ext_count = le32_to_cpu(ext_header->a_count), pos = 0, rc = 0;
- - posix_acl_xattr_entry pe = {ACL_MASK, 0, ACL_UNDEFINED_ID};
- - posix_acl_xattr_header *new;
- - ext_acl_xattr_entry *ee, ae;
- -
- - lustre_posix_acl_cpu_to_le(&pe, &pe);
- - ee = lustre_ext_acl_xattr_search(ext_header, &pe, &pos);
- - if (ee == NULL || le32_to_cpu(ee->e_stat) == ES_DEL) {
- - /* there are only base ACL entries at most. */
- - posix_count = 3;
- - posix_size = CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr);
- - new = kzalloc(posix_size, GFP_NOFS);
- - if (unlikely(new == NULL))
- - return -ENOMEM;
- -
- - new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
- - for (i = 0, j = 0; i < ext_count; i++) {
- - lustre_ext_acl_le_to_cpu(&ae,
- - &ext_header->a_entries[i]);
- - switch (ae.e_tag) {
- - case ACL_USER_OBJ:
- - case ACL_GROUP_OBJ:
- - case ACL_OTHER:
- - if (ae.e_id != ACL_UNDEFINED_ID) {
- - rc = -EIO;
- - goto _out;
- - }
- -
- - if (ae.e_stat != ES_DEL) {
- - new->a_entries[j].e_tag =
- - ext_header->a_entries[i].e_tag;
- - new->a_entries[j].e_perm =
- - ext_header->a_entries[i].e_perm;
- - new->a_entries[j++].e_id =
- - ext_header->a_entries[i].e_id;
- - }
- - break;
- - case ACL_MASK:
- - case ACL_USER:
- - case ACL_GROUP:
- - if (ae.e_stat == ES_DEL)
- - break;
- - default:
- - rc = -EIO;
- - goto _out;
- - }
- - }
- - } else {
- - /* maybe there are valid ACL_USER or ACL_GROUP entries in the
- - * original server-side ACL, they are regarded as ES_UNC stat.*/
- - int ori_posix_count;
- -
- - if (unlikely(size < 0))
- - return -EINVAL;
- - else if (!size)
- - ori_posix_count = 0;
- - else
- - ori_posix_count =
- - CFS_ACL_XATTR_COUNT(size, posix_acl_xattr);
- - posix_count = ori_posix_count + ext_count;
- - posix_size =
- - CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr);
- - new = kzalloc(posix_size, GFP_NOFS);
- - if (unlikely(new == NULL))
- - return -ENOMEM;
- -
- - new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
- - /* 1. process the unchanged ACL entries
- - * in the original server-side ACL. */
- - pos = 0;
- - for (i = 0, j = 0; i < ori_posix_count; i++) {
- - ee = lustre_ext_acl_xattr_search(ext_header,
- - &posix_header->a_entries[i], &pos);
- - if (ee == NULL)
- - memcpy(&new->a_entries[j++],
- - &posix_header->a_entries[i],
- - sizeof(posix_acl_xattr_entry));
- - }
- -
- - /* 2. process the non-deleted entries
- - * from client-side extended ACL. */
- - for (i = 0; i < ext_count; i++) {
- - if (le16_to_cpu(ext_header->a_entries[i].e_stat) !=
- - ES_DEL) {
- - new->a_entries[j].e_tag =
- - ext_header->a_entries[i].e_tag;
- - new->a_entries[j].e_perm =
- - ext_header->a_entries[i].e_perm;
- - new->a_entries[j++].e_id =
- - ext_header->a_entries[i].e_id;
- - }
- - }
- - }
- -
- - /* free unused space. */
- - rc = lustre_posix_acl_xattr_reduce_space(&new, posix_count, j);
- - if (rc >= 0) {
- - posix_size = rc;
- - *out = new;
- - rc = 0;
- - }
- -
- -_out:
- - if (rc) {
- - kfree(new);
- - posix_size = rc;
- - }
- - return posix_size;
- -}
- -EXPORT_SYMBOL(lustre_acl_xattr_merge2posix);
- -
- -/*
- * Merge the posix ACL and the extended ACL into new extended ACL.
- */
- ext_acl_xattr_header *
- diff --git a/drivers/staging/lustre/lustre/obdclass/capa.c b/drivers/staging/lustre/lustre/obdclass/capa.c
- index 99af0176f413..1b2393a739a6 100644
- --- a/drivers/staging/lustre/lustre/obdclass/capa.c
- +++ b/drivers/staging/lustre/lustre/obdclass/capa.c
- @@ -65,9 +65,6 @@ DEFINE_SPINLOCK(capa_lock);
- struct list_head capa_list[CAPA_SITE_MAX];
- -static struct capa_hmac_alg capa_hmac_algs[] = {
- - DEF_CAPA_HMAC_ALG("sha1", SHA1, 20, 20),
- -};
- /* capa count */
- int capa_count[CAPA_SITE_MAX] = { 0, };
- @@ -76,326 +73,6 @@ EXPORT_SYMBOL(capa_list);
- EXPORT_SYMBOL(capa_lock);
- EXPORT_SYMBOL(capa_count);
- -static inline
- -unsigned int ll_crypto_tfm_alg_min_keysize(struct crypto_blkcipher *tfm)
- -{
- - return crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher.min_keysize;
- -}
- -
- -struct hlist_head *init_capa_hash(void)
- -{
- - struct hlist_head *hash;
- - int nr_hash, i;
- -
- - hash = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS);
- - if (!hash)
- - return NULL;
- -
- - nr_hash = PAGE_CACHE_SIZE / sizeof(struct hlist_head);
- - LASSERT(nr_hash > NR_CAPAHASH);
- -
- - for (i = 0; i < NR_CAPAHASH; i++)
- - INIT_HLIST_HEAD(hash + i);
- - return hash;
- -}
- -EXPORT_SYMBOL(init_capa_hash);
- -
- -static inline int capa_on_server(struct obd_capa *ocapa)
- -{
- - return ocapa->c_site == CAPA_SITE_SERVER;
- -}
- -
- -static inline void capa_delete(struct obd_capa *ocapa)
- -{
- - LASSERT(capa_on_server(ocapa));
- - hlist_del_init(&ocapa->u.tgt.c_hash);
- - list_del_init(&ocapa->c_list);
- - capa_count[ocapa->c_site]--;
- - /* release the ref when alloc */
- - capa_put(ocapa);
- -}
- -
- -void cleanup_capa_hash(struct hlist_head *hash)
- -{
- - int i;
- - struct hlist_node *next;
- - struct obd_capa *oc;
- -
- - spin_lock(&capa_lock);
- - for (i = 0; i < NR_CAPAHASH; i++) {
- - hlist_for_each_entry_safe(oc, next, hash + i,
- - u.tgt.c_hash)
- - capa_delete(oc);
- - }
- - spin_unlock(&capa_lock);
- -
- - kfree(hash);
- -}
- -EXPORT_SYMBOL(cleanup_capa_hash);
- -
- -static inline int capa_hashfn(struct lu_fid *fid)
- -{
- - return (fid_oid(fid) ^ fid_ver(fid)) *
- - (unsigned long)(fid_seq(fid) + 1) % NR_CAPAHASH;
- -}
- -
- -/* capa renewal time check is earlier than that on client, which is to prevent
- - * client renew right after obtaining it. */
- -static inline int capa_is_to_expire(struct obd_capa *oc)
- -{
- - return time_before(cfs_time_sub(oc->c_expiry,
- - cfs_time_seconds(oc->c_capa.lc_timeout)*2/3),
- - cfs_time_current());
- -}
- -
- -static struct obd_capa *find_capa(struct lustre_capa *capa,
- - struct hlist_head *head, int alive)
- -{
- - struct obd_capa *ocapa;
- - int len = alive ? offsetof(struct lustre_capa, lc_keyid):sizeof(*capa);
- -
- - hlist_for_each_entry(ocapa, head, u.tgt.c_hash) {
- - if (memcmp(&ocapa->c_capa, capa, len))
- - continue;
- - /* don't return one that will expire soon in this case */
- - if (alive && capa_is_to_expire(ocapa))
- - continue;
- -
- - LASSERT(capa_on_server(ocapa));
- -
- - DEBUG_CAPA(D_SEC, &ocapa->c_capa, "found");
- - return ocapa;
- - }
- -
- - return NULL;
- -}
- -
- -#define LRU_CAPA_DELETE_COUNT 12
- -static inline void capa_delete_lru(struct list_head *head)
- -{
- - struct obd_capa *ocapa;
- - struct list_head *node = head->next;
- - int count = 0;
- -
- - /* free LRU_CAPA_DELETE_COUNT unused capa from head */
- - while (count++ < LRU_CAPA_DELETE_COUNT) {
- - ocapa = list_entry(node, struct obd_capa, c_list);
- - node = node->next;
- - if (atomic_read(&ocapa->c_refc))
- - continue;
- -
- - DEBUG_CAPA(D_SEC, &ocapa->c_capa, "free lru");
- - capa_delete(ocapa);
- - }
- -}
- -
- -/* add or update */
- -struct obd_capa *capa_add(struct hlist_head *hash, struct lustre_capa *capa)
- -{
- - struct hlist_head *head = hash + capa_hashfn(&capa->lc_fid);
- - struct obd_capa *ocapa, *old = NULL;
- - struct list_head *list = &capa_list[CAPA_SITE_SERVER];
- -
- - ocapa = alloc_capa(CAPA_SITE_SERVER);
- - if (IS_ERR(ocapa))
- - return NULL;
- -
- - spin_lock(&capa_lock);
- - old = find_capa(capa, head, 0);
- - if (!old) {
- - ocapa->c_capa = *capa;
- - set_capa_expiry(ocapa);
- - hlist_add_head(&ocapa->u.tgt.c_hash, head);
- - list_add_tail(&ocapa->c_list, list);
- - capa_get(ocapa);
- - capa_count[CAPA_SITE_SERVER]++;
- - if (capa_count[CAPA_SITE_SERVER] > CAPA_HASH_SIZE)
- - capa_delete_lru(list);
- - spin_unlock(&capa_lock);
- - return ocapa;
- - }
- - capa_get(old);
- - spin_unlock(&capa_lock);
- - capa_put(ocapa);
- - return old;
- -}
- -EXPORT_SYMBOL(capa_add);
- -
- -struct obd_capa *capa_lookup(struct hlist_head *hash, struct lustre_capa *capa,
- - int alive)
- -{
- - struct obd_capa *ocapa;
- -
- - spin_lock(&capa_lock);
- - ocapa = find_capa(capa, hash + capa_hashfn(&capa->lc_fid), alive);
- - if (ocapa) {
- - list_move_tail(&ocapa->c_list,
- - &capa_list[CAPA_SITE_SERVER]);
- - capa_get(ocapa);
- - }
- - spin_unlock(&capa_lock);
- -
- - return ocapa;
- -}
- -EXPORT_SYMBOL(capa_lookup);
- -
- -static inline int ll_crypto_hmac(struct crypto_hash *tfm,
- - u8 *key, unsigned int *keylen,
- - struct scatterlist *sg,
- - unsigned int size, u8 *result)
- -{
- - struct hash_desc desc;
- - int rv;
- - desc.tfm = tfm;
- - desc.flags = 0;
- - rv = crypto_hash_setkey(desc.tfm, key, *keylen);
- - if (rv) {
- - CERROR("failed to hash setkey: %d\n", rv);
- - return rv;
- - }
- - return crypto_hash_digest(&desc, sg, size, result);
- -}
- -
- -int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key)
- -{
- - struct crypto_hash *tfm;
- - struct capa_hmac_alg *alg;
- - int keylen;
- - struct scatterlist sl;
- -
- - if (capa_alg(capa) != CAPA_HMAC_ALG_SHA1) {
- - CERROR("unknown capability hmac algorithm!\n");
- - return -EFAULT;
- - }
- -
- - alg = &capa_hmac_algs[capa_alg(capa)];
- -
- - tfm = crypto_alloc_hash(alg->ha_name, 0, 0);
- - if (IS_ERR(tfm)) {
- - CERROR("crypto_alloc_tfm failed, check whether your kernel has crypto support!\n");
- - return PTR_ERR(tfm);
- - }
- - keylen = alg->ha_keylen;
- -
- - sg_init_table(&sl, 1);
- - sg_set_page(&sl, virt_to_page(capa),
- - offsetof(struct lustre_capa, lc_hmac),
- - (unsigned long)(capa) % PAGE_CACHE_SIZE);
- -
- - ll_crypto_hmac(tfm, key, &keylen, &sl, sl.length, hmac);
- - crypto_free_hash(tfm);
- -
- - return 0;
- -}
- -EXPORT_SYMBOL(capa_hmac);
- -
- -int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
- -{
- - struct crypto_blkcipher *tfm;
- - struct scatterlist sd;
- - struct scatterlist ss;
- - struct blkcipher_desc desc;
- - unsigned int min;
- - int rc;
- - char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
- -
- - /* passing "aes" in a variable instead of a constant string keeps gcc
- - * 4.3.2 happy */
- - tfm = crypto_alloc_blkcipher(alg, 0, 0);
- - if (IS_ERR(tfm)) {
- - CERROR("failed to load transform for aes\n");
- - return PTR_ERR(tfm);
- - }
- -
- - min = ll_crypto_tfm_alg_min_keysize(tfm);
- - if (keylen < min) {
- - CERROR("keylen at least %d bits for aes\n", min * 8);
- - rc = -EINVAL;
- - goto out;
- - }
- -
- - rc = crypto_blkcipher_setkey(tfm, key, min);
- - if (rc) {
- - CERROR("failed to setting key for aes\n");
- - goto out;
- - }
- -
- - sg_init_table(&sd, 1);
- - sg_set_page(&sd, virt_to_page(d), 16,
- - (unsigned long)(d) % PAGE_CACHE_SIZE);
- -
- - sg_init_table(&ss, 1);
- - sg_set_page(&ss, virt_to_page(s), 16,
- - (unsigned long)(s) % PAGE_CACHE_SIZE);
- - desc.tfm = tfm;
- - desc.info = NULL;
- - desc.flags = 0;
- - rc = crypto_blkcipher_encrypt(&desc, &sd, &ss, 16);
- - if (rc) {
- - CERROR("failed to encrypt for aes\n");
- - goto out;
- - }
- -
- -out:
- - crypto_free_blkcipher(tfm);
- - return rc;
- -}
- -EXPORT_SYMBOL(capa_encrypt_id);
- -
- -int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
- -{
- - struct crypto_blkcipher *tfm;
- - struct scatterlist sd;
- - struct scatterlist ss;
- - struct blkcipher_desc desc;
- - unsigned int min;
- - int rc;
- - char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
- -
- - /* passing "aes" in a variable instead of a constant string keeps gcc
- - * 4.3.2 happy */
- - tfm = crypto_alloc_blkcipher(alg, 0, 0);
- - if (IS_ERR(tfm)) {
- - CERROR("failed to load transform for aes\n");
- - return PTR_ERR(tfm);
- - }
- -
- - min = ll_crypto_tfm_alg_min_keysize(tfm);
- - if (keylen < min) {
- - CERROR("keylen at least %d bits for aes\n", min * 8);
- - rc = -EINVAL;
- - goto out;
- - }
- -
- - rc = crypto_blkcipher_setkey(tfm, key, min);
- - if (rc) {
- - CERROR("failed to setting key for aes\n");
- - goto out;
- - }
- -
- - sg_init_table(&sd, 1);
- - sg_set_page(&sd, virt_to_page(d), 16,
- - (unsigned long)(d) % PAGE_CACHE_SIZE);
- -
- - sg_init_table(&ss, 1);
- - sg_set_page(&ss, virt_to_page(s), 16,
- - (unsigned long)(s) % PAGE_CACHE_SIZE);
- -
- - desc.tfm = tfm;
- - desc.info = NULL;
- - desc.flags = 0;
- - rc = crypto_blkcipher_decrypt(&desc, &sd, &ss, 16);
- - if (rc) {
- - CERROR("failed to decrypt for aes\n");
- - goto out;
- - }
- -
- -out:
- - crypto_free_blkcipher(tfm);
- - return rc;
- -}
- -EXPORT_SYMBOL(capa_decrypt_id);
- -
- void capa_cpy(void *capa, struct obd_capa *ocapa)
- {
- spin_lock(&ocapa->c_lock);
- diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c
- index da0066a20fa0..a822a0b3464e 100644
- --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c
- +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c
- @@ -1181,32 +1181,6 @@ void cl_page_list_fini(const struct lu_env *env, struct cl_page_list *plist)
- EXPORT_SYMBOL(cl_page_list_fini);
- /**
- - * Owns all pages in a queue.
- - */
- -int cl_page_list_own(const struct lu_env *env,
- - struct cl_io *io, struct cl_page_list *plist)
- -{
- - struct cl_page *page;
- - struct cl_page *temp;
- - pgoff_t index = 0;
- - int result;
- -
- - LINVRNT(plist->pl_owner == current);
- -
- - result = 0;
- - cl_page_list_for_each_safe(page, temp, plist) {
- - LASSERT(index <= page->cp_index);
- - index = page->cp_index;
- - if (cl_page_own(env, io, page) == 0)
- - result = result ?: page->cp_error;
- - else
- - cl_page_list_del(env, plist, page);
- - }
- - return result;
- -}
- -EXPORT_SYMBOL(cl_page_list_own);
- -
- -/**
- * Assumes all pages in a queue.
- */
- void cl_page_list_assume(const struct lu_env *env,
- @@ -1236,26 +1210,6 @@ void cl_page_list_discard(const struct lu_env *env, struct cl_io *io,
- EXPORT_SYMBOL(cl_page_list_discard);
- /**
- - * Unmaps all pages in a queue from user virtual memory.
- - */
- -int cl_page_list_unmap(const struct lu_env *env, struct cl_io *io,
- - struct cl_page_list *plist)
- -{
- - struct cl_page *page;
- - int result;
- -
- - LINVRNT(plist->pl_owner == current);
- - result = 0;
- - cl_page_list_for_each(page, plist) {
- - result = cl_page_unmap(env, io, page);
- - if (result != 0)
- - break;
- - }
- - return result;
- -}
- -EXPORT_SYMBOL(cl_page_list_unmap);
- -
- -/**
- * Initialize dual page queue.
- */
- void cl_2queue_init(struct cl_2queue *queue)
- @@ -1297,17 +1251,6 @@ void cl_2queue_discard(const struct lu_env *env,
- EXPORT_SYMBOL(cl_2queue_discard);
- /**
- - * Assume to own the pages in cl_2queue
- - */
- -void cl_2queue_assume(const struct lu_env *env,
- - struct cl_io *io, struct cl_2queue *queue)
- -{
- - cl_page_list_assume(env, io, &queue->c2_qin);
- - cl_page_list_assume(env, io, &queue->c2_qout);
- -}
- -EXPORT_SYMBOL(cl_2queue_assume);
- -
- -/**
- * Finalize both page lists of a 2-queue.
- */
- void cl_2queue_fini(const struct lu_env *env, struct cl_2queue *queue)
- @@ -1341,14 +1284,6 @@ struct cl_io *cl_io_top(struct cl_io *io)
- EXPORT_SYMBOL(cl_io_top);
- /**
- - * Prints human readable representation of \a io to the \a f.
- - */
- -void cl_io_print(const struct lu_env *env, void *cookie,
- - lu_printer_t printer, const struct cl_io *io)
- -{
- -}
- -
- -/**
- * Adds request slice to the compound request.
- *
- * This is called by cl_device_operations::cdo_req_init() methods to add a
- diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
- index 7c6583a2e884..80cb8c928fda 100644
- --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c
- +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
- @@ -552,6 +552,8 @@ static struct cl_lock *cl_lock_find(const struct lu_env *env,
- return lock;
- }
- +static int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock);
- +
- /**
- * Returns existing lock matching given description. This is similar to
- * cl_lock_find() except that no new lock is created, and returned lock is
- @@ -920,7 +922,7 @@ EXPORT_SYMBOL(cl_lock_hold_release);
- *
- * \see cl_lock_signal()
- */
- -int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock)
- +static int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock)
- {
- wait_queue_t waiter;
- sigset_t blocked;
- @@ -964,7 +966,6 @@ int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock)
- }
- return result;
- }
- -EXPORT_SYMBOL(cl_lock_state_wait);
- static void cl_lock_state_signal(const struct lu_env *env, struct cl_lock *lock,
- enum cl_lock_state state)
- @@ -1276,32 +1277,6 @@ static int cl_enqueue_locked(const struct lu_env *env, struct cl_lock *lock,
- }
- /**
- - * Enqueues a lock.
- - *
- - * \pre current thread or io owns a hold on lock.
- - *
- - * \post ergo(result == 0, lock->users increased)
- - * \post ergo(result == 0, lock->cll_state == CLS_ENQUEUED ||
- - * lock->cll_state == CLS_HELD)
- - */
- -int cl_enqueue(const struct lu_env *env, struct cl_lock *lock,
- - struct cl_io *io, __u32 enqflags)
- -{
- - int result;
- -
- - cl_lock_lockdep_acquire(env, lock, enqflags);
- - cl_lock_mutex_get(env, lock);
- - result = cl_enqueue_locked(env, lock, io, enqflags);
- - cl_lock_mutex_put(env, lock);
- - if (result != 0)
- - cl_lock_lockdep_release(env, lock);
- - LASSERT(ergo(result == 0, lock->cll_state == CLS_ENQUEUED ||
- - lock->cll_state == CLS_HELD));
- - return result;
- -}
- -EXPORT_SYMBOL(cl_enqueue);
- -
- -/**
- * Tries to unlock a lock.
- *
- * This function is called to release underlying resource:
- @@ -1588,6 +1563,9 @@ void cl_lock_closure_init(const struct lu_env *env,
- }
- EXPORT_SYMBOL(cl_lock_closure_init);
- +static int cl_lock_enclosure(const struct lu_env *env, struct cl_lock *lock,
- + struct cl_lock_closure *closure);
- +
- /**
- * Builds a closure of \a lock.
- *
- @@ -1631,7 +1609,7 @@ EXPORT_SYMBOL(cl_lock_closure_build);
- * once). If try-lock failed, returns CLO_REPEAT, after optionally waiting
- * until next try-lock is likely to succeed.
- */
- -int cl_lock_enclosure(const struct lu_env *env, struct cl_lock *lock,
- +static int cl_lock_enclosure(const struct lu_env *env, struct cl_lock *lock,
- struct cl_lock_closure *closure)
- {
- int result = 0;
- @@ -1669,7 +1647,6 @@ int cl_lock_enclosure(const struct lu_env *env, struct cl_lock *lock,
- }
- return result;
- }
- -EXPORT_SYMBOL(cl_lock_enclosure);
- /** Releases mutices of enclosed locks. */
- void cl_lock_disclosure(const struct lu_env *env,
- diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c
- index 05e29f815b87..89ff7f1fb0fc 100644
- --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
- +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
- @@ -98,16 +98,6 @@ int cl_object_header_init(struct cl_object_header *h)
- EXPORT_SYMBOL(cl_object_header_init);
- /**
- - * Finalize cl_object_header.
- - */
- -void cl_object_header_fini(struct cl_object_header *h)
- -{
- - LASSERT(list_empty(&h->coh_locks));
- - lu_object_header_fini(&h->coh_lu);
- -}
- -EXPORT_SYMBOL(cl_object_header_fini);
- -
- -/**
- * Returns a cl_object with a given \a fid.
- *
- * Returns either cached or newly created object. Additional reference on the
- @@ -363,22 +353,6 @@ void cl_object_prune(const struct lu_env *env, struct cl_object *obj)
- }
- EXPORT_SYMBOL(cl_object_prune);
- -/**
- - * Check if the object has locks.
- - */
- -int cl_object_has_locks(struct cl_object *obj)
- -{
- - struct cl_object_header *head = cl_object_header(obj);
- - int has;
- -
- - spin_lock(&head->coh_lock_guard);
- - has = list_empty(&head->coh_locks);
- - spin_unlock(&head->coh_lock_guard);
- -
- - return (has == 0);
- -}
- -EXPORT_SYMBOL(cl_object_has_locks);
- -
- void cache_stats_init(struct cache_stats *cs, const char *name)
- {
- int i;
- @@ -929,21 +903,6 @@ void cl_env_nested_put(struct cl_env_nest *nest, struct lu_env *env)
- EXPORT_SYMBOL(cl_env_nested_put);
- /**
- - * Converts struct cl_attr to struct ost_lvb.
- - *
- - * \see cl_lvb2attr
- - */
- -void cl_attr2lvb(struct ost_lvb *lvb, const struct cl_attr *attr)
- -{
- - lvb->lvb_size = attr->cat_size;
- - lvb->lvb_mtime = attr->cat_mtime;
- - lvb->lvb_atime = attr->cat_atime;
- - lvb->lvb_ctime = attr->cat_ctime;
- - lvb->lvb_blocks = attr->cat_blocks;
- -}
- -EXPORT_SYMBOL(cl_attr2lvb);
- -
- -/**
- * Converts struct ost_lvb to struct cl_attr.
- *
- * \see cl_attr2lvb
- diff --git a/drivers/staging/lustre/lustre/obdclass/debug.c b/drivers/staging/lustre/lustre/obdclass/debug.c
- index c61add46b426..43a7f7a79b35 100644
- --- a/drivers/staging/lustre/lustre/obdclass/debug.c
- +++ b/drivers/staging/lustre/lustre/obdclass/debug.c
- @@ -46,16 +46,6 @@
- #include "../include/lustre_debug.h"
- #include "../include/lustre_net.h"
- -void dump_lniobuf(struct niobuf_local *nb)
- -{
- - CDEBUG(D_RPCTRACE,
- - "niobuf_local: file_offset=%lld, len=%d, page=%p, rc=%d\n",
- - nb->lnb_file_offset, nb->len, nb->page, nb->rc);
- - CDEBUG(D_RPCTRACE, "nb->page: index = %ld\n",
- - nb->page ? page_index(nb->page) : -1);
- -}
- -EXPORT_SYMBOL(dump_lniobuf);
- -
- #define LPDS sizeof(__u64)
- int block_debug_setup(void *addr, int len, __u64 off, __u64 id)
- {
- diff --git a/drivers/staging/lustre/lustre/obdclass/dt_object.c b/drivers/staging/lustre/lustre/obdclass/dt_object.c
- index 6b645a15d7a5..a2ccf580dafc 100644
- --- a/drivers/staging/lustre/lustre/obdclass/dt_object.c
- +++ b/drivers/staging/lustre/lustre/obdclass/dt_object.c
- @@ -49,1005 +49,4 @@
- /* fid_be_to_cpu() */
- #include "../include/lustre_fid.h"
- -/* context key constructor/destructor: dt_global_key_init, dt_global_key_fini */
- -LU_KEY_INIT(dt_global, struct dt_thread_info);
- -LU_KEY_FINI(dt_global, struct dt_thread_info);
- -struct lu_context_key dt_key = {
- - .lct_tags = LCT_MD_THREAD | LCT_DT_THREAD | LCT_MG_THREAD | LCT_LOCAL,
- - .lct_init = dt_global_key_init,
- - .lct_fini = dt_global_key_fini
- -};
- -EXPORT_SYMBOL(dt_key);
- -
- -/* no lock is necessary to protect the list, because call-backs
- - * are added during system startup. Please refer to "struct dt_device".
- - */
- -void dt_txn_callback_add(struct dt_device *dev, struct dt_txn_callback *cb)
- -{
- - list_add(&cb->dtc_linkage, &dev->dd_txn_callbacks);
- -}
- -EXPORT_SYMBOL(dt_txn_callback_add);
- -
- -void dt_txn_callback_del(struct dt_device *dev, struct dt_txn_callback *cb)
- -{
- - list_del_init(&cb->dtc_linkage);
- -}
- -EXPORT_SYMBOL(dt_txn_callback_del);
- -
- -int dt_txn_hook_start(const struct lu_env *env,
- - struct dt_device *dev, struct thandle *th)
- -{
- - int rc = 0;
- - struct dt_txn_callback *cb;
- -
- - if (th->th_local)
- - return 0;
- -
- - list_for_each_entry(cb, &dev->dd_txn_callbacks, dtc_linkage) {
- - if (cb->dtc_txn_start == NULL ||
- - !(cb->dtc_tag & env->le_ctx.lc_tags))
- - continue;
- - rc = cb->dtc_txn_start(env, th, cb->dtc_cookie);
- - if (rc < 0)
- - break;
- - }
- - return rc;
- -}
- -EXPORT_SYMBOL(dt_txn_hook_start);
- -
- -int dt_txn_hook_stop(const struct lu_env *env, struct thandle *txn)
- -{
- - struct dt_device *dev = txn->th_dev;
- - struct dt_txn_callback *cb;
- - int rc = 0;
- -
- - if (txn->th_local)
- - return 0;
- -
- - list_for_each_entry(cb, &dev->dd_txn_callbacks, dtc_linkage) {
- - if (cb->dtc_txn_stop == NULL ||
- - !(cb->dtc_tag & env->le_ctx.lc_tags))
- - continue;
- - rc = cb->dtc_txn_stop(env, txn, cb->dtc_cookie);
- - if (rc < 0)
- - break;
- - }
- - return rc;
- -}
- -EXPORT_SYMBOL(dt_txn_hook_stop);
- -
- -void dt_txn_hook_commit(struct thandle *txn)
- -{
- - struct dt_txn_callback *cb;
- -
- - if (txn->th_local)
- - return;
- -
- - list_for_each_entry(cb, &txn->th_dev->dd_txn_callbacks,
- - dtc_linkage) {
- - if (cb->dtc_txn_commit)
- - cb->dtc_txn_commit(txn, cb->dtc_cookie);
- - }
- -}
- -EXPORT_SYMBOL(dt_txn_hook_commit);
- -
- -int dt_device_init(struct dt_device *dev, struct lu_device_type *t)
- -{
- -
- - INIT_LIST_HEAD(&dev->dd_txn_callbacks);
- - return lu_device_init(&dev->dd_lu_dev, t);
- -}
- -EXPORT_SYMBOL(dt_device_init);
- -
- -void dt_device_fini(struct dt_device *dev)
- -{
- - lu_device_fini(&dev->dd_lu_dev);
- -}
- -EXPORT_SYMBOL(dt_device_fini);
- -
- -int dt_object_init(struct dt_object *obj,
- - struct lu_object_header *h, struct lu_device *d)
- -
- -{
- - return lu_object_init(&obj->do_lu, h, d);
- -}
- -EXPORT_SYMBOL(dt_object_init);
- -
- -void dt_object_fini(struct dt_object *obj)
- -{
- - lu_object_fini(&obj->do_lu);
- -}
- -EXPORT_SYMBOL(dt_object_fini);
- -
- -int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj)
- -{
- - if (obj->do_index_ops == NULL)
- - obj->do_ops->do_index_try(env, obj, &dt_directory_features);
- - return obj->do_index_ops != NULL;
- -}
- -EXPORT_SYMBOL(dt_try_as_dir);
- -
- -enum dt_format_type dt_mode_to_dft(__u32 mode)
- -{
- - enum dt_format_type result;
- -
- - switch (mode & S_IFMT) {
- - case S_IFDIR:
- - result = DFT_DIR;
- - break;
- - case S_IFREG:
- - result = DFT_REGULAR;
- - break;
- - case S_IFLNK:
- - result = DFT_SYM;
- - break;
- - case S_IFCHR:
- - case S_IFBLK:
- - case S_IFIFO:
- - case S_IFSOCK:
- - result = DFT_NODE;
- - break;
- - default:
- - LBUG();
- - break;
- - }
- - return result;
- -}
- -EXPORT_SYMBOL(dt_mode_to_dft);
- -
- -/**
- - * lookup fid for object named \a name in directory \a dir.
- - */
- -
- -int dt_lookup_dir(const struct lu_env *env, struct dt_object *dir,
- - const char *name, struct lu_fid *fid)
- -{
- - if (dt_try_as_dir(env, dir))
- - return dt_lookup(env, dir, (struct dt_rec *)fid,
- - (const struct dt_key *)name, BYPASS_CAPA);
- - return -ENOTDIR;
- -}
- -EXPORT_SYMBOL(dt_lookup_dir);
- -
- -/* this differs from dt_locate by top_dev as parameter
- - * but not one from lu_site */
- -struct dt_object *dt_locate_at(const struct lu_env *env,
- - struct dt_device *dev, const struct lu_fid *fid,
- - struct lu_device *top_dev)
- -{
- - struct lu_object *lo, *n;
- -
- - lo = lu_object_find_at(env, top_dev, fid, NULL);
- - if (IS_ERR(lo))
- - return (void *)lo;
- -
- - LASSERT(lo != NULL);
- -
- - list_for_each_entry(n, &lo->lo_header->loh_layers, lo_linkage) {
- - if (n->lo_dev == &dev->dd_lu_dev)
- - return container_of0(n, struct dt_object, do_lu);
- - }
- - return ERR_PTR(-ENOENT);
- -}
- -EXPORT_SYMBOL(dt_locate_at);
- -
- -/**
- - * find a 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 result;
- -
- - result = dt_lookup_dir(env, obj, entry, fid);
- - lu_object_put(env, &obj->do_lu);
- - if (result == 0) {
- - obj = dt_locate(env, dt, fid);
- - if (IS_ERR(obj))
- - result = PTR_ERR(obj);
- - }
- - dfh->dfh_o = obj;
- - return result;
- -}
- -
- -/**
- - * 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;
- - char *local = info->dti_buf;
- - int result;
- -
- -
- - dfh->dfh_dt = dt;
- - dfh->dfh_fid = fid;
- -
- - strncpy(local, path, DT_MAX_PATH);
- - local[DT_MAX_PATH - 1] = '\0';
- -
- - 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, local, dt_find_entry, dfh);
- - if (result != 0)
- - obj = ERR_PTR(result);
- - else
- - obj = dfh->dfh_o;
- - }
- - } else {
- - obj = ERR_PTR(result);
- - }
- - return obj;
- -}
- -EXPORT_SYMBOL(dt_store_resolve);
- -
- -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);
- - lu_object_put(env, &dir->do_lu);
- - } else {
- - file = dir;
- - }
- - return file;
- -}
- -EXPORT_SYMBOL(dt_store_open);
- -
- -struct dt_object *dt_find_or_create(const struct lu_env *env,
- - struct dt_device *dt,
- - const struct lu_fid *fid,
- - struct dt_object_format *dof,
- - struct lu_attr *at)
- -{
- - struct dt_object *dto;
- - struct thandle *th;
- - int rc;
- -
- - dto = dt_locate(env, dt, fid);
- - if (IS_ERR(dto))
- - return dto;
- -
- - LASSERT(dto != NULL);
- - if (dt_object_exists(dto))
- - return dto;
- -
- - th = dt_trans_create(env, dt);
- - if (IS_ERR(th)) {
- - rc = PTR_ERR(th);
- - goto out;
- - }
- -
- - rc = dt_declare_create(env, dto, at, NULL, dof, th);
- - if (rc)
- - goto trans_stop;
- -
- - rc = dt_trans_start_local(env, dt, th);
- - if (rc)
- - goto trans_stop;
- -
- - dt_write_lock(env, dto, 0);
- - if (dt_object_exists(dto)) {
- - rc = 0;
- - goto unlock;
- - }
- -
- - CDEBUG(D_OTHER, "create new object "DFID"\n", PFID(fid));
- -
- - rc = dt_create(env, dto, at, NULL, dof, th);
- - if (rc)
- - goto unlock;
- - LASSERT(dt_object_exists(dto));
- -unlock:
- - dt_write_unlock(env, dto);
- -trans_stop:
- - dt_trans_stop(env, dt, th);
- -out:
- - if (rc) {
- - lu_object_put(env, &dto->do_lu);
- - return ERR_PTR(rc);
- - }
- - return dto;
- -}
- -EXPORT_SYMBOL(dt_find_or_create);
- -
- -/* dt class init function. */
- -int dt_global_init(void)
- -{
- - LU_CONTEXT_KEY_INIT(&dt_key);
- - return lu_context_key_register(&dt_key);
- -}
- -
- -void dt_global_fini(void)
- -{
- - lu_context_key_degister(&dt_key);
- -}
- -
- -/**
- - * Generic read helper. May return an error for partial reads.
- - *
- - * \param env lustre environment
- - * \param dt object to be read
- - * \param buf lu_buf to be filled, with buffer pointer and length
- - * \param pos position to start reading, updated as data is read
- - *
- - * \retval real size of data read
- - * \retval -ve errno on failure
- - */
- -int dt_read(const struct lu_env *env, struct dt_object *dt,
- - struct lu_buf *buf, loff_t *pos)
- -{
- - LASSERTF(dt != NULL, "dt is NULL when we want to read record\n");
- - return dt->do_body_ops->dbo_read(env, dt, buf, pos, BYPASS_CAPA);
- -}
- -EXPORT_SYMBOL(dt_read);
- -
- -/**
- - * Read structures of fixed size from storage. Unlike dt_read(), using
- - * dt_record_read() will return an error for partial reads.
- - *
- - * \param env lustre environment
- - * \param dt object to be read
- - * \param buf lu_buf to be filled, with buffer pointer and length
- - * \param pos position to start reading, updated as data is read
- - *
- - * \retval 0 on successfully reading full buffer
- - * \retval -EFAULT on short read
- - * \retval -ve errno on failure
- - */
- -int dt_record_read(const struct lu_env *env, struct dt_object *dt,
- - struct lu_buf *buf, loff_t *pos)
- -{
- - int rc;
- -
- - LASSERTF(dt != NULL, "dt is NULL when we want to read record\n");
- -
- - rc = dt->do_body_ops->dbo_read(env, dt, buf, pos, BYPASS_CAPA);
- -
- - if (rc == buf->lb_len)
- - rc = 0;
- - else if (rc >= 0)
- - rc = -EFAULT;
- - return rc;
- -}
- -EXPORT_SYMBOL(dt_record_read);
- -
- -int dt_record_write(const struct lu_env *env, struct dt_object *dt,
- - const struct lu_buf *buf, loff_t *pos, struct thandle *th)
- -{
- - int rc;
- -
- - LASSERTF(dt != NULL, "dt is NULL when we want to write record\n");
- - LASSERT(th != NULL);
- - LASSERT(dt->do_body_ops);
- - LASSERT(dt->do_body_ops->dbo_write);
- - rc = dt->do_body_ops->dbo_write(env, dt, buf, pos, th, BYPASS_CAPA, 1);
- - if (rc == buf->lb_len)
- - rc = 0;
- - else if (rc >= 0)
- - rc = -EFAULT;
- - return rc;
- -}
- -EXPORT_SYMBOL(dt_record_write);
- -
- -int dt_declare_version_set(const struct lu_env *env, struct dt_object *o,
- - struct thandle *th)
- -{
- - struct lu_buf vbuf;
- - char *xname = XATTR_NAME_VERSION;
- -
- - LASSERT(o);
- - vbuf.lb_buf = NULL;
- - vbuf.lb_len = sizeof(dt_obj_version_t);
- - return dt_declare_xattr_set(env, o, &vbuf, xname, 0, th);
- -
- -}
- -EXPORT_SYMBOL(dt_declare_version_set);
- -
- -void dt_version_set(const struct lu_env *env, struct dt_object *o,
- - dt_obj_version_t version, struct thandle *th)
- -{
- - struct lu_buf vbuf;
- - char *xname = XATTR_NAME_VERSION;
- - int rc;
- -
- - LASSERT(o);
- - vbuf.lb_buf = &version;
- - vbuf.lb_len = sizeof(version);
- -
- - rc = dt_xattr_set(env, o, &vbuf, xname, 0, th, BYPASS_CAPA);
- - if (rc < 0)
- - CDEBUG(D_INODE, "Can't set version, rc %d\n", rc);
- - return;
- -}
- -EXPORT_SYMBOL(dt_version_set);
- -
- -dt_obj_version_t dt_version_get(const struct lu_env *env, struct dt_object *o)
- -{
- - struct lu_buf vbuf;
- - char *xname = XATTR_NAME_VERSION;
- - dt_obj_version_t version;
- - int rc;
- -
- - LASSERT(o);
- - vbuf.lb_buf = &version;
- - vbuf.lb_len = sizeof(version);
- - rc = dt_xattr_get(env, o, &vbuf, xname, BYPASS_CAPA);
- - if (rc != sizeof(version)) {
- - CDEBUG(D_INODE, "Can't get version, rc %d\n", rc);
- - version = 0;
- - }
- - return version;
- -}
- -EXPORT_SYMBOL(dt_version_get);
- -
- -/* list of all supported index types */
- -
- -/* directories */
- -const struct dt_index_features dt_directory_features;
- -EXPORT_SYMBOL(dt_directory_features);
- -
- -/* scrub iterator */
- -const struct dt_index_features dt_otable_features;
- -EXPORT_SYMBOL(dt_otable_features);
- -
- -/* lfsck */
- -const struct dt_index_features dt_lfsck_features = {
- - .dif_flags = DT_IND_UPDATE,
- - .dif_keysize_min = sizeof(struct lu_fid),
- - .dif_keysize_max = sizeof(struct lu_fid),
- - .dif_recsize_min = sizeof(__u8),
- - .dif_recsize_max = sizeof(__u8),
- - .dif_ptrsize = 4
- -};
- -EXPORT_SYMBOL(dt_lfsck_features);
- -
- -/* accounting indexes */
- -const struct dt_index_features dt_acct_features = {
- - .dif_flags = DT_IND_UPDATE,
- - .dif_keysize_min = sizeof(__u64), /* 64-bit uid/gid */
- - .dif_keysize_max = sizeof(__u64), /* 64-bit uid/gid */
- - .dif_recsize_min = sizeof(struct lquota_acct_rec), /* 16 bytes */
- - .dif_recsize_max = sizeof(struct lquota_acct_rec), /* 16 bytes */
- - .dif_ptrsize = 4
- -};
- -EXPORT_SYMBOL(dt_acct_features);
- -
- -/* global quota files */
- -const struct dt_index_features dt_quota_glb_features = {
- - .dif_flags = DT_IND_UPDATE,
- - /* a different key would have to be used for per-directory quota */
- - .dif_keysize_min = sizeof(__u64), /* 64-bit uid/gid */
- - .dif_keysize_max = sizeof(__u64), /* 64-bit uid/gid */
- - .dif_recsize_min = sizeof(struct lquota_glb_rec), /* 32 bytes */
- - .dif_recsize_max = sizeof(struct lquota_glb_rec), /* 32 bytes */
- - .dif_ptrsize = 4
- -};
- -EXPORT_SYMBOL(dt_quota_glb_features);
- -
- -/* slave quota files */
- -const struct dt_index_features dt_quota_slv_features = {
- - .dif_flags = DT_IND_UPDATE,
- - /* a different key would have to be used for per-directory quota */
- - .dif_keysize_min = sizeof(__u64), /* 64-bit uid/gid */
- - .dif_keysize_max = sizeof(__u64), /* 64-bit uid/gid */
- - .dif_recsize_min = sizeof(struct lquota_slv_rec), /* 8 bytes */
- - .dif_recsize_max = sizeof(struct lquota_slv_rec), /* 8 bytes */
- - .dif_ptrsize = 4
- -};
- -EXPORT_SYMBOL(dt_quota_slv_features);
- -
- -/* helper function returning what dt_index_features structure should be used
- - * based on the FID sequence. This is used by OBD_IDX_READ RPC */
- -static inline const struct dt_index_features *dt_index_feat_select(__u64 seq,
- - __u32 mode)
- -{
- - if (seq == FID_SEQ_QUOTA_GLB) {
- - /* global quota index */
- - if (!S_ISREG(mode))
- - /* global quota index should be a regular file */
- - return ERR_PTR(-ENOENT);
- - return &dt_quota_glb_features;
- - } else if (seq == FID_SEQ_QUOTA) {
- - /* quota slave index */
- - if (!S_ISREG(mode))
- - /* slave index should be a regular file */
- - return ERR_PTR(-ENOENT);
- - return &dt_quota_slv_features;
- - } else if (seq >= FID_SEQ_NORMAL) {
- - /* object is part of the namespace, verify that it is a
- - * directory */
- - if (!S_ISDIR(mode))
- - /* sorry, we can only deal with directory */
- - return ERR_PTR(-ENOTDIR);
- - return &dt_directory_features;
- - }
- -
- - return ERR_PTR(-EOPNOTSUPP);
- -}
- -
- -/*
- - * Fill a lu_idxpage with key/record pairs read for transfer via OBD_IDX_READ
- - * RPC
- - *
- - * \param env - is the environment passed by the caller
- - * \param lp - is a pointer to the lu_page to fill
- - * \param nob - is the maximum number of bytes that should be copied
- - * \param iops - is the index operation vector associated with the index object
- - * \param it - is a pointer to the current iterator
- - * \param attr - is the index attribute to pass to iops->rec()
- - * \param arg - is a pointer to the idx_info structure
- - */
- -static int dt_index_page_build(const struct lu_env *env, union lu_page *lp,
- - int nob, const struct dt_it_ops *iops,
- - struct dt_it *it, __u32 attr, void *arg)
- -{
- - struct idx_info *ii = (struct idx_info *)arg;
- - struct lu_idxpage *lip = &lp->lp_idx;
- - char *entry;
- - int rc, size;
- -
- - /* no support for variable key & record size for now */
- - LASSERT((ii->ii_flags & II_FL_VARKEY) == 0);
- - LASSERT((ii->ii_flags & II_FL_VARREC) == 0);
- -
- - /* initialize the header of the new container */
- - memset(lip, 0, LIP_HDR_SIZE);
- - lip->lip_magic = LIP_MAGIC;
- - nob -= LIP_HDR_SIZE;
- -
- - /* compute size needed to store a key/record pair */
- - size = ii->ii_recsize + ii->ii_keysize;
- - if ((ii->ii_flags & II_FL_NOHASH) == 0)
- - /* add hash if the client wants it */
- - size += sizeof(__u64);
- -
- - entry = lip->lip_entries;
- - do {
- - char *tmp_entry = entry;
- - struct dt_key *key;
- - __u64 hash;
- -
- - /* fetch 64-bit hash value */
- - hash = iops->store(env, it);
- - ii->ii_hash_end = hash;
- -
- - if (OBD_FAIL_CHECK(OBD_FAIL_OBD_IDX_READ_BREAK)) {
- - if (lip->lip_nr != 0) {
- - rc = 0;
- - goto out;
- - }
- - }
- -
- - if (nob < size) {
- - if (lip->lip_nr == 0)
- - rc = -EINVAL;
- - else
- - rc = 0;
- - goto out;
- - }
- -
- - if ((ii->ii_flags & II_FL_NOHASH) == 0) {
- - /* client wants to the 64-bit hash value associated with
- - * each record */
- - memcpy(tmp_entry, &hash, sizeof(hash));
- - tmp_entry += sizeof(hash);
- - }
- -
- - /* then the key value */
- - LASSERT(iops->key_size(env, it) == ii->ii_keysize);
- - key = iops->key(env, it);
- - memcpy(tmp_entry, key, ii->ii_keysize);
- - tmp_entry += ii->ii_keysize;
- -
- - /* and finally the record */
- - rc = iops->rec(env, it, (struct dt_rec *)tmp_entry, attr);
- - if (rc != -ESTALE) {
- - if (rc != 0)
- - goto out;
- -
- - /* hash/key/record successfully copied! */
- - lip->lip_nr++;
- - if (unlikely(lip->lip_nr == 1 && ii->ii_count == 0))
- - ii->ii_hash_start = hash;
- - entry = tmp_entry + ii->ii_recsize;
- - nob -= size;
- - }
- -
- - /* move on to the next record */
- - do {
- - rc = iops->next(env, it);
- - } while (rc == -ESTALE);
- -
- - } while (rc == 0);
- -
- - goto out;
- -out:
- - if (rc >= 0 && lip->lip_nr > 0)
- - /* one more container */
- - ii->ii_count++;
- - if (rc > 0)
- - /* no more entries */
- - ii->ii_hash_end = II_END_OFF;
- - return rc;
- -}
- -
- -/*
- - * Walk index and fill lu_page containers with key/record pairs
- - *
- - * \param env - is the environment passed by the caller
- - * \param obj - is the index object to parse
- - * \param rdpg - is the lu_rdpg descriptor associated with the transfer
- - * \param filler - is the callback function responsible for filling a lu_page
- - * with key/record pairs in the format wanted by the caller
- - * \param arg - is an opaq argument passed to the filler function
- - *
- - * \retval sum (in bytes) of all filled lu_pages
- - * \retval -ve errno on failure
- - */
- -int dt_index_walk(const struct lu_env *env, struct dt_object *obj,
- - const struct lu_rdpg *rdpg, dt_index_page_build_t filler,
- - void *arg)
- -{
- - struct dt_it *it;
- - const struct dt_it_ops *iops;
- - unsigned int pageidx, nob, nlupgs = 0;
- - int rc;
- -
- - LASSERT(rdpg->rp_pages != NULL);
- - LASSERT(obj->do_index_ops != NULL);
- -
- - nob = rdpg->rp_count;
- - if (nob <= 0)
- - return -EFAULT;
- -
- - /* Iterate through index and fill containers from @rdpg */
- - iops = &obj->do_index_ops->dio_it;
- - LASSERT(iops != NULL);
- - it = iops->init(env, obj, rdpg->rp_attrs, BYPASS_CAPA);
- - if (IS_ERR(it))
- - return PTR_ERR(it);
- -
- - rc = iops->load(env, it, rdpg->rp_hash);
- - if (rc == 0)
- - /*
- - * Iterator didn't find record with exactly the key requested.
- - *
- - * It is currently either
- - *
- - * - positioned above record with key less than
- - * requested---skip it.
- - * - or not positioned at all (is in IAM_IT_SKEWED
- - * state)---position it on the next item.
- - */
- - rc = iops->next(env, it);
- - else if (rc > 0)
- - rc = 0;
- -
- - /* Fill containers one after the other. There might be multiple
- - * containers per physical page.
- - *
- - * At this point and across for-loop:
- - * rc == 0 -> ok, proceed.
- - * rc > 0 -> end of index.
- - * rc < 0 -> error. */
- - for (pageidx = 0; rc == 0 && nob > 0; pageidx++) {
- - union lu_page *lp;
- - int i;
- -
- - LASSERT(pageidx < rdpg->rp_npages);
- - lp = kmap(rdpg->rp_pages[pageidx]);
- -
- - /* fill lu pages */
- - for (i = 0; i < LU_PAGE_COUNT; i++, lp++, nob -= LU_PAGE_SIZE) {
- - rc = filler(env, lp, min_t(int, nob, LU_PAGE_SIZE),
- - iops, it, rdpg->rp_attrs, arg);
- - if (rc < 0)
- - break;
- - /* one more lu_page */
- - nlupgs++;
- - if (rc > 0)
- - /* end of index */
- - break;
- - }
- - kunmap(rdpg->rp_pages[i]);
- - }
- -
- - iops->put(env, it);
- - iops->fini(env, it);
- -
- - if (rc >= 0)
- - rc = min_t(unsigned int, nlupgs * LU_PAGE_SIZE, rdpg->rp_count);
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(dt_index_walk);
- -
- -/**
- - * Walk key/record pairs of an index and copy them into 4KB containers to be
- - * transferred over the network. This is the common handler for OBD_IDX_READ
- - * RPC processing.
- - *
- - * \param env - is the environment passed by the caller
- - * \param dev - is the dt_device storing the index
- - * \param ii - is the idx_info structure packed by the client in the
- - * OBD_IDX_READ request
- - * \param rdpg - is the lu_rdpg descriptor
- - *
- - * \retval on success, return sum (in bytes) of all filled containers
- - * \retval appropriate error otherwise.
- - */
- -int dt_index_read(const struct lu_env *env, struct dt_device *dev,
- - struct idx_info *ii, const struct lu_rdpg *rdpg)
- -{
- - const struct dt_index_features *feat;
- - struct dt_object *obj;
- - int rc;
- -
- - /* rp_count shouldn't be null and should be a multiple of the container
- - * size */
- - if (rdpg->rp_count <= 0 && (rdpg->rp_count & (LU_PAGE_SIZE - 1)) != 0)
- - return -EFAULT;
- -
- - if (fid_seq(&ii->ii_fid) >= FID_SEQ_NORMAL)
- - /* we don't support directory transfer via OBD_IDX_READ for the
- - * time being */
- - return -EOPNOTSUPP;
- -
- - if (!fid_is_quota(&ii->ii_fid))
- - /* block access to all local files except quota files */
- - return -EPERM;
- -
- - /* lookup index object subject to the transfer */
- - obj = dt_locate(env, dev, &ii->ii_fid);
- - if (IS_ERR(obj))
- - return PTR_ERR(obj);
- - if (dt_object_exists(obj) == 0) {
- - rc = -ENOENT;
- - goto out;
- - }
- -
- - /* fetch index features associated with index object */
- - feat = dt_index_feat_select(fid_seq(&ii->ii_fid),
- - lu_object_attr(&obj->do_lu));
- - if (IS_ERR(feat)) {
- - rc = PTR_ERR(feat);
- - goto out;
- - }
- -
- - /* load index feature if not done already */
- - if (obj->do_index_ops == NULL) {
- - rc = obj->do_ops->do_index_try(env, obj, feat);
- - if (rc)
- - goto out;
- - }
- -
- - /* fill ii_flags with supported index features */
- - ii->ii_flags &= II_FL_NOHASH;
- -
- - ii->ii_keysize = feat->dif_keysize_max;
- - if ((feat->dif_flags & DT_IND_VARKEY) != 0) {
- - /* key size is variable */
- - ii->ii_flags |= II_FL_VARKEY;
- - /* we don't support variable key size for the time being */
- - rc = -EOPNOTSUPP;
- - goto out;
- - }
- -
- - ii->ii_recsize = feat->dif_recsize_max;
- - if ((feat->dif_flags & DT_IND_VARREC) != 0) {
- - /* record size is variable */
- - ii->ii_flags |= II_FL_VARREC;
- - /* we don't support variable record size for the time being */
- - rc = -EOPNOTSUPP;
- - goto out;
- - }
- -
- - if ((feat->dif_flags & DT_IND_NONUNQ) != 0)
- - /* key isn't necessarily unique */
- - ii->ii_flags |= II_FL_NONUNQ;
- -
- - dt_read_lock(env, obj, 0);
- - /* fetch object version before walking the index */
- - ii->ii_version = dt_version_get(env, obj);
- -
- - /* walk the index and fill lu_idxpages with key/record pairs */
- - rc = dt_index_walk(env, obj, rdpg, dt_index_page_build, ii);
- - dt_read_unlock(env, obj);
- -
- - if (rc == 0) {
- - /* index is empty */
- - LASSERT(ii->ii_count == 0);
- - ii->ii_hash_end = II_END_OFF;
- - }
- -
- - goto out;
- -out:
- - lu_object_put(env, &obj->do_lu);
- - return rc;
- -}
- -EXPORT_SYMBOL(dt_index_read);
- -
- -int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
- - int count, int *eof, void *data)
- -{
- - struct dt_device *dt = data;
- - struct obd_statfs osfs;
- - int rc = dt_statfs(NULL, dt, &osfs);
- -
- - if (rc == 0) {
- - *eof = 1;
- - rc = snprintf(page, count, "%u\n",
- - (unsigned) osfs.os_bsize);
- - }
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(lprocfs_dt_rd_blksize);
- -
- -int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off,
- - int count, int *eof, void *data)
- -{
- - struct dt_device *dt = data;
- - struct obd_statfs osfs;
- - int rc = dt_statfs(NULL, dt, &osfs);
- -
- - if (rc == 0) {
- - __u32 blk_size = osfs.os_bsize >> 10;
- - __u64 result = osfs.os_blocks;
- -
- - while (blk_size >>= 1)
- - result <<= 1;
- -
- - *eof = 1;
- - rc = snprintf(page, count, "%llu\n", result);
- - }
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(lprocfs_dt_rd_kbytestotal);
- -
- -int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off,
- - int count, int *eof, void *data)
- -{
- - struct dt_device *dt = data;
- - struct obd_statfs osfs;
- - int rc = dt_statfs(NULL, dt, &osfs);
- -
- - if (rc == 0) {
- - __u32 blk_size = osfs.os_bsize >> 10;
- - __u64 result = osfs.os_bfree;
- -
- - while (blk_size >>= 1)
- - result <<= 1;
- -
- - *eof = 1;
- - rc = snprintf(page, count, "%llu\n", result);
- - }
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(lprocfs_dt_rd_kbytesfree);
- -
- -int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off,
- - int count, int *eof, void *data)
- -{
- - struct dt_device *dt = data;
- - struct obd_statfs osfs;
- - int rc = dt_statfs(NULL, dt, &osfs);
- -
- - if (rc == 0) {
- - __u32 blk_size = osfs.os_bsize >> 10;
- - __u64 result = osfs.os_bavail;
- -
- - while (blk_size >>= 1)
- - result <<= 1;
- -
- - *eof = 1;
- - rc = snprintf(page, count, "%llu\n", result);
- - }
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(lprocfs_dt_rd_kbytesavail);
- -
- -int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off,
- - int count, int *eof, void *data)
- -{
- - struct dt_device *dt = data;
- - struct obd_statfs osfs;
- - int rc = dt_statfs(NULL, dt, &osfs);
- -
- - if (rc == 0) {
- - *eof = 1;
- - rc = snprintf(page, count, "%llu\n", osfs.os_files);
- - }
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(lprocfs_dt_rd_filestotal);
- -
- -int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
- - int count, int *eof, void *data)
- -{
- - struct dt_device *dt = data;
- - struct obd_statfs osfs;
- - int rc = dt_statfs(NULL, dt, &osfs);
- -
- - if (rc == 0) {
- - *eof = 1;
- - rc = snprintf(page, count, "%llu\n", osfs.os_ffree);
- - }
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(lprocfs_dt_rd_filesfree);
- diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
- index a27932502f2a..35a9dea529bd 100644
- --- a/drivers/staging/lustre/lustre/obdclass/genops.c
- +++ b/drivers/staging/lustre/lustre/obdclass/genops.c
- @@ -439,16 +439,6 @@ int class_uuid2dev(struct obd_uuid *uuid)
- }
- EXPORT_SYMBOL(class_uuid2dev);
- -struct obd_device *class_uuid2obd(struct obd_uuid *uuid)
- -{
- - int dev = class_uuid2dev(uuid);
- -
- - if (dev < 0)
- - return NULL;
- - return class_num2obd(dev);
- -}
- -EXPORT_SYMBOL(class_uuid2obd);
- -
- /**
- * Get obd device from ::obd_devs[]
- *
- @@ -478,55 +468,6 @@ struct obd_device *class_num2obd(int num)
- }
- EXPORT_SYMBOL(class_num2obd);
- -/**
- - * Get obd devices count. Device in any
- - * state are counted
- - * \retval obd device count
- - */
- -int get_devices_count(void)
- -{
- - int index, max_index = class_devno_max(), dev_count = 0;
- -
- - read_lock(&obd_dev_lock);
- - for (index = 0; index <= max_index; index++) {
- - struct obd_device *obd = class_num2obd(index);
- -
- - if (obd != NULL)
- - dev_count++;
- - }
- - read_unlock(&obd_dev_lock);
- -
- - return dev_count;
- -}
- -EXPORT_SYMBOL(get_devices_count);
- -
- -void class_obd_list(void)
- -{
- - char *status;
- - int i;
- -
- - read_lock(&obd_dev_lock);
- - for (i = 0; i < class_devno_max(); i++) {
- - struct obd_device *obd = class_num2obd(i);
- -
- - if (!obd)
- - continue;
- - if (obd->obd_stopping)
- - status = "ST";
- - else if (obd->obd_set_up)
- - status = "UP";
- - else if (obd->obd_attached)
- - status = "AT";
- - else
- - status = "--";
- - LCONSOLE(D_CONFIG, "%3d %s %s %s %s %d\n",
- - i, status, obd->obd_type->typ_name,
- - obd->obd_name, obd->obd_uuid.uuid,
- - atomic_read(&obd->obd_refcount));
- - }
- - read_unlock(&obd_dev_lock);
- -}
- -
- /* Search for a client OBD connected to tgt_uuid. If grp_uuid is
- specified, then only the client with that uuid is returned,
- otherwise any client connected to the tgt is returned. */
- @@ -713,21 +654,6 @@ struct obd_device *class_exp2obd(struct obd_export *exp)
- }
- EXPORT_SYMBOL(class_exp2obd);
- -struct obd_device *class_conn2obd(struct lustre_handle *conn)
- -{
- - struct obd_export *export;
- -
- - export = class_conn2export(conn);
- - if (export) {
- - struct obd_device *obd = export->exp_obd;
- -
- - class_export_put(export);
- - return obd;
- - }
- - return NULL;
- -}
- -EXPORT_SYMBOL(class_conn2obd);
- -
- struct obd_import *class_exp2cliimp(struct obd_export *exp)
- {
- struct obd_device *obd = exp->exp_obd;
- @@ -738,16 +664,6 @@ struct obd_import *class_exp2cliimp(struct obd_export *exp)
- }
- EXPORT_SYMBOL(class_exp2cliimp);
- -struct obd_import *class_conn2cliimp(struct lustre_handle *conn)
- -{
- - struct obd_device *obd = class_conn2obd(conn);
- -
- - if (!obd)
- - return NULL;
- - return obd->u.cli.cl_import;
- -}
- -EXPORT_SYMBOL(class_conn2cliimp);
- -
- /* Export management functions */
- static void class_export_destroy(struct obd_export *exp)
- {
- @@ -1220,21 +1136,6 @@ no_disconn:
- }
- EXPORT_SYMBOL(class_disconnect);
- -/* Return non-zero for a fully connected export */
- -int class_connected_export(struct obd_export *exp)
- -{
- - if (exp) {
- - int connected;
- -
- - spin_lock(&exp->exp_lock);
- - connected = exp->exp_conn_cnt > 0;
- - spin_unlock(&exp->exp_lock);
- - return connected;
- - }
- - return 0;
- -}
- -EXPORT_SYMBOL(class_connected_export);
- -
- static void class_disconnect_export_list(struct list_head *list,
- enum obd_option flags)
- {
- @@ -1300,56 +1201,6 @@ void class_disconnect_exports(struct obd_device *obd)
- }
- EXPORT_SYMBOL(class_disconnect_exports);
- -/* Remove exports that have not completed recovery.
- - */
- -void class_disconnect_stale_exports(struct obd_device *obd,
- - int (*test_export)(struct obd_export *))
- -{
- - struct list_head work_list;
- - struct obd_export *exp, *n;
- - int evicted = 0;
- -
- - INIT_LIST_HEAD(&work_list);
- - spin_lock(&obd->obd_dev_lock);
- - list_for_each_entry_safe(exp, n, &obd->obd_exports,
- - exp_obd_chain) {
- - /* don't count self-export as client */
- - if (obd_uuid_equals(&exp->exp_client_uuid,
- - &exp->exp_obd->obd_uuid))
- - continue;
- -
- - /* don't evict clients which have no slot in last_rcvd
- - * (e.g. lightweight connection) */
- - if (exp->exp_target_data.ted_lr_idx == -1)
- - continue;
- -
- - spin_lock(&exp->exp_lock);
- - if (exp->exp_failed || test_export(exp)) {
- - spin_unlock(&exp->exp_lock);
- - continue;
- - }
- - exp->exp_failed = 1;
- - spin_unlock(&exp->exp_lock);
- -
- - list_move(&exp->exp_obd_chain, &work_list);
- - evicted++;
- - CDEBUG(D_HA, "%s: disconnect stale client %s@%s\n",
- - obd->obd_name, exp->exp_client_uuid.uuid,
- - !exp->exp_connection ? "<unknown>" :
- - libcfs_nid2str(exp->exp_connection->c_peer.nid));
- - print_export_data(exp, "EVICTING", 0);
- - }
- - spin_unlock(&obd->obd_dev_lock);
- -
- - if (evicted)
- - LCONSOLE_WARN("%s: disconnecting %d stale clients\n",
- - obd->obd_name, evicted);
- -
- - class_disconnect_export_list(&work_list, exp_flags_from_obd(obd) |
- - OBD_OPT_ABORT_RECOV);
- -}
- -EXPORT_SYMBOL(class_disconnect_stale_exports);
- -
- void class_fail_export(struct obd_export *exp)
- {
- int rc, already_failed;
- @@ -1542,29 +1393,6 @@ void dump_exports(struct obd_device *obd, int locks)
- }
- EXPORT_SYMBOL(dump_exports);
- -void obd_exports_barrier(struct obd_device *obd)
- -{
- - int waited = 2;
- -
- - LASSERT(list_empty(&obd->obd_exports));
- - spin_lock(&obd->obd_dev_lock);
- - while (!list_empty(&obd->obd_unlinked_exports)) {
- - spin_unlock(&obd->obd_dev_lock);
- - set_current_state(TASK_UNINTERRUPTIBLE);
- - schedule_timeout(cfs_time_seconds(waited));
- - if (waited > 5 && IS_PO2(waited)) {
- - LCONSOLE_WARN("%s is waiting for obd_unlinked_exports more than %d seconds. The obd refcount = %d. Is it stuck?\n",
- - obd->obd_name, waited,
- - atomic_read(&obd->obd_refcount));
- - dump_exports(obd, 1);
- - }
- - waited *= 2;
- - spin_lock(&obd->obd_dev_lock);
- - }
- - spin_unlock(&obd->obd_dev_lock);
- -}
- -EXPORT_SYMBOL(obd_exports_barrier);
- -
- /* Total amount of zombies to be destroyed */
- static int zombies_count;
- @@ -1775,70 +1603,3 @@ void obd_zombie_impexp_stop(void)
- obd_zombie_impexp_notify();
- wait_for_completion(&obd_zombie_stop);
- }
- -
- -/***** Kernel-userspace comm helpers *******/
- -
- -/* Get length of entire message, including header */
- -int kuc_len(int payload_len)
- -{
- - return sizeof(struct kuc_hdr) + payload_len;
- -}
- -EXPORT_SYMBOL(kuc_len);
- -
- -/* Get a pointer to kuc header, given a ptr to the payload
- - * @param p Pointer to payload area
- - * @returns Pointer to kuc header
- - */
- -struct kuc_hdr *kuc_ptr(void *p)
- -{
- - struct kuc_hdr *lh = ((struct kuc_hdr *)p) - 1;
- -
- - LASSERT(lh->kuc_magic == KUC_MAGIC);
- - return lh;
- -}
- -EXPORT_SYMBOL(kuc_ptr);
- -
- -/* Test if payload is part of kuc message
- - * @param p Pointer to payload area
- - * @returns boolean
- - */
- -int kuc_ispayload(void *p)
- -{
- - struct kuc_hdr *kh = ((struct kuc_hdr *)p) - 1;
- -
- - if (kh->kuc_magic == KUC_MAGIC)
- - return 1;
- - else
- - return 0;
- -}
- -EXPORT_SYMBOL(kuc_ispayload);
- -
- -/* Alloc space for a message, and fill in header
- - * @return Pointer to payload area
- - */
- -void *kuc_alloc(int payload_len, int transport, int type)
- -{
- - struct kuc_hdr *lh;
- - int len = kuc_len(payload_len);
- -
- - lh = kzalloc(len, GFP_NOFS);
- - if (!lh)
- - return ERR_PTR(-ENOMEM);
- -
- - lh->kuc_magic = KUC_MAGIC;
- - lh->kuc_transport = transport;
- - lh->kuc_msgtype = type;
- - lh->kuc_msglen = len;
- -
- - return (void *)(lh + 1);
- -}
- -EXPORT_SYMBOL(kuc_alloc);
- -
- -/* Takes pointer to payload area */
- -inline void kuc_free(void *p, int payload_len)
- -{
- - struct kuc_hdr *lh = kuc_ptr(p);
- -
- - kfree(lh);
- -}
- -EXPORT_SYMBOL(kuc_free);
- diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
- index 62ed706b136d..9496c09b2b69 100644
- --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
- +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
- @@ -49,102 +49,6 @@
- #include <linux/fs.h>
- #include <linux/pagemap.h> /* for PAGE_CACHE_SIZE */
- -/*FIXME: Just copy from obdo_from_inode*/
- -void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid)
- -{
- - u32 newvalid = 0;
- -
- - if (valid & LA_ATIME) {
- - dst->o_atime = la->la_atime;
- - newvalid |= OBD_MD_FLATIME;
- - }
- - if (valid & LA_MTIME) {
- - dst->o_mtime = la->la_mtime;
- - newvalid |= OBD_MD_FLMTIME;
- - }
- - if (valid & LA_CTIME) {
- - dst->o_ctime = la->la_ctime;
- - newvalid |= OBD_MD_FLCTIME;
- - }
- - if (valid & LA_SIZE) {
- - dst->o_size = la->la_size;
- - newvalid |= OBD_MD_FLSIZE;
- - }
- - if (valid & LA_BLOCKS) { /* allocation of space (x512 bytes) */
- - dst->o_blocks = la->la_blocks;
- - newvalid |= OBD_MD_FLBLOCKS;
- - }
- - if (valid & LA_TYPE) {
- - dst->o_mode = (dst->o_mode & S_IALLUGO) |
- - (la->la_mode & S_IFMT);
- - newvalid |= OBD_MD_FLTYPE;
- - }
- - if (valid & LA_MODE) {
- - dst->o_mode = (dst->o_mode & S_IFMT) |
- - (la->la_mode & S_IALLUGO);
- - newvalid |= OBD_MD_FLMODE;
- - }
- - if (valid & LA_UID) {
- - dst->o_uid = la->la_uid;
- - newvalid |= OBD_MD_FLUID;
- - }
- - if (valid & LA_GID) {
- - dst->o_gid = la->la_gid;
- - newvalid |= OBD_MD_FLGID;
- - }
- - dst->o_valid |= newvalid;
- -}
- -EXPORT_SYMBOL(obdo_from_la);
- -
- -/*FIXME: Just copy from obdo_from_inode*/
- -void la_from_obdo(struct lu_attr *dst, struct obdo *obdo, u32 valid)
- -{
- - __u64 newvalid = 0;
- -
- - valid &= obdo->o_valid;
- -
- - if (valid & OBD_MD_FLATIME) {
- - dst->la_atime = obdo->o_atime;
- - newvalid |= LA_ATIME;
- - }
- - if (valid & OBD_MD_FLMTIME) {
- - dst->la_mtime = obdo->o_mtime;
- - newvalid |= LA_MTIME;
- - }
- - if (valid & OBD_MD_FLCTIME) {
- - dst->la_ctime = obdo->o_ctime;
- - newvalid |= LA_CTIME;
- - }
- - if (valid & OBD_MD_FLSIZE) {
- - dst->la_size = obdo->o_size;
- - newvalid |= LA_SIZE;
- - }
- - if (valid & OBD_MD_FLBLOCKS) {
- - dst->la_blocks = obdo->o_blocks;
- - newvalid |= LA_BLOCKS;
- - }
- - if (valid & OBD_MD_FLTYPE) {
- - dst->la_mode = (dst->la_mode & S_IALLUGO) |
- - (obdo->o_mode & S_IFMT);
- - newvalid |= LA_TYPE;
- - }
- - if (valid & OBD_MD_FLMODE) {
- - dst->la_mode = (dst->la_mode & S_IFMT) |
- - (obdo->o_mode & S_IALLUGO);
- - newvalid |= LA_MODE;
- - }
- - if (valid & OBD_MD_FLUID) {
- - dst->la_uid = obdo->o_uid;
- - newvalid |= LA_UID;
- - }
- - if (valid & OBD_MD_FLGID) {
- - dst->la_gid = obdo->o_gid;
- - newvalid |= LA_GID;
- - }
- - dst->la_valid = newvalid;
- -}
- -EXPORT_SYMBOL(la_from_obdo);
- -
- void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
- {
- valid &= src->o_valid;
- @@ -179,44 +83,3 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
- dst->i_blocks = src->o_blocks;
- }
- EXPORT_SYMBOL(obdo_refresh_inode);
- -
- -void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid)
- -{
- - valid &= src->o_valid;
- -
- - LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID |
- - OBD_MD_FLID | OBD_MD_FLGROUP)),
- - "object "DOSTID", valid %x\n", POSTID(&src->o_oi), valid);
- -
- - if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
- - CDEBUG(D_INODE,
- - "valid %#llx, cur time %lu/%lu, new %llu/%llu\n",
- - src->o_valid, LTIME_S(dst->i_mtime),
- - LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
- -
- - if (valid & OBD_MD_FLATIME)
- - LTIME_S(dst->i_atime) = src->o_atime;
- - if (valid & OBD_MD_FLMTIME)
- - LTIME_S(dst->i_mtime) = src->o_mtime;
- - if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(dst->i_ctime))
- - LTIME_S(dst->i_ctime) = src->o_ctime;
- - if (valid & OBD_MD_FLSIZE)
- - i_size_write(dst, src->o_size);
- - if (valid & OBD_MD_FLBLOCKS) { /* allocation of space */
- - dst->i_blocks = src->o_blocks;
- - if (dst->i_blocks < src->o_blocks) /* overflow */
- - dst->i_blocks = -1;
- -
- - }
- - if (valid & OBD_MD_FLBLKSZ)
- - dst->i_blkbits = ffs(src->o_blksize)-1;
- - if (valid & OBD_MD_FLMODE)
- - dst->i_mode = (dst->i_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
- - if (valid & OBD_MD_FLUID)
- - dst->i_uid = make_kuid(&init_user_ns, src->o_uid);
- - if (valid & OBD_MD_FLGID)
- - dst->i_gid = make_kgid(&init_user_ns, src->o_gid);
- - if (valid & OBD_MD_FLFLAGS)
- - dst->i_flags = src->o_flags;
- -}
- -EXPORT_SYMBOL(obdo_to_inode);
- diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
- index 1515163a81a5..518288df4d53 100644
- --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
- +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
- @@ -162,7 +162,3 @@ int obd_sysctl_init(void)
- {
- return sysfs_create_group(lustre_kobj, &lustre_attr_group);
- }
- -
- -void obd_sysctl_clean(void)
- -{
- -}
- diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c
- index 8cad47080456..b93ee4ca4239 100644
- --- a/drivers/staging/lustre/lustre/obdclass/llog.c
- +++ b/drivers/staging/lustre/lustre/obdclass/llog.c
- @@ -50,6 +50,7 @@
- #include "../include/obd_class.h"
- #include "../include/lustre_log.h"
- +#include "../include/dt_object.h"
- #include "llog_internal.h"
- /*
- @@ -475,173 +476,6 @@ int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
- }
- EXPORT_SYMBOL(llog_process);
- -int llog_reverse_process(const struct lu_env *env,
- - struct llog_handle *loghandle, llog_cb_t cb,
- - void *data, void *catdata)
- -{
- - struct llog_log_hdr *llh = loghandle->lgh_hdr;
- - struct llog_process_cat_data *cd = catdata;
- - void *buf;
- - int rc = 0, first_index = 1, index, idx;
- -
- - buf = kzalloc(LLOG_CHUNK_SIZE, GFP_NOFS);
- - if (!buf)
- - return -ENOMEM;
- -
- - if (cd != NULL)
- - first_index = cd->lpcd_first_idx + 1;
- - if (cd != NULL && cd->lpcd_last_idx)
- - index = cd->lpcd_last_idx;
- - else
- - index = LLOG_BITMAP_BYTES * 8 - 1;
- -
- - while (rc == 0) {
- - struct llog_rec_hdr *rec;
- - struct llog_rec_tail *tail;
- -
- - /* skip records not set in bitmap */
- - while (index >= first_index &&
- - !ext2_test_bit(index, llh->llh_bitmap))
- - --index;
- -
- - LASSERT(index >= first_index - 1);
- - if (index == first_index - 1)
- - break;
- -
- - /* get the buf with our target record; avoid old garbage */
- - memset(buf, 0, LLOG_CHUNK_SIZE);
- - rc = llog_prev_block(env, loghandle, index, buf,
- - LLOG_CHUNK_SIZE);
- - if (rc)
- - goto out;
- -
- - rec = buf;
- - idx = rec->lrh_index;
- - CDEBUG(D_RPCTRACE, "index %u : idx %u\n", index, idx);
- - while (idx < index) {
- - rec = (void *)rec + rec->lrh_len;
- - if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
- - lustre_swab_llog_rec(rec);
- - idx++;
- - }
- - LASSERT(idx == index);
- - tail = (void *)rec + rec->lrh_len - sizeof(*tail);
- -
- - /* process records in buffer, starting where we found one */
- - while ((void *)tail > buf) {
- - if (tail->lrt_index == 0) {
- - /* no more records */
- - rc = 0;
- - goto out;
- - }
- -
- - /* if set, process the callback on this record */
- - if (ext2_test_bit(index, llh->llh_bitmap)) {
- - rec = (void *)tail - tail->lrt_len +
- - sizeof(*tail);
- -
- - rc = cb(env, loghandle, rec, data);
- - if (rc == LLOG_PROC_BREAK) {
- - goto out;
- - } else if (rc == LLOG_DEL_RECORD) {
- - llog_cancel_rec(env, loghandle,
- - tail->lrt_index);
- - rc = 0;
- - }
- - if (rc)
- - goto out;
- - }
- -
- - /* previous record, still in buffer? */
- - --index;
- - if (index < first_index) {
- - rc = 0;
- - goto out;
- - }
- - tail = (void *)tail - tail->lrt_len;
- - }
- - }
- -
- -out:
- - kfree(buf);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_reverse_process);
- -
- -/**
- - * new llog API
- - *
- - * API functions:
- - * llog_open - open llog, may not exist
- - * llog_exist - check if llog exists
- - * llog_close - close opened llog, pair for open, frees llog_handle
- - * llog_declare_create - declare llog creation
- - * llog_create - create new llog on disk, need transaction handle
- - * llog_declare_write_rec - declaration of llog write
- - * llog_write_rec - write llog record on disk, need transaction handle
- - * llog_declare_add - declare llog catalog record addition
- - * llog_add - add llog record in catalog, need transaction handle
- - */
- -int llog_exist(struct llog_handle *loghandle)
- -{
- - struct llog_operations *lop;
- - int rc;
- -
- - rc = llog_handle2ops(loghandle, &lop);
- - if (rc)
- - return rc;
- - if (lop->lop_exist == NULL)
- - return -EOPNOTSUPP;
- -
- - rc = lop->lop_exist(loghandle);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_exist);
- -
- -int llog_declare_create(const struct lu_env *env,
- - struct llog_handle *loghandle, struct thandle *th)
- -{
- - struct llog_operations *lop;
- - int raised, rc;
- -
- - rc = llog_handle2ops(loghandle, &lop);
- - if (rc)
- - return rc;
- - if (lop->lop_declare_create == NULL)
- - return -EOPNOTSUPP;
- -
- - raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
- - if (!raised)
- - cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
- - rc = lop->lop_declare_create(env, loghandle, th);
- - if (!raised)
- - cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_declare_create);
- -
- -int llog_create(const struct lu_env *env, struct llog_handle *handle,
- - struct thandle *th)
- -{
- - struct llog_operations *lop;
- - int raised, rc;
- -
- - rc = llog_handle2ops(handle, &lop);
- - if (rc)
- - return rc;
- - if (lop->lop_create == NULL)
- - return -EOPNOTSUPP;
- -
- - raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
- - if (!raised)
- - cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
- - rc = lop->lop_create(env, handle, th);
- - if (!raised)
- - cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_create);
- -
- int llog_declare_write_rec(const struct lu_env *env,
- struct llog_handle *handle,
- struct llog_rec_hdr *rec, int idx,
- @@ -700,114 +534,6 @@ int llog_write_rec(const struct lu_env *env, struct llog_handle *handle,
- }
- EXPORT_SYMBOL(llog_write_rec);
- -int llog_add(const struct lu_env *env, struct llog_handle *lgh,
- - struct llog_rec_hdr *rec, struct llog_cookie *logcookies,
- - void *buf, struct thandle *th)
- -{
- - int raised, rc;
- -
- - if (lgh->lgh_logops->lop_add == NULL)
- - return -EOPNOTSUPP;
- -
- - raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
- - if (!raised)
- - cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
- - rc = lgh->lgh_logops->lop_add(env, lgh, rec, logcookies, buf, th);
- - if (!raised)
- - cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_add);
- -
- -int llog_declare_add(const struct lu_env *env, struct llog_handle *lgh,
- - struct llog_rec_hdr *rec, struct thandle *th)
- -{
- - int raised, rc;
- -
- - if (lgh->lgh_logops->lop_declare_add == NULL)
- - return -EOPNOTSUPP;
- -
- - raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
- - if (!raised)
- - cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
- - rc = lgh->lgh_logops->lop_declare_add(env, lgh, rec, th);
- - if (!raised)
- - cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_declare_add);
- -
- -/**
- - * Helper function to open llog or create it if doesn't exist.
- - * It hides all transaction handling from caller.
- - */
- -int llog_open_create(const struct lu_env *env, struct llog_ctxt *ctxt,
- - struct llog_handle **res, struct llog_logid *logid,
- - char *name)
- -{
- - struct dt_device *d;
- - struct thandle *th;
- - int rc;
- -
- - rc = llog_open(env, ctxt, res, logid, name, LLOG_OPEN_NEW);
- - if (rc)
- - return rc;
- -
- - if (llog_exist(*res))
- - return 0;
- -
- - LASSERT((*res)->lgh_obj != NULL);
- -
- - d = lu2dt_dev((*res)->lgh_obj->do_lu.lo_dev);
- -
- - th = dt_trans_create(env, d);
- - if (IS_ERR(th)) {
- - rc = PTR_ERR(th);
- - goto out;
- - }
- -
- - rc = llog_declare_create(env, *res, th);
- - if (rc == 0) {
- - rc = dt_trans_start_local(env, d, th);
- - if (rc == 0)
- - rc = llog_create(env, *res, th);
- - }
- - dt_trans_stop(env, d, th);
- -out:
- - if (rc)
- - llog_close(env, *res);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_open_create);
- -
- -/**
- - * Helper function to delete existent llog.
- - */
- -int llog_erase(const struct lu_env *env, struct llog_ctxt *ctxt,
- - struct llog_logid *logid, char *name)
- -{
- - struct llog_handle *handle;
- - int rc = 0, rc2;
- -
- - /* nothing to erase */
- - if (name == NULL && logid == NULL)
- - return 0;
- -
- - rc = llog_open(env, ctxt, &handle, logid, name, LLOG_OPEN_EXISTS);
- - if (rc < 0)
- - return rc;
- -
- - rc = llog_init_handle(env, handle, LLOG_F_IS_PLAIN, NULL);
- - if (rc == 0)
- - rc = llog_destroy(env, handle);
- -
- - rc2 = llog_close(env, handle);
- - if (rc == 0)
- - rc = rc2;
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_erase);
- -
- /*
- * Helper function for write record in llog.
- * It hides all transaction handling from caller.
- @@ -902,105 +628,3 @@ out:
- return rc;
- }
- EXPORT_SYMBOL(llog_close);
- -
- -int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt,
- - char *name)
- -{
- - struct llog_handle *llh;
- - int rc;
- -
- - rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
- - if (rc < 0) {
- - if (likely(rc == -ENOENT))
- - rc = 0;
- - goto out;
- - }
- -
- - rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
- - if (rc)
- - goto out_close;
- - rc = llog_get_size(llh);
- -
- -out_close:
- - llog_close(env, llh);
- -out:
- - /* header is record 1 */
- - return rc <= 1;
- -}
- -EXPORT_SYMBOL(llog_is_empty);
- -
- -int llog_copy_handler(const struct lu_env *env, struct llog_handle *llh,
- - struct llog_rec_hdr *rec, void *data)
- -{
- - struct llog_handle *copy_llh = data;
- -
- - /* Append all records */
- - return llog_write(env, copy_llh, rec, NULL, 0, NULL, -1);
- -}
- -EXPORT_SYMBOL(llog_copy_handler);
- -
- -/* backup plain llog */
- -int llog_backup(const struct lu_env *env, struct obd_device *obd,
- - struct llog_ctxt *ctxt, struct llog_ctxt *bctxt,
- - char *name, char *backup)
- -{
- - struct llog_handle *llh, *bllh;
- - int rc;
- -
- -
- -
- - /* open original log */
- - rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
- - if (rc < 0) {
- - /* the -ENOENT case is also reported to the caller
- - * but silently so it should handle that if needed.
- - */
- - if (rc != -ENOENT)
- - CERROR("%s: failed to open log %s: rc = %d\n",
- - obd->obd_name, name, rc);
- - return rc;
- - }
- -
- - rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
- - if (rc)
- - goto out_close;
- -
- - /* Make sure there's no old backup log */
- - rc = llog_erase(env, bctxt, NULL, backup);
- - if (rc < 0 && rc != -ENOENT)
- - goto out_close;
- -
- - /* open backup log */
- - rc = llog_open_create(env, bctxt, &bllh, NULL, backup);
- - if (rc) {
- - CERROR("%s: failed to open backup logfile %s: rc = %d\n",
- - obd->obd_name, backup, rc);
- - goto out_close;
- - }
- -
- - /* check that backup llog is not the same object as original one */
- - if (llh->lgh_obj == bllh->lgh_obj) {
- - CERROR("%s: backup llog %s to itself (%s), objects %p/%p\n",
- - obd->obd_name, name, backup, llh->lgh_obj,
- - bllh->lgh_obj);
- - rc = -EEXIST;
- - goto out_backup;
- - }
- -
- - rc = llog_init_handle(env, bllh, LLOG_F_IS_PLAIN, NULL);
- - if (rc)
- - goto out_backup;
- -
- - /* Copy log record by record */
- - rc = llog_process_or_fork(env, llh, llog_copy_handler, (void *)bllh,
- - NULL, false);
- - if (rc)
- - CERROR("%s: failed to backup log %s: rc = %d\n",
- - obd->obd_name, name, rc);
- -out_backup:
- - llog_close(env, bllh);
- -out_close:
- - llog_close(env, llh);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_backup);
- diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
- index 48dbbcf97702..412481eb4b81 100644
- --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c
- +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
- @@ -53,93 +53,6 @@
- #include "llog_internal.h"
- -/* Create a new log handle and add it to the open list.
- - * This log handle will be closed when all of the records in it are removed.
- - *
- - * Assumes caller has already pushed us into the kernel context and is locking.
- - */
- -static int llog_cat_new_log(const struct lu_env *env,
- - struct llog_handle *cathandle,
- - struct llog_handle *loghandle,
- - struct thandle *th)
- -{
- -
- - struct llog_log_hdr *llh;
- - struct llog_logid_rec rec = { { 0 }, };
- - int rc, index, bitmap_size;
- -
- - llh = cathandle->lgh_hdr;
- - bitmap_size = LLOG_BITMAP_SIZE(llh);
- -
- - index = (cathandle->lgh_last_idx + 1) % bitmap_size;
- -
- - /* maximum number of available slots in catlog is bitmap_size - 2 */
- - if (llh->llh_cat_idx == index) {
- - CERROR("no free catalog slots for log...\n");
- - return -ENOSPC;
- - }
- -
- - if (OBD_FAIL_CHECK(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
- - return -ENOSPC;
- -
- - rc = llog_create(env, loghandle, th);
- - /* if llog is already created, no need to initialize it */
- - if (rc == -EEXIST) {
- - return 0;
- - } else if (rc != 0) {
- - CERROR("%s: can't create new plain llog in catalog: rc = %d\n",
- - loghandle->lgh_ctxt->loc_obd->obd_name, rc);
- - return rc;
- - }
- -
- - rc = llog_init_handle(env, loghandle,
- - LLOG_F_IS_PLAIN | LLOG_F_ZAP_WHEN_EMPTY,
- - &cathandle->lgh_hdr->llh_tgtuuid);
- - if (rc)
- - goto out_destroy;
- -
- - if (index == 0)
- - index = 1;
- -
- - spin_lock(&loghandle->lgh_hdr_lock);
- - llh->llh_count++;
- - if (ext2_set_bit(index, llh->llh_bitmap)) {
- - CERROR("argh, index %u already set in log bitmap?\n",
- - index);
- - spin_unlock(&loghandle->lgh_hdr_lock);
- - LBUG(); /* should never happen */
- - }
- - spin_unlock(&loghandle->lgh_hdr_lock);
- -
- - cathandle->lgh_last_idx = index;
- - llh->llh_tail.lrt_index = index;
- -
- - CDEBUG(D_RPCTRACE,
- - "new recovery log "DOSTID":%x for index %u of catalog"
- - DOSTID"\n", POSTID(&loghandle->lgh_id.lgl_oi),
- - loghandle->lgh_id.lgl_ogen, index,
- - POSTID(&cathandle->lgh_id.lgl_oi));
- - /* build the record for this log in the catalog */
- - rec.lid_hdr.lrh_len = sizeof(rec);
- - rec.lid_hdr.lrh_index = index;
- - rec.lid_hdr.lrh_type = LLOG_LOGID_MAGIC;
- - rec.lid_id = loghandle->lgh_id;
- - rec.lid_tail.lrt_len = sizeof(rec);
- - rec.lid_tail.lrt_index = index;
- -
- - /* update the catalog: header and record */
- - rc = llog_write_rec(env, cathandle, &rec.lid_hdr,
- - &loghandle->u.phd.phd_cookie, 1, NULL, index, th);
- - if (rc < 0)
- - goto out_destroy;
- -
- - loghandle->lgh_hdr->llh_cat_idx = index;
- - return 0;
- -out_destroy:
- - llog_destroy(env, loghandle);
- - return rc;
- -}
- -
- /* Open an existent log handle and add it to the open list.
- * This log handle will be closed when all of the records in it are removed.
- *
- @@ -245,285 +158,6 @@ int llog_cat_close(const struct lu_env *env, struct llog_handle *cathandle)
- }
- EXPORT_SYMBOL(llog_cat_close);
- -/**
- - * lockdep markers for nested struct llog_handle::lgh_lock locking.
- - */
- -enum {
- - LLOGH_CAT,
- - LLOGH_LOG
- -};
- -
- -/** Return the currently active log handle. If the current log handle doesn't
- - * have enough space left for the current record, start a new one.
- - *
- - * If reclen is 0, we only want to know what the currently active log is,
- - * otherwise we get a lock on this log so nobody can steal our space.
- - *
- - * Assumes caller has already pushed us into the kernel context and is locking.
- - *
- - * NOTE: loghandle is write-locked upon successful return
- - */
- -static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
- - struct thandle *th)
- -{
- - struct llog_handle *loghandle = NULL;
- -
- - down_read_nested(&cathandle->lgh_lock, LLOGH_CAT);
- - loghandle = cathandle->u.chd.chd_current_log;
- - if (loghandle) {
- - struct llog_log_hdr *llh;
- -
- - down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
- - llh = loghandle->lgh_hdr;
- - if (llh == NULL ||
- - loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
- - up_read(&cathandle->lgh_lock);
- - return loghandle;
- - }
- - up_write(&loghandle->lgh_lock);
- - }
- - up_read(&cathandle->lgh_lock);
- -
- - /* time to use next log */
- -
- - /* first, we have to make sure the state hasn't changed */
- - down_write_nested(&cathandle->lgh_lock, LLOGH_CAT);
- - loghandle = cathandle->u.chd.chd_current_log;
- - if (loghandle) {
- - struct llog_log_hdr *llh;
- -
- - down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
- - llh = loghandle->lgh_hdr;
- - LASSERT(llh);
- - if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
- - up_write(&cathandle->lgh_lock);
- - return loghandle;
- - }
- - up_write(&loghandle->lgh_lock);
- - }
- -
- - CDEBUG(D_INODE, "use next log\n");
- -
- - loghandle = cathandle->u.chd.chd_next_log;
- - cathandle->u.chd.chd_current_log = loghandle;
- - cathandle->u.chd.chd_next_log = NULL;
- - down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
- - up_write(&cathandle->lgh_lock);
- - LASSERT(loghandle);
- - return loghandle;
- -}
- -
- -/* Add a single record to the recovery log(s) using a catalog
- - * Returns as llog_write_record
- - *
- - * Assumes caller has already pushed us into the kernel context.
- - */
- -int llog_cat_add_rec(const struct lu_env *env, struct llog_handle *cathandle,
- - struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
- - void *buf, struct thandle *th)
- -{
- - struct llog_handle *loghandle;
- - int rc;
- -
- - LASSERT(rec->lrh_len <= LLOG_CHUNK_SIZE);
- - loghandle = llog_cat_current_log(cathandle, th);
- - LASSERT(!IS_ERR(loghandle));
- -
- - /* loghandle is already locked by llog_cat_current_log() for us */
- - if (!llog_exist(loghandle)) {
- - rc = llog_cat_new_log(env, cathandle, loghandle, th);
- - if (rc < 0) {
- - up_write(&loghandle->lgh_lock);
- - return rc;
- - }
- - }
- - /* now let's try to add the record */
- - rc = llog_write_rec(env, loghandle, rec, reccookie, 1, buf, -1, th);
- - if (rc < 0)
- - CDEBUG_LIMIT(rc == -ENOSPC ? D_HA : D_ERROR,
- - "llog_write_rec %d: lh=%p\n", rc, loghandle);
- - up_write(&loghandle->lgh_lock);
- - if (rc == -ENOSPC) {
- - /* try to use next log */
- - loghandle = llog_cat_current_log(cathandle, th);
- - LASSERT(!IS_ERR(loghandle));
- - /* new llog can be created concurrently */
- - if (!llog_exist(loghandle)) {
- - rc = llog_cat_new_log(env, cathandle, loghandle, th);
- - if (rc < 0) {
- - up_write(&loghandle->lgh_lock);
- - return rc;
- - }
- - }
- - /* now let's try to add the record */
- - rc = llog_write_rec(env, loghandle, rec, reccookie, 1, buf,
- - -1, th);
- - if (rc < 0)
- - CERROR("llog_write_rec %d: lh=%p\n", rc, loghandle);
- - up_write(&loghandle->lgh_lock);
- - }
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_cat_add_rec);
- -
- -int llog_cat_declare_add_rec(const struct lu_env *env,
- - struct llog_handle *cathandle,
- - struct llog_rec_hdr *rec, struct thandle *th)
- -{
- - struct llog_handle *loghandle, *next;
- - int rc = 0;
- -
- - if (cathandle->u.chd.chd_current_log == NULL) {
- - /* declare new plain llog */
- - down_write(&cathandle->lgh_lock);
- - if (cathandle->u.chd.chd_current_log == NULL) {
- - rc = llog_open(env, cathandle->lgh_ctxt, &loghandle,
- - NULL, NULL, LLOG_OPEN_NEW);
- - if (rc == 0) {
- - cathandle->u.chd.chd_current_log = loghandle;
- - list_add_tail(&loghandle->u.phd.phd_entry,
- - &cathandle->u.chd.chd_head);
- - }
- - }
- - up_write(&cathandle->lgh_lock);
- - } else if (cathandle->u.chd.chd_next_log == NULL) {
- - /* declare next plain llog */
- - down_write(&cathandle->lgh_lock);
- - if (cathandle->u.chd.chd_next_log == NULL) {
- - rc = llog_open(env, cathandle->lgh_ctxt, &loghandle,
- - NULL, NULL, LLOG_OPEN_NEW);
- - if (rc == 0) {
- - cathandle->u.chd.chd_next_log = loghandle;
- - list_add_tail(&loghandle->u.phd.phd_entry,
- - &cathandle->u.chd.chd_head);
- - }
- - }
- - up_write(&cathandle->lgh_lock);
- - }
- - if (rc)
- - goto out;
- -
- - if (!llog_exist(cathandle->u.chd.chd_current_log)) {
- - rc = llog_declare_create(env, cathandle->u.chd.chd_current_log,
- - th);
- - if (rc)
- - goto out;
- - llog_declare_write_rec(env, cathandle, NULL, -1, th);
- - }
- - /* declare records in the llogs */
- - rc = llog_declare_write_rec(env, cathandle->u.chd.chd_current_log,
- - rec, -1, th);
- - if (rc)
- - goto out;
- -
- - next = cathandle->u.chd.chd_next_log;
- - if (next) {
- - if (!llog_exist(next)) {
- - rc = llog_declare_create(env, next, th);
- - llog_declare_write_rec(env, cathandle, NULL, -1, th);
- - }
- - llog_declare_write_rec(env, next, rec, -1, th);
- - }
- -out:
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_cat_declare_add_rec);
- -
- -int llog_cat_add(const struct lu_env *env, struct llog_handle *cathandle,
- - struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
- - void *buf)
- -{
- - struct llog_ctxt *ctxt;
- - struct dt_device *dt;
- - struct thandle *th = NULL;
- - int rc;
- -
- - ctxt = cathandle->lgh_ctxt;
- - LASSERT(ctxt);
- - LASSERT(ctxt->loc_exp);
- -
- - if (cathandle->lgh_obj != NULL) {
- - dt = ctxt->loc_exp->exp_obd->obd_lvfs_ctxt.dt;
- - LASSERT(dt);
- -
- - th = dt_trans_create(env, dt);
- - if (IS_ERR(th))
- - return PTR_ERR(th);
- -
- - rc = llog_cat_declare_add_rec(env, cathandle, rec, th);
- - if (rc)
- - goto out_trans;
- -
- - rc = dt_trans_start_local(env, dt, th);
- - if (rc)
- - goto out_trans;
- - rc = llog_cat_add_rec(env, cathandle, rec, reccookie, buf, th);
- -out_trans:
- - dt_trans_stop(env, dt, th);
- - } else { /* lvfs compat code */
- - LASSERT(cathandle->lgh_file != NULL);
- - rc = llog_cat_declare_add_rec(env, cathandle, rec, th);
- - if (rc == 0)
- - rc = llog_cat_add_rec(env, cathandle, rec, reccookie,
- - buf, th);
- - }
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_cat_add);
- -
- -/* For each cookie in the cookie array, we clear the log in-use bit and either:
- - * - the log is empty, so mark it free in the catalog header and delete it
- - * - the log is not empty, just write out the log header
- - *
- - * The cookies may be in different log files, so we need to get new logs
- - * each time.
- - *
- - * Assumes caller has already pushed us into the kernel context.
- - */
- -int llog_cat_cancel_records(const struct lu_env *env,
- - struct llog_handle *cathandle, int count,
- - struct llog_cookie *cookies)
- -{
- - int i, index, rc = 0, failed = 0;
- -
- - for (i = 0; i < count; i++, cookies++) {
- - struct llog_handle *loghandle;
- - struct llog_logid *lgl = &cookies->lgc_lgl;
- - int lrc;
- -
- - rc = llog_cat_id2handle(env, cathandle, &loghandle, lgl);
- - if (rc) {
- - CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
- - cathandle->lgh_ctxt->loc_obd->obd_name,
- - POSTID(&lgl->lgl_oi), rc);
- - failed++;
- - continue;
- - }
- -
- - lrc = llog_cancel_rec(env, loghandle, cookies->lgc_index);
- - if (lrc == 1) { /* log has been destroyed */
- - index = loghandle->u.phd.phd_cookie.lgc_index;
- - rc = llog_cat_cleanup(env, cathandle, loghandle,
- - index);
- - } else if (lrc == -ENOENT) {
- - if (rc == 0) /* ENOENT shouldn't rewrite any error */
- - rc = lrc;
- - } else if (lrc < 0) {
- - failed++;
- - rc = lrc;
- - }
- - llog_handle_put(loghandle);
- - }
- - if (rc)
- - CERROR("%s: fail to cancel %d of %d llog-records: rc = %d\n",
- - cathandle->lgh_ctxt->loc_obd->obd_name, failed, count,
- - rc);
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_cat_cancel_records);
- -
- static int llog_cat_process_cb(const struct lu_env *env,
- struct llog_handle *cat_llh,
- struct llog_rec_hdr *rec, void *data)
- @@ -620,76 +254,6 @@ int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
- }
- EXPORT_SYMBOL(llog_cat_process);
- -static int llog_cat_reverse_process_cb(const struct lu_env *env,
- - struct llog_handle *cat_llh,
- - struct llog_rec_hdr *rec, void *data)
- -{
- - struct llog_process_data *d = data;
- - struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
- - struct llog_handle *llh;
- - int rc;
- -
- - if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) {
- - CERROR("invalid record in catalog\n");
- - return -EINVAL;
- - }
- - CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
- - DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
- - le32_to_cpu(rec->lrh_index), POSTID(&cat_llh->lgh_id.lgl_oi));
- -
- - rc = llog_cat_id2handle(env, cat_llh, &llh, &lir->lid_id);
- - if (rc) {
- - CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
- - cat_llh->lgh_ctxt->loc_obd->obd_name,
- - POSTID(&lir->lid_id.lgl_oi), rc);
- - return rc;
- - }
- -
- - rc = llog_reverse_process(env, llh, d->lpd_cb, d->lpd_data, NULL);
- - llog_handle_put(llh);
- - return rc;
- -}
- -
- -int llog_cat_reverse_process(const struct lu_env *env,
- - struct llog_handle *cat_llh,
- - llog_cb_t cb, void *data)
- -{
- - struct llog_process_data d;
- - struct llog_process_cat_data cd;
- - struct llog_log_hdr *llh = cat_llh->lgh_hdr;
- - int rc;
- -
- - LASSERT(llh->llh_flags & LLOG_F_IS_CAT);
- - d.lpd_data = data;
- - d.lpd_cb = cb;
- -
- - if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {
- - CWARN("catalog "DOSTID" crosses index zero\n",
- - POSTID(&cat_llh->lgh_id.lgl_oi));
- -
- - cd.lpcd_first_idx = 0;
- - cd.lpcd_last_idx = cat_llh->lgh_last_idx;
- - rc = llog_reverse_process(env, cat_llh,
- - llog_cat_reverse_process_cb,
- - &d, &cd);
- - if (rc != 0)
- - return rc;
- -
- - cd.lpcd_first_idx = le32_to_cpu(llh->llh_cat_idx);
- - cd.lpcd_last_idx = 0;
- - rc = llog_reverse_process(env, cat_llh,
- - llog_cat_reverse_process_cb,
- - &d, &cd);
- - } else {
- - rc = llog_reverse_process(env, cat_llh,
- - llog_cat_reverse_process_cb,
- - &d, NULL);
- - }
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_cat_reverse_process);
- -
- static int llog_cat_set_first_idx(struct llog_handle *cathandle, int index)
- {
- struct llog_log_hdr *llh = cathandle->lgh_hdr;
- @@ -748,66 +312,3 @@ int llog_cat_cleanup(const struct lu_env *env, struct llog_handle *cathandle,
- index, POSTID(&cathandle->lgh_id.lgl_oi));
- return rc;
- }
- -
- -static int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle,
- - struct llog_rec_hdr *rec, void *data)
- -{
- - struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
- - struct llog_handle *loghandle;
- - struct llog_log_hdr *llh;
- - int rc;
- -
- - if (rec->lrh_type != LLOG_LOGID_MAGIC) {
- - CERROR("invalid record in catalog\n");
- - return -EINVAL;
- - }
- -
- - CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
- - DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
- - rec->lrh_index, POSTID(&cathandle->lgh_id.lgl_oi));
- -
- - rc = llog_cat_id2handle(env, cathandle, &loghandle, &lir->lid_id);
- - if (rc) {
- - CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
- - cathandle->lgh_ctxt->loc_obd->obd_name,
- - POSTID(&lir->lid_id.lgl_oi), rc);
- - if (rc == -ENOENT || rc == -ESTALE) {
- - /* remove index from catalog */
- - llog_cat_cleanup(env, cathandle, NULL, rec->lrh_index);
- - }
- - return rc;
- - }
- -
- - llh = loghandle->lgh_hdr;
- - if ((llh->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) &&
- - (llh->llh_count == 1)) {
- - rc = llog_destroy(env, loghandle);
- - if (rc)
- - CERROR("%s: fail to destroy empty log: rc = %d\n",
- - loghandle->lgh_ctxt->loc_obd->obd_name, rc);
- -
- - llog_cat_cleanup(env, cathandle, loghandle,
- - loghandle->u.phd.phd_cookie.lgc_index);
- - }
- - llog_handle_put(loghandle);
- -
- - return rc;
- -}
- -
- -/* helper to initialize catalog llog and process it to cancel */
- -int llog_cat_init_and_process(const struct lu_env *env,
- - struct llog_handle *llh)
- -{
- - int rc;
- -
- - rc = llog_init_handle(env, llh, LLOG_F_IS_CAT, NULL);
- - if (rc)
- - return rc;
- -
- - rc = llog_process_or_fork(env, llh, cat_cancel_cb, NULL, NULL, false);
- - if (rc)
- - CERROR("%s: llog_process() with cat_cancel_cb failed: rc = %d\n",
- - llh->lgh_ctxt->loc_obd->obd_name, rc);
- - return 0;
- -}
- -EXPORT_SYMBOL(llog_cat_init_and_process);
- diff --git a/drivers/staging/lustre/lustre/obdclass/llog_internal.h b/drivers/staging/lustre/lustre/obdclass/llog_internal.h
- index c99e658e5657..533998688fb4 100644
- --- a/drivers/staging/lustre/lustre/obdclass/llog_internal.h
- +++ b/drivers/staging/lustre/lustre/obdclass/llog_internal.h
- @@ -53,7 +53,6 @@ struct llog_process_info {
- struct llog_thread_info {
- struct lu_attr lgi_attr;
- struct lu_fid lgi_fid;
- - struct dt_object_format lgi_dof;
- struct lu_buf lgi_buf;
- loff_t lgi_off;
- struct llog_rec_hdr lgi_lrh;
- @@ -62,15 +61,6 @@ struct llog_thread_info {
- extern struct lu_context_key llog_thread_key;
- -static inline struct llog_thread_info *llog_info(const struct lu_env *env)
- -{
- - struct llog_thread_info *lgi;
- -
- - lgi = lu_context_key_get(&env->le_ctx, &llog_thread_key);
- - LASSERT(lgi);
- - return lgi;
- -}
- -
- int llog_info_init(void);
- void llog_info_fini(void);
- diff --git a/drivers/staging/lustre/lustre/obdclass/llog_obd.c b/drivers/staging/lustre/lustre/obdclass/llog_obd.c
- index 81ab27e7376f..2b4a70b6c8d4 100644
- --- a/drivers/staging/lustre/lustre/obdclass/llog_obd.c
- +++ b/drivers/staging/lustre/lustre/obdclass/llog_obd.c
- @@ -212,36 +212,6 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
- }
- EXPORT_SYMBOL(llog_setup);
- -int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags)
- -{
- - int rc = 0;
- -
- - if (!ctxt)
- - return 0;
- -
- - if (CTXTP(ctxt, sync))
- - rc = CTXTP(ctxt, sync)(ctxt, exp, flags);
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_sync);
- -
- -int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
- - struct llog_cookie *cookies, int flags)
- -{
- - int rc;
- -
- - if (!ctxt) {
- - CERROR("No ctxt\n");
- - return -ENODEV;
- - }
- -
- - CTXT_CHECK_OP(ctxt, cancel, -EOPNOTSUPP);
- - rc = CTXTP(ctxt, cancel)(env, ctxt, cookies, flags);
- - return rc;
- -}
- -EXPORT_SYMBOL(llog_cancel);
- -
- /* context key constructor/destructor: llog_key_init, llog_key_fini */
- LU_KEY_INIT_FINI(llog, struct llog_thread_info);
- /* context key: llog_thread_key */
- diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
- index 7cc0f54f9cd4..762100f41327 100644
- --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
- +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
- @@ -264,36 +264,6 @@ struct dentry *ldebugfs_add_simple(struct dentry *root,
- }
- EXPORT_SYMBOL(ldebugfs_add_simple);
- -struct dentry *ldebugfs_add_symlink(const char *name, struct dentry *parent,
- - const char *format, ...)
- -{
- - struct dentry *entry;
- - char *dest;
- - va_list ap;
- -
- - if (parent == NULL || format == NULL)
- - return NULL;
- -
- - dest = kzalloc(MAX_STRING_SIZE + 1, GFP_KERNEL);
- - if (!dest)
- - return NULL;
- -
- - va_start(ap, format);
- - vsnprintf(dest, MAX_STRING_SIZE, format, ap);
- - va_end(ap);
- -
- - entry = debugfs_create_symlink(name, parent, dest);
- - if (IS_ERR_OR_NULL(entry)) {
- - CERROR("LdebugFS: Could not create symbolic link from %s to %s",
- - name, dest);
- - entry = NULL;
- - }
- -
- - kfree(dest);
- - return entry;
- -}
- -EXPORT_SYMBOL(ldebugfs_add_symlink);
- -
- static struct file_operations lprocfs_generic_fops = { };
- int ldebugfs_add_vars(struct dentry *parent,
- @@ -388,41 +358,6 @@ int lprocfs_wr_uint(struct file *file, const char __user *buffer,
- }
- EXPORT_SYMBOL(lprocfs_wr_uint);
- -int lprocfs_rd_u64(struct seq_file *m, void *data)
- -{
- - seq_printf(m, "%llu\n", *(__u64 *)data);
- - return 0;
- -}
- -EXPORT_SYMBOL(lprocfs_rd_u64);
- -
- -int lprocfs_rd_atomic(struct seq_file *m, void *data)
- -{
- - atomic_t *atom = data;
- - LASSERT(atom != NULL);
- - seq_printf(m, "%d\n", atomic_read(atom));
- - return 0;
- -}
- -EXPORT_SYMBOL(lprocfs_rd_atomic);
- -
- -int lprocfs_wr_atomic(struct file *file, const char __user *buffer,
- - unsigned long count, void *data)
- -{
- - atomic_t *atm = data;
- - int val = 0;
- - int rc;
- -
- - rc = lprocfs_write_helper(buffer, count, &val);
- - if (rc < 0)
- - return rc;
- -
- - if (val <= 0)
- - return -ERANGE;
- -
- - atomic_set(atm, val);
- - return count;
- -}
- -EXPORT_SYMBOL(lprocfs_wr_atomic);
- -
- static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr,
- char *buf)
- {
- @@ -433,16 +368,6 @@ static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr,
- }
- LUSTRE_RO_ATTR(uuid);
- -int lprocfs_rd_name(struct seq_file *m, void *data)
- -{
- - struct obd_device *dev = data;
- -
- - LASSERT(dev != NULL);
- - seq_printf(m, "%s\n", dev->obd_name);
- - return 0;
- -}
- -EXPORT_SYMBOL(lprocfs_rd_name);
- -
- static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
- char *buf)
- {
- @@ -1299,227 +1224,6 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
- }
- EXPORT_SYMBOL(lprocfs_counter_init);
- -#define LPROCFS_OBD_OP_INIT(base, stats, op) \
- -do { \
- - unsigned int coffset = base + OBD_COUNTER_OFFSET(op); \
- - LASSERT(coffset < stats->ls_num); \
- - lprocfs_counter_init(stats, coffset, 0, #op, "reqs"); \
- -} while (0)
- -
- -void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
- -{
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, iocontrol);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_info);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, set_info_async);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, attach);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, detach);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, setup);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, precleanup);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, cleanup);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, process_config);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, postrecov);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, add_conn);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, del_conn);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, connect);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, reconnect);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, disconnect);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_init);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_fini);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_alloc);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs_async);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, packmd);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpackmd);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, preallocate);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, create);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr_async);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr_async);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, adjust_kms);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, preprw);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, commitrw);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, find_cbdata);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy_export);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, health_check);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_uuid);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotacheck);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_add);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_del);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, getref);
- - LPROCFS_OBD_OP_INIT(num_private_stats, stats, putref);
- -}
- -EXPORT_SYMBOL(lprocfs_init_ops_stats);
- -
- -int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats)
- -{
- - struct lprocfs_stats *stats;
- - unsigned int num_stats;
- - int rc, i;
- -
- - LASSERT(obd->obd_stats == NULL);
- - LASSERT(obd->obd_debugfs_entry != NULL);
- - LASSERT(obd->obd_cntr_base == 0);
- -
- - num_stats = ((int)sizeof(*obd->obd_type->typ_dt_ops) / sizeof(void *)) +
- - num_private_stats - 1 /* o_owner */;
- - stats = lprocfs_alloc_stats(num_stats, 0);
- - if (stats == NULL)
- - return -ENOMEM;
- -
- - lprocfs_init_ops_stats(num_private_stats, stats);
- -
- - for (i = num_private_stats; i < num_stats; i++) {
- - /* If this LBUGs, it is likely that an obd
- - * operation was added to struct obd_ops in
- - * <obd.h>, and that the corresponding line item
- - * LPROCFS_OBD_OP_INIT(.., .., opname)
- - * is missing from the list above. */
- - LASSERTF(stats->ls_cnt_header[i].lc_name != NULL,
- - "Missing obd_stat initializer obd_op operation at offset %d.\n",
- - i - num_private_stats);
- - }
- - rc = ldebugfs_register_stats(obd->obd_debugfs_entry, "stats", stats);
- - if (rc < 0) {
- - lprocfs_free_stats(&stats);
- - } else {
- - obd->obd_stats = stats;
- - obd->obd_cntr_base = num_private_stats;
- - }
- - return rc;
- -}
- -EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
- -
- -void lprocfs_free_obd_stats(struct obd_device *obd)
- -{
- - if (obd->obd_stats)
- - lprocfs_free_stats(&obd->obd_stats);
- -}
- -EXPORT_SYMBOL(lprocfs_free_obd_stats);
- -
- -#define LPROCFS_MD_OP_INIT(base, stats, op) \
- -do { \
- - unsigned int coffset = base + MD_COUNTER_OFFSET(op); \
- - LASSERT(coffset < stats->ls_num); \
- - lprocfs_counter_init(stats, coffset, 0, #op, "reqs"); \
- -} while (0)
- -
- -void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats)
- -{
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, getstatus);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, null_inode);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, find_cbdata);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, close);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, create);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, done_writing);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, enqueue);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, getattr);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, getattr_name);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, intent_lock);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, link);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, rename);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, is_subdir);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, setattr);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, sync);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, readpage);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, unlink);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, setxattr);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, getxattr);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, init_ea_size);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, get_lustre_md);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, free_lustre_md);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, set_open_replay_data);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, clear_open_replay_data);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, set_lock_data);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, lock_match);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, cancel_unused);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, renew_capa);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, unpack_capa);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, get_remote_perm);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, intent_getattr_async);
- - LPROCFS_MD_OP_INIT(num_private_stats, stats, revalidate_lock);
- -}
- -EXPORT_SYMBOL(lprocfs_init_mps_stats);
- -
- -int lprocfs_alloc_md_stats(struct obd_device *obd,
- - unsigned num_private_stats)
- -{
- - struct lprocfs_stats *stats;
- - unsigned int num_stats;
- - int rc, i;
- -
- - LASSERT(obd->md_stats == NULL);
- - LASSERT(obd->obd_debugfs_entry != NULL);
- - LASSERT(obd->md_cntr_base == 0);
- -
- - num_stats = 1 + MD_COUNTER_OFFSET(revalidate_lock) +
- - num_private_stats;
- - stats = lprocfs_alloc_stats(num_stats, 0);
- - if (stats == NULL)
- - return -ENOMEM;
- -
- - lprocfs_init_mps_stats(num_private_stats, stats);
- -
- - for (i = num_private_stats; i < num_stats; i++) {
- - if (stats->ls_cnt_header[i].lc_name == NULL) {
- - CERROR("Missing md_stat initializer md_op operation at offset %d. Aborting.\n",
- - i - num_private_stats);
- - LBUG();
- - }
- - }
- - rc = ldebugfs_register_stats(obd->obd_debugfs_entry, "md_stats", stats);
- - if (rc < 0) {
- - lprocfs_free_stats(&stats);
- - } else {
- - obd->md_stats = stats;
- - obd->md_cntr_base = num_private_stats;
- - }
- - return rc;
- -}
- -EXPORT_SYMBOL(lprocfs_alloc_md_stats);
- -
- -void lprocfs_free_md_stats(struct obd_device *obd)
- -{
- - struct lprocfs_stats *stats = obd->md_stats;
- -
- - if (stats != NULL) {
- - obd->md_stats = NULL;
- - obd->md_cntr_base = 0;
- - lprocfs_free_stats(&stats);
- - }
- -}
- -EXPORT_SYMBOL(lprocfs_free_md_stats);
- -
- -void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
- -{
- - lprocfs_counter_init(ldlm_stats,
- - LDLM_ENQUEUE - LDLM_FIRST_OPC,
- - 0, "ldlm_enqueue", "reqs");
- - lprocfs_counter_init(ldlm_stats,
- - LDLM_CONVERT - LDLM_FIRST_OPC,
- - 0, "ldlm_convert", "reqs");
- - lprocfs_counter_init(ldlm_stats,
- - LDLM_CANCEL - LDLM_FIRST_OPC,
- - 0, "ldlm_cancel", "reqs");
- - lprocfs_counter_init(ldlm_stats,
- - LDLM_BL_CALLBACK - LDLM_FIRST_OPC,
- - 0, "ldlm_bl_callback", "reqs");
- - lprocfs_counter_init(ldlm_stats,
- - LDLM_CP_CALLBACK - LDLM_FIRST_OPC,
- - 0, "ldlm_cp_callback", "reqs");
- - lprocfs_counter_init(ldlm_stats,
- - LDLM_GL_CALLBACK - LDLM_FIRST_OPC,
- - 0, "ldlm_gl_callback", "reqs");
- -}
- -EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
- -
- int lprocfs_exp_cleanup(struct obd_export *exp)
- {
- return 0;
- @@ -1575,31 +1279,6 @@ int lprocfs_write_helper(const char __user *buffer, unsigned long count,
- }
- EXPORT_SYMBOL(lprocfs_write_helper);
- -int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult)
- -{
- - long decimal_val, frac_val;
- -
- - decimal_val = val / mult;
- - seq_printf(m, "%ld", decimal_val);
- - frac_val = val % mult;
- -
- - if (frac_val > 0) {
- - frac_val *= 100;
- - frac_val /= mult;
- - }
- - if (frac_val > 0) {
- - /* Three cases: x0, xx, 0x */
- - if ((frac_val % 10) != 0)
- - seq_printf(m, ".%ld", frac_val);
- - else
- - seq_printf(m, ".%ld", frac_val / 10);
- - }
- -
- - seq_printf(m, "\n");
- - return 0;
- -}
- -EXPORT_SYMBOL(lprocfs_seq_read_frac_helper);
- -
- int lprocfs_write_u64_helper(const char __user *buffer, unsigned long count,
- __u64 *val)
- {
- @@ -1787,19 +1466,6 @@ void lprocfs_oh_clear(struct obd_histogram *oh)
- }
- EXPORT_SYMBOL(lprocfs_oh_clear);
- -int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data)
- -{
- - struct obd_device *dev = data;
- - struct client_obd *cli = &dev->u.cli;
- -
- - client_obd_list_lock(&cli->cl_loi_list_lock);
- - seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
- - client_obd_list_unlock(&cli->cl_loi_list_lock);
- -
- - return 0;
- -}
- -EXPORT_SYMBOL(lprocfs_obd_rd_max_pages_per_rpc);
- -
- ssize_t lustre_attr_show(struct kobject *kobj,
- struct attribute *attr, char *buf)
- {
- diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c
- index c892e8239e8d..01d70f029dc7 100644
- --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
- +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
- @@ -157,17 +157,6 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o)
- EXPORT_SYMBOL(lu_object_put);
- /**
- - * Put object and don't keep in cache. This is temporary solution for
- - * multi-site objects when its layering is not constant.
- - */
- -void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o)
- -{
- - set_bit(LU_OBJECT_HEARD_BANSHEE, &o->lo_header->loh_flags);
- - return lu_object_put(env, o);
- -}
- -EXPORT_SYMBOL(lu_object_put_nocache);
- -
- -/**
- * Kill the object and take it out of LRU cache.
- * Currently used by client code for layout change.
- */
- @@ -529,23 +518,6 @@ void lu_object_print(const struct lu_env *env, void *cookie,
- }
- EXPORT_SYMBOL(lu_object_print);
- -/**
- - * Check object consistency.
- - */
- -int lu_object_invariant(const struct lu_object *o)
- -{
- - struct lu_object_header *top;
- -
- - top = o->lo_header;
- - list_for_each_entry(o, &top->loh_layers, lo_linkage) {
- - if (o->lo_ops->loo_object_invariant != NULL &&
- - !o->lo_ops->loo_object_invariant(o))
- - return 0;
- - }
- - return 1;
- -}
- -EXPORT_SYMBOL(lu_object_invariant);
- -
- static struct lu_object *htable_lookup(struct lu_site *s,
- struct cfs_hash_bd *bd,
- const struct lu_fid *f,
- @@ -962,14 +934,6 @@ void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d)
- }
- EXPORT_SYMBOL(lu_dev_add_linkage);
- -void lu_dev_del_linkage(struct lu_site *s, struct lu_device *d)
- -{
- - spin_lock(&s->ls_ld_lock);
- - list_del_init(&d->ld_linkage);
- - spin_unlock(&s->ls_ld_lock);
- -}
- -EXPORT_SYMBOL(lu_dev_del_linkage);
- -
- /**
- * Initialize site \a s, with \a d as the top level device.
- */
- @@ -1701,42 +1665,6 @@ EXPORT_SYMBOL(lu_context_refill);
- __u32 lu_context_tags_default;
- __u32 lu_session_tags_default;
- -void lu_context_tags_update(__u32 tags)
- -{
- - spin_lock(&lu_keys_guard);
- - lu_context_tags_default |= tags;
- - key_set_version++;
- - spin_unlock(&lu_keys_guard);
- -}
- -EXPORT_SYMBOL(lu_context_tags_update);
- -
- -void lu_context_tags_clear(__u32 tags)
- -{
- - spin_lock(&lu_keys_guard);
- - lu_context_tags_default &= ~tags;
- - key_set_version++;
- - spin_unlock(&lu_keys_guard);
- -}
- -EXPORT_SYMBOL(lu_context_tags_clear);
- -
- -void lu_session_tags_update(__u32 tags)
- -{
- - spin_lock(&lu_keys_guard);
- - lu_session_tags_default |= tags;
- - key_set_version++;
- - spin_unlock(&lu_keys_guard);
- -}
- -EXPORT_SYMBOL(lu_session_tags_update);
- -
- -void lu_session_tags_clear(__u32 tags)
- -{
- - spin_lock(&lu_keys_guard);
- - lu_session_tags_default &= ~tags;
- - key_set_version++;
- - spin_unlock(&lu_keys_guard);
- -}
- -EXPORT_SYMBOL(lu_session_tags_clear);
- -
- int lu_env_init(struct lu_env *env, __u32 tags)
- {
- int result;
- @@ -1768,31 +1696,6 @@ int lu_env_refill(struct lu_env *env)
- }
- EXPORT_SYMBOL(lu_env_refill);
- -/**
- - * Currently, this API will only be used by echo client.
- - * Because echo client and normal lustre client will share
- - * same cl_env cache. So echo client needs to refresh
- - * the env context after it get one from the cache, especially
- - * when normal client and echo client co-exist in the same client.
- - */
- -int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags,
- - __u32 stags)
- -{
- - if ((env->le_ctx.lc_tags & ctags) != ctags) {
- - env->le_ctx.lc_version = 0;
- - env->le_ctx.lc_tags |= ctags;
- - }
- -
- - if (env->le_ses && (env->le_ses->lc_tags & stags) != stags) {
- - env->le_ses->lc_version = 0;
- - env->le_ses->lc_tags |= stags;
- - }
- -
- - return lu_env_refill(env);
- -}
- -EXPORT_SYMBOL(lu_env_refill_by_tags);
- -
- -
- struct lu_site_stats {
- unsigned lss_populated;
- unsigned lss_max_search;
- @@ -1904,29 +1807,9 @@ static unsigned long lu_cache_shrink_scan(struct shrinker *sk,
- return sc->nr_to_scan - remain;
- }
- -/*
- - * Debugging stuff.
- - */
- -
- -/**
- - * Environment to be used in debugger, contains all tags.
- - */
- -struct lu_env lu_debugging_env;
- -
- /**
- * Debugging printer function using printk().
- */
- -int lu_printk_printer(const struct lu_env *env,
- - void *unused, const char *format, ...)
- -{
- - va_list args;
- -
- - va_start(args, format);
- - vprintk(format, args);
- - va_end(args);
- - return 0;
- -}
- -
- static struct shrinker lu_site_shrinker = {
- .count_objects = lu_cache_shrink_count,
- .scan_objects = lu_cache_shrink_scan,
- @@ -2069,127 +1952,3 @@ void lu_kmem_fini(struct lu_kmem_descr *caches)
- }
- }
- EXPORT_SYMBOL(lu_kmem_fini);
- -
- -/**
- - * Temporary solution to be able to assign fid in ->do_create()
- - * till we have fully-functional OST fids
- - */
- -void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o,
- - const struct lu_fid *fid)
- -{
- - struct lu_site *s = o->lo_dev->ld_site;
- - struct lu_fid *old = &o->lo_header->loh_fid;
- - struct lu_object *shadow;
- - wait_queue_t waiter;
- - struct cfs_hash *hs;
- - struct cfs_hash_bd bd;
- - __u64 version = 0;
- -
- - LASSERT(fid_is_zero(old));
- -
- - hs = s->ls_obj_hash;
- - cfs_hash_bd_get_and_lock(hs, (void *)fid, &bd, 1);
- - shadow = htable_lookup(s, &bd, fid, &waiter, &version);
- - /* supposed to be unique */
- - LASSERT(IS_ERR(shadow) && PTR_ERR(shadow) == -ENOENT);
- - *old = *fid;
- - cfs_hash_bd_add_locked(hs, &bd, &o->lo_header->loh_hash);
- - cfs_hash_bd_unlock(hs, &bd, 1);
- -}
- -EXPORT_SYMBOL(lu_object_assign_fid);
- -
- -/**
- - * allocates object with 0 (non-assigned) fid
- - * XXX: temporary solution to be able to assign fid in ->do_create()
- - * till we have fully-functional OST fids
- - */
- -struct lu_object *lu_object_anon(const struct lu_env *env,
- - struct lu_device *dev,
- - const struct lu_object_conf *conf)
- -{
- - struct lu_fid fid;
- - struct lu_object *o;
- -
- - fid_zero(&fid);
- - o = lu_object_alloc(env, dev, &fid, conf);
- -
- - return o;
- -}
- -EXPORT_SYMBOL(lu_object_anon);
- -
- -struct lu_buf LU_BUF_NULL = {
- - .lb_buf = NULL,
- - .lb_len = 0
- -};
- -EXPORT_SYMBOL(LU_BUF_NULL);
- -
- -void lu_buf_free(struct lu_buf *buf)
- -{
- - LASSERT(buf);
- - if (buf->lb_buf) {
- - LASSERT(buf->lb_len > 0);
- - kvfree(buf->lb_buf);
- - buf->lb_buf = NULL;
- - buf->lb_len = 0;
- - }
- -}
- -EXPORT_SYMBOL(lu_buf_free);
- -
- -void lu_buf_alloc(struct lu_buf *buf, int size)
- -{
- - LASSERT(buf);
- - LASSERT(buf->lb_buf == NULL);
- - LASSERT(buf->lb_len == 0);
- - buf->lb_buf = libcfs_kvzalloc(size, GFP_NOFS);
- - if (likely(buf->lb_buf))
- - buf->lb_len = size;
- -}
- -EXPORT_SYMBOL(lu_buf_alloc);
- -
- -void lu_buf_realloc(struct lu_buf *buf, int size)
- -{
- - lu_buf_free(buf);
- - lu_buf_alloc(buf, size);
- -}
- -EXPORT_SYMBOL(lu_buf_realloc);
- -
- -struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, int len)
- -{
- - if (buf->lb_buf == NULL && buf->lb_len == 0)
- - lu_buf_alloc(buf, len);
- -
- - if ((len > buf->lb_len) && (buf->lb_buf != NULL))
- - lu_buf_realloc(buf, len);
- -
- - return buf;
- -}
- -EXPORT_SYMBOL(lu_buf_check_and_alloc);
- -
- -/**
- - * Increase the size of the \a buf.
- - * preserves old data in buffer
- - * old buffer remains unchanged on error
- - * \retval 0 or -ENOMEM
- - */
- -int lu_buf_check_and_grow(struct lu_buf *buf, int len)
- -{
- - char *ptr;
- -
- - if (len <= buf->lb_len)
- - return 0;
- -
- - ptr = libcfs_kvzalloc(len, GFP_NOFS);
- - if (ptr == NULL)
- - return -ENOMEM;
- -
- - /* Free the old buf */
- - if (buf->lb_buf != NULL) {
- - memcpy(ptr, buf->lb_buf, buf->lb_len);
- - kvfree(buf->lb_buf);
- - }
- -
- - buf->lb_buf = ptr;
- - buf->lb_len = len;
- - return 0;
- -}
- -EXPORT_SYMBOL(lu_buf_check_and_grow);
- diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
- index 97d79dab2835..d19ec15cb463 100644
- --- a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
- +++ b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
- @@ -134,19 +134,6 @@ void class_handle_unhash(struct portals_handle *h)
- }
- EXPORT_SYMBOL(class_handle_unhash);
- -void class_handle_hash_back(struct portals_handle *h)
- -{
- - struct handle_bucket *bucket;
- -
- - bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK);
- -
- - spin_lock(&bucket->lock);
- - list_add_rcu(&h->h_link, &bucket->head);
- - h->h_in = 1;
- - spin_unlock(&bucket->lock);
- -}
- -EXPORT_SYMBOL(class_handle_hash_back);
- -
- void *class_handle2object(__u64 cookie)
- {
- struct handle_bucket *bucket;
- diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c
- index 3bbc80623b3a..4078a2d4b485 100644
- --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
- +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
- @@ -71,114 +71,6 @@ int class_find_param(char *buf, char *key, char **valp)
- }
- EXPORT_SYMBOL(class_find_param);
- -/**
- - * Check whether the proc parameter \a param is an old parameter or not from
- - * the array \a ptr which contains the mapping from old parameters to new ones.
- - * If it's an old one, then return the pointer to the cfg_interop_param struc-
- - * ture which contains both the old and new parameters.
- - *
- - * \param param proc parameter
- - * \param ptr an array which contains the mapping from
- - * old parameters to new ones
- - *
- - * \retval valid-pointer pointer to the cfg_interop_param structure
- - * which contains the old and new parameters
- - * \retval NULL \a param or \a ptr is NULL,
- - * or \a param is not an old parameter
- - */
- -struct cfg_interop_param *class_find_old_param(const char *param,
- - struct cfg_interop_param *ptr)
- -{
- - char *value = NULL;
- - int name_len = 0;
- -
- - if (!param || !ptr)
- - return NULL;
- -
- - value = strchr(param, '=');
- - if (!value)
- - name_len = strlen(param);
- - else
- - name_len = value - param;
- -
- - while (ptr->old_param != NULL) {
- - if (strncmp(param, ptr->old_param, name_len) == 0 &&
- - name_len == strlen(ptr->old_param))
- - return ptr;
- - ptr++;
- - }
- -
- - return NULL;
- -}
- -EXPORT_SYMBOL(class_find_old_param);
- -
- -/**
- - * Finds a parameter in \a params and copies it to \a copy.
- - *
- - * Leading spaces are skipped. Next space or end of string is the
- - * parameter terminator with the exception that spaces inside single or double
- - * quotes get included into a parameter. The parameter is copied into \a copy
- - * which has to be allocated big enough by a caller, quotes are stripped in
- - * the copy and the copy is terminated by 0.
- - *
- - * On return \a params is set to next parameter or to NULL if last
- - * parameter is returned.
- - *
- - * \retval 0 if parameter is returned in \a copy
- - * \retval 1 otherwise
- - * \retval -EINVAL if unbalanced quota is found
- - */
- -int class_get_next_param(char **params, char *copy)
- -{
- - char *q1, *q2, *str;
- - int len;
- -
- - str = *params;
- - while (*str == ' ')
- - str++;
- -
- - if (*str == '\0') {
- - *params = NULL;
- - return 1;
- - }
- -
- - while (1) {
- - q1 = strpbrk(str, " '\"");
- - if (!q1) {
- - len = strlen(str);
- - memcpy(copy, str, len);
- - copy[len] = '\0';
- - *params = NULL;
- - return 0;
- - }
- - len = q1 - str;
- - if (*q1 == ' ') {
- - memcpy(copy, str, len);
- - copy[len] = '\0';
- - *params = str + len;
- - return 0;
- - }
- -
- - memcpy(copy, str, len);
- - copy += len;
- -
- - /* search for the matching closing quote */
- - str = q1 + 1;
- - q2 = strchr(str, *q1);
- - if (!q2) {
- - CERROR("Unbalanced quota in parameters: \"%s\"\n",
- - *params);
- - return -EINVAL;
- - }
- - len = q2 - str;
- - memcpy(copy, str, len);
- - copy += len;
- - str = q2 + 1;
- - }
- - return 1;
- -}
- -EXPORT_SYMBOL(class_get_next_param);
- -
- /* returns 0 if this is the first key in the buffer, else 1.
- valp points to first char after key. */
- int class_match_param(char *buf, char *key, char **valp)
- @@ -278,52 +170,6 @@ int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh)
- }
- EXPORT_SYMBOL(class_parse_nid_quiet);
- -int class_parse_net(char *buf, __u32 *net, char **endh)
- -{
- - return class_parse_value(buf, CLASS_PARSE_NET, (void *)net, endh, 0);
- -}
- -EXPORT_SYMBOL(class_parse_net);
- -
- -/* 1 param contains key and match
- - * 0 param contains key and not match
- - * -1 param does not contain key
- - */
- -int class_match_nid(char *buf, char *key, lnet_nid_t nid)
- -{
- - lnet_nid_t tmp;
- - int rc = -1;
- -
- - while (class_find_param(buf, key, &buf) == 0) {
- - /* please restrict to the nids pertaining to
- - * the specified nids */
- - while (class_parse_nid(buf, &tmp, &buf) == 0) {
- - if (tmp == nid)
- - return 1;
- - }
- - rc = 0;
- - }
- - return rc;
- -}
- -EXPORT_SYMBOL(class_match_nid);
- -
- -int class_match_net(char *buf, char *key, __u32 net)
- -{
- - __u32 tmp;
- - int rc = -1;
- -
- - while (class_find_param(buf, key, &buf) == 0) {
- - /* please restrict to the nids pertaining to
- - * the specified networks */
- - while (class_parse_net(buf, &tmp, &buf) == 0) {
- - if (tmp == net)
- - return 1;
- - }
- - rc = 0;
- - }
- - return rc;
- -}
- -EXPORT_SYMBOL(class_match_net);
- -
- /********************** class fns **********************/
- /**
- @@ -939,78 +785,6 @@ void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg))
- }
- EXPORT_SYMBOL(lustre_register_client_process_config);
- -/**
- - * Rename the proc parameter in \a cfg with a new name \a new_name.
- - *
- - * \param cfg config structure which contains the proc parameter
- - * \param new_name new name of the proc parameter
- - *
- - * \retval valid-pointer pointer to the newly-allocated config structure
- - * which contains the renamed proc parameter
- - * \retval ERR_PTR(-EINVAL) if \a cfg or \a new_name is NULL, or \a cfg does
- - * not contain a proc parameter
- - * \retval ERR_PTR(-ENOMEM) if memory allocation failure occurs
- - */
- -struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg,
- - const char *new_name)
- -{
- - struct lustre_cfg_bufs *bufs = NULL;
- - struct lustre_cfg *new_cfg = NULL;
- - char *param = NULL;
- - char *new_param = NULL;
- - char *value = NULL;
- - int name_len = 0;
- - int new_len = 0;
- -
- - if (!cfg || !new_name)
- - return ERR_PTR(-EINVAL);
- -
- - param = lustre_cfg_string(cfg, 1);
- - if (!param)
- - return ERR_PTR(-EINVAL);
- -
- - value = strchr(param, '=');
- - if (!value)
- - name_len = strlen(param);
- - else
- - name_len = value - param;
- -
- - new_len = LUSTRE_CFG_BUFLEN(cfg, 1) + strlen(new_name) - name_len;
- -
- - new_param = kzalloc(new_len, GFP_NOFS);
- - if (!new_param)
- - return ERR_PTR(-ENOMEM);
- -
- - strcpy(new_param, new_name);
- - if (value != NULL)
- - strcat(new_param, value);
- -
- - bufs = kzalloc(sizeof(*bufs), GFP_NOFS);
- - if (!bufs) {
- - kfree(new_param);
- - return ERR_PTR(-ENOMEM);
- - }
- -
- - lustre_cfg_bufs_reset(bufs, NULL);
- - lustre_cfg_bufs_init(bufs, cfg);
- - lustre_cfg_bufs_set_string(bufs, 1, new_param);
- -
- - new_cfg = lustre_cfg_new(cfg->lcfg_command, bufs);
- -
- - kfree(new_param);
- - kfree(bufs);
- - if (!new_cfg)
- - return ERR_PTR(-ENOMEM);
- -
- - new_cfg->lcfg_num = cfg->lcfg_num;
- - new_cfg->lcfg_flags = cfg->lcfg_flags;
- - new_cfg->lcfg_nid = cfg->lcfg_nid;
- - new_cfg->lcfg_nal = cfg->lcfg_nal;
- -
- - return new_cfg;
- -}
- -EXPORT_SYMBOL(lustre_cfg_rename);
- -
- static int process_param2_config(struct lustre_cfg *lcfg)
- {
- char *param = lustre_cfg_string(lcfg, 1);
- @@ -1051,12 +825,6 @@ static int process_param2_config(struct lustre_cfg *lcfg)
- return rc;
- }
- -void lustre_register_quota_process_config(int (*qpc)(struct lustre_cfg *lcfg))
- -{
- - quota_process_config = qpc;
- -}
- -EXPORT_SYMBOL(lustre_register_quota_process_config);
- -
- /** Process configuration commands given in lustre_cfg form.
- * These may come from direct calls (e.g. class_manual_cleanup)
- * or processing the config llog, or ioctl from lctl.
- @@ -1647,31 +1415,6 @@ int class_config_dump_handler(const struct lu_env *env,
- return rc;
- }
- -int class_config_dump_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
- - char *name, struct config_llog_instance *cfg)
- -{
- - struct llog_handle *llh;
- - int rc;
- -
- - LCONSOLE_INFO("Dumping config log %s\n", name);
- -
- - rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
- - if (rc)
- - return rc;
- -
- - rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
- - if (rc)
- - goto parse_out;
- -
- - rc = llog_process(env, llh, class_config_dump_handler, cfg, NULL);
- -parse_out:
- - llog_close(env, llh);
- -
- - LCONSOLE_INFO("End config log %s\n", name);
- - return rc;
- -}
- -EXPORT_SYMBOL(class_config_dump_llog);
- -
- /** Call class_cleanup and class_detach.
- * "Manual" only in the sense that we're faking lcfg commands.
- */
- diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
- index 16009a6867c9..bc15e1546844 100644
- --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
- +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
- @@ -599,33 +599,6 @@ int server_name2fsname(const char *svname, char *fsname, const char **endptr)
- }
- EXPORT_SYMBOL(server_name2fsname);
- -/**
- - * Get service name (svname) from string
- - * rc < 0 on error
- - * if endptr isn't NULL it is set to end of fsname *
- - */
- -int server_name2svname(const char *label, char *svname, const char **endptr,
- - size_t svsize)
- -{
- - int rc;
- - const char *dash;
- -
- - /* We use server_name2fsname() just for parsing */
- - rc = server_name2fsname(label, NULL, &dash);
- - if (rc != 0)
- - return rc;
- -
- - if (endptr != NULL)
- - *endptr = dash;
- -
- - if (strlcpy(svname, dash + 1, svsize) >= svsize)
- - return -E2BIG;
- -
- - return 0;
- -}
- -EXPORT_SYMBOL(server_name2svname);
- -
- -
- /* Get the index from the obd name.
- rc = server type, or
- rc < 0 on error
- diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
- index 307ffe347186..1a950fb8e769 100644
- --- a/drivers/staging/lustre/lustre/obdclass/obdo.c
- +++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
- @@ -115,90 +115,6 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
- }
- EXPORT_SYMBOL(obdo_from_inode);
- -void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid)
- -{
- - CDEBUG(D_INODE, "src obdo "DOSTID" valid %#llx, dst obdo "DOSTID"\n",
- - POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi));
- - if (valid & OBD_MD_FLATIME)
- - dst->o_atime = src->o_atime;
- - if (valid & OBD_MD_FLMTIME)
- - dst->o_mtime = src->o_mtime;
- - if (valid & OBD_MD_FLCTIME)
- - dst->o_ctime = src->o_ctime;
- - if (valid & OBD_MD_FLSIZE)
- - dst->o_size = src->o_size;
- - if (valid & OBD_MD_FLBLOCKS) /* allocation of space */
- - dst->o_blocks = src->o_blocks;
- - if (valid & OBD_MD_FLBLKSZ)
- - dst->o_blksize = src->o_blksize;
- - if (valid & OBD_MD_FLTYPE)
- - dst->o_mode = (dst->o_mode & ~S_IFMT) | (src->o_mode & S_IFMT);
- - if (valid & OBD_MD_FLMODE)
- - dst->o_mode = (dst->o_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
- - if (valid & OBD_MD_FLUID)
- - dst->o_uid = src->o_uid;
- - if (valid & OBD_MD_FLGID)
- - dst->o_gid = src->o_gid;
- - if (valid & OBD_MD_FLFLAGS)
- - dst->o_flags = src->o_flags;
- - if (valid & OBD_MD_FLFID) {
- - dst->o_parent_seq = src->o_parent_seq;
- - dst->o_parent_ver = src->o_parent_ver;
- - }
- - if (valid & OBD_MD_FLGENER)
- - dst->o_parent_oid = src->o_parent_oid;
- - if (valid & OBD_MD_FLHANDLE)
- - dst->o_handle = src->o_handle;
- - if (valid & OBD_MD_FLCOOKIE)
- - dst->o_lcookie = src->o_lcookie;
- -
- - dst->o_valid |= valid;
- -}
- -EXPORT_SYMBOL(obdo_cpy_md);
- -
- -/* returns FALSE if comparison (by flags) is same, TRUE if changed */
- -int obdo_cmp_md(struct obdo *dst, struct obdo *src, u32 compare)
- -{
- - int res = 0;
- -
- - if (compare & OBD_MD_FLATIME)
- - res |= dst->o_atime != src->o_atime;
- - if (compare & OBD_MD_FLMTIME)
- - res |= dst->o_mtime != src->o_mtime;
- - if (compare & OBD_MD_FLCTIME)
- - res |= dst->o_ctime != src->o_ctime;
- - if (compare & OBD_MD_FLSIZE)
- - res |= dst->o_size != src->o_size;
- - if (compare & OBD_MD_FLBLOCKS) /* allocation of space */
- - res |= dst->o_blocks != src->o_blocks;
- - if (compare & OBD_MD_FLBLKSZ)
- - res |= dst->o_blksize != src->o_blksize;
- - if (compare & OBD_MD_FLTYPE)
- - res |= ((dst->o_mode ^ src->o_mode) & S_IFMT) != 0;
- - if (compare & OBD_MD_FLMODE)
- - res |= ((dst->o_mode ^ src->o_mode) & ~S_IFMT) != 0;
- - if (compare & OBD_MD_FLUID)
- - res |= dst->o_uid != src->o_uid;
- - if (compare & OBD_MD_FLGID)
- - res |= dst->o_gid != src->o_gid;
- - if (compare & OBD_MD_FLFLAGS)
- - res |= dst->o_flags != src->o_flags;
- - if (compare & OBD_MD_FLNLINK)
- - res |= dst->o_nlink != src->o_nlink;
- - if (compare & OBD_MD_FLFID) {
- - res |= dst->o_parent_seq != src->o_parent_seq;
- - res |= dst->o_parent_ver != src->o_parent_ver;
- - }
- - if (compare & OBD_MD_FLGENER)
- - res |= dst->o_parent_oid != src->o_parent_oid;
- - /* XXX Don't know if these should be included here - wasn't previously
- - if ( compare & OBD_MD_FLINLINE )
- - res |= memcmp(dst->o_inline, src->o_inline);
- - */
- - return res;
- -}
- -EXPORT_SYMBOL(obdo_cmp_md);
- -
- void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj)
- {
- ioobj->ioo_oid = oa->o_oi;
- @@ -211,42 +127,6 @@ void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj)
- }
- EXPORT_SYMBOL(obdo_to_ioobj);
- -void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned int ia_valid)
- -{
- - if (ia_valid & ATTR_ATIME) {
- - oa->o_atime = LTIME_S(attr->ia_atime);
- - oa->o_valid |= OBD_MD_FLATIME;
- - }
- - if (ia_valid & ATTR_MTIME) {
- - oa->o_mtime = LTIME_S(attr->ia_mtime);
- - oa->o_valid |= OBD_MD_FLMTIME;
- - }
- - if (ia_valid & ATTR_CTIME) {
- - oa->o_ctime = LTIME_S(attr->ia_ctime);
- - oa->o_valid |= OBD_MD_FLCTIME;
- - }
- - if (ia_valid & ATTR_SIZE) {
- - oa->o_size = attr->ia_size;
- - oa->o_valid |= OBD_MD_FLSIZE;
- - }
- - if (ia_valid & ATTR_MODE) {
- - oa->o_mode = attr->ia_mode;
- - oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
- - if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
- - !capable(CFS_CAP_FSETID))
- - oa->o_mode &= ~S_ISGID;
- - }
- - if (ia_valid & ATTR_UID) {
- - oa->o_uid = from_kuid(&init_user_ns, attr->ia_uid);
- - oa->o_valid |= OBD_MD_FLUID;
- - }
- - if (ia_valid & ATTR_GID) {
- - oa->o_gid = from_kgid(&init_user_ns, attr->ia_gid);
- - oa->o_valid |= OBD_MD_FLGID;
- - }
- -}
- -EXPORT_SYMBOL(obdo_from_iattr);
- -
- void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid)
- {
- valid &= oa->o_valid;
- @@ -310,53 +190,3 @@ void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid)
- }
- }
- EXPORT_SYMBOL(md_from_obdo);
- -
- -void obdo_from_md(struct obdo *oa, struct md_op_data *op_data,
- - unsigned int valid)
- -{
- - obdo_from_iattr(oa, &op_data->op_attr, valid);
- - if (valid & ATTR_BLOCKS) {
- - oa->o_blocks = op_data->op_attr_blocks;
- - oa->o_valid |= OBD_MD_FLBLOCKS;
- - }
- - if (valid & ATTR_ATTR_FLAG) {
- - oa->o_flags =
- - ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
- - oa->o_valid |= OBD_MD_FLFLAGS;
- - }
- -}
- -EXPORT_SYMBOL(obdo_from_md);
- -
- -void obdo_cpu_to_le(struct obdo *dobdo, struct obdo *sobdo)
- -{
- - dobdo->o_size = cpu_to_le64(sobdo->o_size);
- - dobdo->o_mtime = cpu_to_le64(sobdo->o_mtime);
- - dobdo->o_atime = cpu_to_le64(sobdo->o_atime);
- - dobdo->o_ctime = cpu_to_le64(sobdo->o_ctime);
- - dobdo->o_blocks = cpu_to_le64(sobdo->o_blocks);
- - dobdo->o_mode = cpu_to_le32(sobdo->o_mode);
- - dobdo->o_uid = cpu_to_le32(sobdo->o_uid);
- - dobdo->o_gid = cpu_to_le32(sobdo->o_gid);
- - dobdo->o_flags = cpu_to_le32(sobdo->o_flags);
- - dobdo->o_nlink = cpu_to_le32(sobdo->o_nlink);
- - dobdo->o_blksize = cpu_to_le32(sobdo->o_blksize);
- - dobdo->o_valid = cpu_to_le64(sobdo->o_valid);
- -}
- -EXPORT_SYMBOL(obdo_cpu_to_le);
- -
- -void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo)
- -{
- - dobdo->o_size = le64_to_cpu(sobdo->o_size);
- - dobdo->o_mtime = le64_to_cpu(sobdo->o_mtime);
- - dobdo->o_atime = le64_to_cpu(sobdo->o_atime);
- - dobdo->o_ctime = le64_to_cpu(sobdo->o_ctime);
- - dobdo->o_blocks = le64_to_cpu(sobdo->o_blocks);
- - dobdo->o_mode = le32_to_cpu(sobdo->o_mode);
- - dobdo->o_uid = le32_to_cpu(sobdo->o_uid);
- - dobdo->o_gid = le32_to_cpu(sobdo->o_gid);
- - dobdo->o_flags = le32_to_cpu(sobdo->o_flags);
- - dobdo->o_nlink = le32_to_cpu(sobdo->o_nlink);
- - dobdo->o_blksize = le32_to_cpu(sobdo->o_blksize);
- - dobdo->o_valid = le64_to_cpu(sobdo->o_valid);
- -}
- -EXPORT_SYMBOL(obdo_le_to_cpu);
- diff --git a/drivers/staging/lustre/lustre/obdclass/statfs_pack.c b/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
- index cc785ab3f29a..fb4e3ae845e0 100644
- --- a/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
- +++ b/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
- @@ -46,20 +46,6 @@
- #include "../include/obd_support.h"
- #include "../include/obd_class.h"
- -void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs)
- -{
- - memset(osfs, 0, sizeof(*osfs));
- - osfs->os_type = sfs->f_type;
- - osfs->os_blocks = sfs->f_blocks;
- - osfs->os_bfree = sfs->f_bfree;
- - osfs->os_bavail = sfs->f_bavail;
- - osfs->os_files = sfs->f_files;
- - osfs->os_ffree = sfs->f_ffree;
- - osfs->os_bsize = sfs->f_bsize;
- - osfs->os_namelen = sfs->f_namelen;
- -}
- -EXPORT_SYMBOL(statfs_pack);
- -
- void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs)
- {
- memset(sfs, 0, sizeof(*sfs));
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
- index d013d4b512ce..6aaa5dd55a92 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/client.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
- @@ -802,48 +802,6 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp,
- EXPORT_SYMBOL(ptlrpc_request_alloc_pack);
- /**
- - * Prepare request (fetched from pool \a pool if not NULL) on import \a imp
- - * for operation \a opcode. Request would contain \a count buffers.
- - * Sizes of buffers are described in array \a lengths and buffers themselves
- - * are provided by a pointer \a bufs.
- - * Returns prepared request structure pointer or NULL on error.
- - */
- -struct ptlrpc_request *
- -ptlrpc_prep_req_pool(struct obd_import *imp,
- - __u32 version, int opcode,
- - int count, __u32 *lengths, char **bufs,
- - struct ptlrpc_request_pool *pool)
- -{
- - struct ptlrpc_request *request;
- - int rc;
- -
- - request = __ptlrpc_request_alloc(imp, pool);
- - if (!request)
- - return NULL;
- -
- - rc = __ptlrpc_request_bufs_pack(request, version, opcode, count,
- - lengths, bufs, NULL);
- - if (rc) {
- - ptlrpc_request_free(request);
- - request = NULL;
- - }
- - return request;
- -}
- -EXPORT_SYMBOL(ptlrpc_prep_req_pool);
- -
- -/**
- - * Same as ptlrpc_prep_req_pool, but without pool
- - */
- -struct ptlrpc_request *
- -ptlrpc_prep_req(struct obd_import *imp, __u32 version, int opcode, int count,
- - __u32 *lengths, char **bufs)
- -{
- - return ptlrpc_prep_req_pool(imp, version, opcode, count, lengths, bufs,
- - NULL);
- -}
- -EXPORT_SYMBOL(ptlrpc_prep_req);
- -
- -/**
- * Allocate and initialize new request set structure on the current CPT.
- * Returns a pointer to the newly allocated set structure or NULL on error.
- */
- @@ -959,28 +917,6 @@ void ptlrpc_set_destroy(struct ptlrpc_request_set *set)
- EXPORT_SYMBOL(ptlrpc_set_destroy);
- /**
- - * Add a callback function \a fn to the set.
- - * This function would be called when all requests on this set are completed.
- - * The function will be passed \a data argument.
- - */
- -int ptlrpc_set_add_cb(struct ptlrpc_request_set *set,
- - set_interpreter_func fn, void *data)
- -{
- - struct ptlrpc_set_cbdata *cbdata;
- -
- - cbdata = kzalloc(sizeof(*cbdata), GFP_NOFS);
- - if (!cbdata)
- - return -ENOMEM;
- -
- - cbdata->psc_interpret = fn;
- - cbdata->psc_data = data;
- - list_add_tail(&cbdata->psc_item, &set->set_cblist);
- -
- - return 0;
- -}
- -EXPORT_SYMBOL(ptlrpc_set_add_cb);
- -
- -/**
- * Add a new request to the general purpose request set.
- * Assumes request reference from the caller.
- */
- @@ -2282,18 +2218,6 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)
- ptlrpc_request_cache_free(request);
- }
- -static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked);
- -/**
- - * Drop one request reference. Must be called with import imp_lock held.
- - * When reference count drops to zero, request is freed.
- - */
- -void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request)
- -{
- - assert_spin_locked(&request->rq_import->imp_lock);
- - (void)__ptlrpc_req_finished(request, 1);
- -}
- -EXPORT_SYMBOL(ptlrpc_req_finished_with_imp_lock);
- -
- /**
- * Helper function
- * Drops one reference count for request \a request.
- @@ -2535,11 +2459,6 @@ free_req:
- }
- }
- -void ptlrpc_cleanup_client(struct obd_import *imp)
- -{
- -}
- -EXPORT_SYMBOL(ptlrpc_cleanup_client);
- -
- /**
- * Schedule previously sent request for resend.
- * For bulk requests we assign new xid (to avoid problems with
- @@ -2578,20 +2497,6 @@ void ptlrpc_resend_req(struct ptlrpc_request *req)
- }
- EXPORT_SYMBOL(ptlrpc_resend_req);
- -/* XXX: this function and rq_status are currently unused */
- -void ptlrpc_restart_req(struct ptlrpc_request *req)
- -{
- - DEBUG_REQ(D_HA, req, "restarting (possibly-)completed request");
- - req->rq_status = -ERESTARTSYS;
- -
- - spin_lock(&req->rq_lock);
- - req->rq_restart = 1;
- - req->rq_timedout = 0;
- - ptlrpc_client_wake_req(req);
- - spin_unlock(&req->rq_lock);
- -}
- -EXPORT_SYMBOL(ptlrpc_restart_req);
- -
- /**
- * Grab additional reference on a request \a req
- */
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c
- index 9ff1a22b1b67..1ac265dfce2f 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/import.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c
- @@ -142,7 +142,6 @@ void deuuidify(char *uuid, const char *prefix, char **uuid_start, int *uuid_len)
- UUID_STR, strlen(UUID_STR)))
- *uuid_len -= strlen(UUID_STR);
- }
- -EXPORT_SYMBOL(deuuidify);
- /**
- * Returns true if import was FULL, false if import was already not
- @@ -1503,16 +1502,6 @@ out:
- }
- EXPORT_SYMBOL(ptlrpc_disconnect_import);
- -void ptlrpc_cleanup_imp(struct obd_import *imp)
- -{
- - spin_lock(&imp->imp_lock);
- - IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_CLOSED);
- - imp->imp_generation++;
- - spin_unlock(&imp->imp_lock);
- - ptlrpc_abort_inflight(imp);
- -}
- -EXPORT_SYMBOL(ptlrpc_cleanup_imp);
- -
- /* Adaptive Timeout utils */
- extern unsigned int at_min, at_max, at_history;
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c
- index 5d19cfcfe7e9..991fb74c8d08 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c
- @@ -1996,55 +1996,6 @@ static void *__req_capsule_get(struct req_capsule *pill,
- }
- /**
- - * Dump a request and/or reply
- - */
- -static void __req_capsule_dump(struct req_capsule *pill, enum req_location loc)
- -{
- - const struct req_format *fmt;
- - const struct req_msg_field *field;
- - int len;
- - int i;
- -
- - fmt = pill->rc_fmt;
- -
- - DEBUG_REQ(D_RPCTRACE, pill->rc_req, "BEGIN REQ CAPSULE DUMP\n");
- - for (i = 0; i < fmt->rf_fields[loc].nr; ++i) {
- - field = FMT_FIELD(fmt, loc, i);
- - if (field->rmf_dumper == NULL) {
- - /*
- - * FIXME Add a default hex dumper for fields that don't
- - * have a specific dumper
- - */
- - len = req_capsule_get_size(pill, field, loc);
- - CDEBUG(D_RPCTRACE, "Field %s has no dumper function; field size is %d\n",
- - field->rmf_name, len);
- - } else {
- - /* It's the dumping side-effect that we're interested in */
- - (void) __req_capsule_get(pill, field, loc, NULL, 1);
- - }
- - }
- - CDEBUG(D_RPCTRACE, "END REQ CAPSULE DUMP\n");
- -}
- -
- -/**
- - * Dump a request.
- - */
- -void req_capsule_client_dump(struct req_capsule *pill)
- -{
- - __req_capsule_dump(pill, RCL_CLIENT);
- -}
- -EXPORT_SYMBOL(req_capsule_client_dump);
- -
- -/**
- - * Dump a reply
- - */
- -void req_capsule_server_dump(struct req_capsule *pill)
- -{
- - __req_capsule_dump(pill, RCL_SERVER);
- -}
- -EXPORT_SYMBOL(req_capsule_server_dump);
- -
- -/**
- * Trivial wrapper around __req_capsule_get(), that returns the PTLRPC request
- * buffer corresponding to the given RMF (\a field) of a \a pill.
- */
- @@ -2136,21 +2087,6 @@ void *req_capsule_server_sized_swab_get(struct req_capsule *pill,
- EXPORT_SYMBOL(req_capsule_server_sized_swab_get);
- /**
- - * Returns the buffer of a \a pill corresponding to the given \a field from the
- - * request (if the caller is executing on the server-side) or reply (if the
- - * caller is executing on the client-side).
- - *
- - * This function convenient for use is code that could be executed on the
- - * client and server alike.
- - */
- -const void *req_capsule_other_get(struct req_capsule *pill,
- - const struct req_msg_field *field)
- -{
- - return __req_capsule_get(pill, field, pill->rc_loc ^ 1, NULL, 0);
- -}
- -EXPORT_SYMBOL(req_capsule_other_get);
- -
- -/**
- * Set the size of the PTLRPC request/reply (\a loc) buffer for the given \a
- * field of the given \a pill.
- *
- @@ -2376,67 +2312,5 @@ void req_capsule_shrink(struct req_capsule *pill,
- }
- EXPORT_SYMBOL(req_capsule_shrink);
- -int req_capsule_server_grow(struct req_capsule *pill,
- - const struct req_msg_field *field,
- - unsigned int newlen)
- -{
- - struct ptlrpc_reply_state *rs = pill->rc_req->rq_reply_state, *nrs;
- - char *from, *to;
- - int offset, len, rc;
- -
- - LASSERT(pill->rc_fmt != NULL);
- - LASSERT(__req_format_is_sane(pill->rc_fmt));
- - LASSERT(req_capsule_has_field(pill, field, RCL_SERVER));
- - LASSERT(req_capsule_field_present(pill, field, RCL_SERVER));
- -
- - len = req_capsule_get_size(pill, field, RCL_SERVER);
- - offset = __req_capsule_offset(pill, field, RCL_SERVER);
- - if (pill->rc_req->rq_repbuf_len >=
- - lustre_packed_msg_size(pill->rc_req->rq_repmsg) - len + newlen)
- - CERROR("Inplace repack might be done\n");
- -
- - pill->rc_req->rq_reply_state = NULL;
- - req_capsule_set_size(pill, field, RCL_SERVER, newlen);
- - rc = req_capsule_server_pack(pill);
- - if (rc) {
- - /* put old rs back, the caller will decide what to do */
- - pill->rc_req->rq_reply_state = rs;
- - return rc;
- - }
- - nrs = pill->rc_req->rq_reply_state;
- - /* Now we need only buffers, copy first chunk */
- - to = lustre_msg_buf(nrs->rs_msg, 0, 0);
- - from = lustre_msg_buf(rs->rs_msg, 0, 0);
- - len = (char *)lustre_msg_buf(rs->rs_msg, offset, 0) - from;
- - memcpy(to, from, len);
- - /* check if we have tail and copy it too */
- - if (rs->rs_msg->lm_bufcount > offset + 1) {
- - to = lustre_msg_buf(nrs->rs_msg, offset + 1, 0);
- - from = lustre_msg_buf(rs->rs_msg, offset + 1, 0);
- - offset = rs->rs_msg->lm_bufcount - 1;
- - len = (char *)lustre_msg_buf(rs->rs_msg, offset, 0) +
- - cfs_size_round(rs->rs_msg->lm_buflens[offset]) - from;
- - memcpy(to, from, len);
- - }
- - /* drop old reply if everything is fine */
- - if (rs->rs_difficult) {
- - /* copy rs data */
- - int i;
- -
- - nrs->rs_difficult = 1;
- - nrs->rs_no_ack = rs->rs_no_ack;
- - for (i = 0; i < rs->rs_nlocks; i++) {
- - nrs->rs_locks[i] = rs->rs_locks[i];
- - nrs->rs_modes[i] = rs->rs_modes[i];
- - nrs->rs_nlocks++;
- - }
- - rs->rs_nlocks = 0;
- - rs->rs_difficult = 0;
- - rs->rs_no_ack = 0;
- - }
- - ptlrpc_rs_decref(rs);
- - return 0;
- -}
- -EXPORT_SYMBOL(req_capsule_server_grow);
- /* __REQ_LAYOUT_USER__ */
- #endif
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
- index 500687d9071f..b507c82ab0a3 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
- @@ -891,36 +891,6 @@ ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s,
- return NULL;
- }
- -/* common ost/mdt so_req_printer */
- -void target_print_req(void *seq_file, struct ptlrpc_request *req)
- -{
- - /* Called holding srv_lock with irqs disabled.
- - * Print specific req contents and a newline.
- - * CAVEAT EMPTOR: check request message length before printing!!!
- - * You might have received any old crap so you must be just as
- - * careful here as the service's request parser!!! */
- - struct seq_file *sf = seq_file;
- -
- - switch (req->rq_phase) {
- - case RQ_PHASE_NEW:
- - /* still awaiting a service thread's attention, or rejected
- - * because the generic request message didn't unpack */
- - seq_printf(sf, "<not swabbed>\n");
- - break;
- - case RQ_PHASE_INTERPRET:
- - /* being handled, so basic msg swabbed, and opc is valid
- - * but racing with mds_handle() */
- - case RQ_PHASE_COMPLETE:
- - /* been handled by mds_handle() reply state possibly still
- - * volatile */
- - seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg));
- - break;
- - default:
- - DEBUG_REQ(D_ERROR, req, "bad phase %d", req->rq_phase);
- - }
- -}
- -EXPORT_SYMBOL(target_print_req);
- -
- static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
- {
- struct ptlrpc_service *svc = s->private;
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
- index d37cdd5ac580..61c9ac3c9da2 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
- @@ -478,7 +478,6 @@ static void nrs_resource_get_safe(struct ptlrpc_nrs *nrs,
- *
- * \param resp the resource hierarchy that is being released
- *
- - * \see ptlrpc_nrs_req_hp_move()
- * \see ptlrpc_nrs_req_finalize()
- */
- static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp)
- @@ -1252,70 +1251,6 @@ fail:
- EXPORT_SYMBOL(ptlrpc_nrs_policy_register);
- /**
- - * Unregisters a previously registered policy with NRS core. All instances of
- - * the policy on all NRS heads of all supported services are removed.
- - *
- - * N.B. This function should only be called from a module's exit() function.
- - * Although it can be used for policies that ship alongside NRS core, the
- - * function is primarily intended for policies that register externally,
- - * from other modules.
- - *
- - * \param[in] conf configuration information for the policy to unregister
- - *
- - * \retval -ve error
- - * \retval 0 success
- - */
- -int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf)
- -{
- - struct ptlrpc_nrs_pol_desc *desc;
- - int rc;
- -
- - LASSERT(conf != NULL);
- -
- - if (conf->nc_flags & PTLRPC_NRS_FL_FALLBACK) {
- - CERROR("Unable to unregister a fallback policy, unless the PTLRPC service is stopping.\n");
- - return -EPERM;
- - }
- -
- - conf->nc_name[NRS_POL_NAME_MAX - 1] = '\0';
- -
- - mutex_lock(&nrs_core.nrs_mutex);
- -
- - desc = nrs_policy_find_desc_locked(conf->nc_name);
- - if (desc == NULL) {
- - CERROR("Failing to unregister NRS policy %s which has not been registered with NRS core!\n",
- - conf->nc_name);
- - rc = -ENOENT;
- - goto not_exist;
- - }
- -
- - mutex_lock(&ptlrpc_all_services_mutex);
- -
- - rc = nrs_policy_unregister_locked(desc);
- - if (rc < 0) {
- - if (rc == -EBUSY)
- - CERROR("Please first stop policy %s on all service partitions and then retry to unregister the policy.\n",
- - conf->nc_name);
- - goto fail;
- - }
- -
- - CDEBUG(D_INFO, "Unregistering policy %s from NRS core.\n",
- - conf->nc_name);
- -
- - list_del(&desc->pd_list);
- - kfree(desc);
- -
- -fail:
- - mutex_unlock(&ptlrpc_all_services_mutex);
- -
- -not_exist:
- - mutex_unlock(&nrs_core.nrs_mutex);
- -
- - return rc;
- -}
- -EXPORT_SYMBOL(ptlrpc_nrs_policy_unregister);
- -
- -/**
- * Setup NRS heads on all service partitions of service \a svc, and register
- * all compatible policies on those NRS heads.
- *
- @@ -1554,22 +1489,6 @@ ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp,
- }
- /**
- - * Dequeues request \a req from the policy it has been enqueued on.
- - *
- - * \param[in] req the request
- - */
- -void ptlrpc_nrs_req_del_nolock(struct ptlrpc_request *req)
- -{
- - struct ptlrpc_nrs_policy *policy = nrs_request_policy(&req->rq_nrq);
- -
- - policy->pol_desc->pd_ops->op_req_dequeue(policy, &req->rq_nrq);
- -
- - req->rq_nrq.nr_enqueued = 0;
- -
- - nrs_request_removed(policy);
- -}
- -
- -/**
- * Returns whether there are any requests currently enqueued on any of the
- * policies of service partition's \a svcpt NRS head specified by \a hp. Should
- * be called while holding ptlrpc_service_part::scp_req_lock to get a reliable
- @@ -1590,48 +1509,6 @@ bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp)
- };
- /**
- - * Moves request \a req from the regular to the high-priority NRS head.
- - *
- - * \param[in] req the request to move
- - */
- -void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req)
- -{
- - struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
- - struct ptlrpc_nrs_request *nrq = &req->rq_nrq;
- - struct ptlrpc_nrs_resource *res1[NRS_RES_MAX];
- - struct ptlrpc_nrs_resource *res2[NRS_RES_MAX];
- -
- - /**
- - * Obtain the high-priority NRS head resources.
- - */
- - nrs_resource_get_safe(nrs_svcpt2nrs(svcpt, true), nrq, res1, true);
- -
- - spin_lock(&svcpt->scp_req_lock);
- -
- - if (!ptlrpc_nrs_req_can_move(req))
- - goto out;
- -
- - ptlrpc_nrs_req_del_nolock(req);
- -
- - memcpy(res2, nrq->nr_res_ptrs, NRS_RES_MAX * sizeof(res2[0]));
- - memcpy(nrq->nr_res_ptrs, res1, NRS_RES_MAX * sizeof(res1[0]));
- -
- - ptlrpc_nrs_hpreq_add_nolock(req);
- -
- - memcpy(res1, res2, NRS_RES_MAX * sizeof(res1[0]));
- -out:
- - spin_unlock(&svcpt->scp_req_lock);
- -
- - /**
- - * Release either the regular NRS head resources if we moved the
- - * request, or the high-priority NRS head resources if we took a
- - * reference earlier in this function and ptlrpc_nrs_req_can_move()
- - * returned false.
- - */
- - nrs_resource_put_safe(res1);
- -}
- -
- -/**
- * Carries out a control operation \a opc on the policy identified by the
- * human-readable \a name, on either all partitions, or only on the first
- * partition of service \a svc.
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
- index 1b30ac59ef62..409b77785917 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
- @@ -94,30 +94,6 @@ int ptlrpc_buf_need_swab(struct ptlrpc_request *req, const int inout,
- }
- EXPORT_SYMBOL(ptlrpc_buf_need_swab);
- -static inline int lustre_msg_check_version_v2(struct lustre_msg_v2 *msg,
- - __u32 version)
- -{
- - __u32 ver = lustre_msg_get_version(msg);
- - return (ver & LUSTRE_VERSION_MASK) != version;
- -}
- -
- -int lustre_msg_check_version(struct lustre_msg *msg, __u32 version)
- -{
- -#define LUSTRE_MSG_MAGIC_V1 0x0BD00BD0
- - switch (msg->lm_magic) {
- - case LUSTRE_MSG_MAGIC_V1:
- - CERROR("msg v1 not supported - please upgrade you system\n");
- - return -EINVAL;
- - case LUSTRE_MSG_MAGIC_V2:
- - return lustre_msg_check_version_v2(msg, version);
- - default:
- - CERROR("incorrect message magic: %08x\n", msg->lm_magic);
- - return 0;
- - }
- -#undef LUSTRE_MSG_MAGIC_V1
- -}
- -EXPORT_SYMBOL(lustre_msg_check_version);
- -
- /* early reply size */
- int lustre_msg_early_size(void)
- {
- @@ -695,28 +671,6 @@ int lustre_msg_buflen(struct lustre_msg *m, int n)
- }
- EXPORT_SYMBOL(lustre_msg_buflen);
- -static inline void
- -lustre_msg_set_buflen_v2(struct lustre_msg_v2 *m, int n, int len)
- -{
- - if (n >= m->lm_bufcount)
- - LBUG();
- -
- - m->lm_buflens[n] = len;
- -}
- -
- -void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len)
- -{
- - switch (m->lm_magic) {
- - case LUSTRE_MSG_MAGIC_V2:
- - lustre_msg_set_buflen_v2(m, n, len);
- - return;
- - default:
- - LASSERTF(0, "incorrect message magic: %08x\n", m->lm_magic);
- - }
- -}
- -
- -EXPORT_SYMBOL(lustre_msg_set_buflen);
- -
- /* NB return the bufcount for lustre_msg_v2 format, so if message is packed
- * in V1 format, the result is one bigger. (add struct ptlrpc_body). */
- int lustre_msg_bufcount(struct lustre_msg *m)
- @@ -958,24 +912,6 @@ __u32 lustre_msg_get_type(struct lustre_msg *msg)
- }
- EXPORT_SYMBOL(lustre_msg_get_type);
- -__u32 lustre_msg_get_version(struct lustre_msg *msg)
- -{
- - switch (msg->lm_magic) {
- - case LUSTRE_MSG_MAGIC_V2: {
- - struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
- - if (!pb) {
- - CERROR("invalid msg %p: no ptlrpc body!\n", msg);
- - return 0;
- - }
- - return pb->pb_version;
- - }
- - default:
- - CERROR("incorrect message magic: %08x\n", msg->lm_magic);
- - return 0;
- - }
- -}
- -EXPORT_SYMBOL(lustre_msg_get_version);
- -
- void lustre_msg_add_version(struct lustre_msg *msg, int version)
- {
- switch (msg->lm_magic) {
- @@ -1010,24 +946,6 @@ __u32 lustre_msg_get_opc(struct lustre_msg *msg)
- }
- EXPORT_SYMBOL(lustre_msg_get_opc);
- -__u64 lustre_msg_get_last_xid(struct lustre_msg *msg)
- -{
- - switch (msg->lm_magic) {
- - case LUSTRE_MSG_MAGIC_V2: {
- - struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
- - if (!pb) {
- - CERROR("invalid msg %p: no ptlrpc body!\n", msg);
- - return 0;
- - }
- - return pb->pb_last_xid;
- - }
- - default:
- - CERROR("incorrect message magic: %08x\n", msg->lm_magic);
- - return 0;
- - }
- -}
- -EXPORT_SYMBOL(lustre_msg_get_last_xid);
- -
- __u64 lustre_msg_get_last_committed(struct lustre_msg *msg)
- {
- switch (msg->lm_magic) {
- @@ -1243,25 +1161,6 @@ __u32 lustre_msg_get_service_time(struct lustre_msg *msg)
- }
- }
- -char *lustre_msg_get_jobid(struct lustre_msg *msg)
- -{
- - switch (msg->lm_magic) {
- - case LUSTRE_MSG_MAGIC_V2: {
- - struct ptlrpc_body *pb =
- - lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF,
- - sizeof(struct ptlrpc_body));
- - if (!pb)
- - return NULL;
- -
- - return pb->pb_jobid;
- - }
- - default:
- - CERROR("incorrect message magic: %08x\n", msg->lm_magic);
- - return NULL;
- - }
- -}
- -EXPORT_SYMBOL(lustre_msg_get_jobid);
- -
- __u32 lustre_msg_get_cksum(struct lustre_msg *msg)
- {
- switch (msg->lm_magic) {
- @@ -1336,36 +1235,6 @@ void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc)
- }
- EXPORT_SYMBOL(lustre_msg_set_opc);
- -void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid)
- -{
- - switch (msg->lm_magic) {
- - case LUSTRE_MSG_MAGIC_V2: {
- - struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
- - LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
- - pb->pb_last_xid = last_xid;
- - return;
- - }
- - default:
- - LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
- - }
- -}
- -EXPORT_SYMBOL(lustre_msg_set_last_xid);
- -
- -void lustre_msg_set_last_committed(struct lustre_msg *msg, __u64 last_committed)
- -{
- - switch (msg->lm_magic) {
- - case LUSTRE_MSG_MAGIC_V2: {
- - struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
- - LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
- - pb->pb_last_committed = last_committed;
- - return;
- - }
- - default:
- - LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
- - }
- -}
- -EXPORT_SYMBOL(lustre_msg_set_last_committed);
- -
- void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions)
- {
- switch (msg->lm_magic) {
- @@ -1509,14 +1378,6 @@ void ptlrpc_request_set_replen(struct ptlrpc_request *req)
- }
- EXPORT_SYMBOL(ptlrpc_request_set_replen);
- -void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *lens)
- -{
- - req->rq_replen = lustre_msg_size(req->rq_reqmsg->lm_magic, count, lens);
- - if (req->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V2)
- - req->rq_reqmsg->lm_repsize = req->rq_replen;
- -}
- -EXPORT_SYMBOL(ptlrpc_req_set_repsize);
- -
- /**
- * Send a remote set_info_async.
- *
- @@ -1968,15 +1829,6 @@ void lustre_swab_idx_info(struct idx_info *ii)
- __swab16s(&ii->ii_recsize);
- }
- -void lustre_swab_lip_header(struct lu_idxpage *lip)
- -{
- - /* swab header */
- - __swab32s(&lip->lip_magic);
- - __swab16s(&lip->lip_flags);
- - __swab16s(&lip->lip_nr);
- -}
- -EXPORT_SYMBOL(lustre_swab_lip_header);
- -
- void lustre_swab_mdt_rec_reint (struct mdt_rec_reint *rr)
- {
- __swab32s(&rr->rr_opcode);
- @@ -2019,46 +1871,6 @@ void lustre_swab_lov_desc(struct lov_desc *ld)
- }
- EXPORT_SYMBOL(lustre_swab_lov_desc);
- -void lustre_swab_lmv_desc(struct lmv_desc *ld)
- -{
- - __swab32s(&ld->ld_tgt_count);
- - __swab32s(&ld->ld_active_tgt_count);
- - __swab32s(&ld->ld_default_stripe_count);
- - __swab32s(&ld->ld_pattern);
- - __swab64s(&ld->ld_default_hash_size);
- - __swab32s(&ld->ld_qos_maxage);
- - /* uuid endian insensitive */
- -}
- -
- -void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea)
- -{
- - __swab32s(&mea->mea_magic);
- - __swab32s(&mea->mea_count);
- - __swab32s(&mea->mea_master);
- - CLASSERT(offsetof(typeof(*mea), mea_padding) != 0);
- -}
- -
- -void lustre_swab_lmv_user_md(struct lmv_user_md *lum)
- -{
- - int i;
- -
- - __swab32s(&lum->lum_magic);
- - __swab32s(&lum->lum_stripe_count);
- - __swab32s(&lum->lum_stripe_offset);
- - __swab32s(&lum->lum_hash_type);
- - __swab32s(&lum->lum_type);
- - CLASSERT(offsetof(typeof(*lum), lum_padding1) != 0);
- - CLASSERT(offsetof(typeof(*lum), lum_padding2) != 0);
- - CLASSERT(offsetof(typeof(*lum), lum_padding3) != 0);
- -
- - for (i = 0; i < lum->lum_stripe_count; i++) {
- - __swab32s(&lum->lum_objects[i].lum_mds);
- - lustre_swab_lu_fid(&lum->lum_objects[i].lum_fid);
- - }
- -
- -}
- -EXPORT_SYMBOL(lustre_swab_lmv_user_md);
- -
- static void print_lum(struct lov_user_md *lum)
- {
- CDEBUG(D_OTHER, "lov_user_md %p:\n", lum);
- @@ -2282,7 +2094,6 @@ void dump_obdo(struct obdo *oa)
- if (valid & OBD_MD_FLCOOKIE)
- CDEBUG(D_RPCTRACE, "obdo: o_lcookie = (llog_cookie dumping not yet implemented)\n");
- }
- -EXPORT_SYMBOL(dump_obdo);
- void dump_ost_body(struct ost_body *ob)
- {
- @@ -2381,14 +2192,6 @@ void lustre_swab_lustre_capa(struct lustre_capa *c)
- }
- EXPORT_SYMBOL(lustre_swab_lustre_capa);
- -void lustre_swab_lustre_capa_key(struct lustre_capa_key *k)
- -{
- - __swab64s(&k->lk_seq);
- - __swab32s(&k->lk_keyid);
- - CLASSERT(offsetof(typeof(*k), lk_padding) != 0);
- -}
- -EXPORT_SYMBOL(lustre_swab_lustre_capa_key);
- -
- void lustre_swab_hsm_user_state(struct hsm_user_state *state)
- {
- __swab32s(&state->hus_states);
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
- index b13aaa2660f7..07591d73e26e 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
- @@ -44,20 +44,10 @@
- #include "../include/obd_class.h"
- #include "ptlrpc_internal.h"
- -static int suppress_pings;
- -module_param(suppress_pings, int, 0644);
- -MODULE_PARM_DESC(suppress_pings, "Suppress pings");
- -
- struct mutex pinger_mutex;
- static LIST_HEAD(pinger_imports);
- static struct list_head timeout_list = LIST_HEAD_INIT(timeout_list);
- -int ptlrpc_pinger_suppress_pings(void)
- -{
- - return suppress_pings;
- -}
- -EXPORT_SYMBOL(ptlrpc_pinger_suppress_pings);
- -
- struct ptlrpc_request *
- ptlrpc_prep_ping(struct obd_import *imp)
- {
- @@ -122,11 +112,6 @@ static void ptlrpc_update_next_ping(struct obd_import *imp, int soon)
- imp->imp_next_ping = cfs_time_shift(time);
- }
- -void ptlrpc_ping_import_soon(struct obd_import *imp)
- -{
- - imp->imp_next_ping = cfs_time_current();
- -}
- -
- static inline int imp_is_deactive(struct obd_import *imp)
- {
- return (imp->imp_deactive ||
- @@ -324,9 +309,6 @@ int ptlrpc_start_pinger(void)
- l_wait_event(pinger_thread.t_ctl_waitq,
- thread_is_running(&pinger_thread), &lwi);
- - if (suppress_pings)
- - CWARN("Pings will be suppressed at the request of the administrator. The configuration shall meet the additional requirements described in the manual. (Search for the \"suppress_pings\" kernel module parameter.)\n");
- -
- return 0;
- }
- @@ -533,139 +515,3 @@ void ptlrpc_pinger_wake_up(void)
- thread_add_flags(&pinger_thread, SVC_EVENT);
- wake_up(&pinger_thread.t_ctl_waitq);
- }
- -
- -/* Ping evictor thread */
- -#define PET_READY 1
- -#define PET_TERMINATE 2
- -
- -static int pet_refcount;
- -static int pet_state;
- -static wait_queue_head_t pet_waitq;
- -static LIST_HEAD(pet_list);
- -static DEFINE_SPINLOCK(pet_lock);
- -
- -int ping_evictor_wake(struct obd_export *exp)
- -{
- - struct obd_device *obd;
- -
- - spin_lock(&pet_lock);
- - if (pet_state != PET_READY) {
- - /* eventually the new obd will call here again. */
- - spin_unlock(&pet_lock);
- - return 1;
- - }
- -
- - obd = class_exp2obd(exp);
- - if (list_empty(&obd->obd_evict_list)) {
- - class_incref(obd, "evictor", obd);
- - list_add(&obd->obd_evict_list, &pet_list);
- - }
- - spin_unlock(&pet_lock);
- -
- - wake_up(&pet_waitq);
- - return 0;
- -}
- -
- -static int ping_evictor_main(void *arg)
- -{
- - struct obd_device *obd;
- - struct obd_export *exp;
- - struct l_wait_info lwi = { 0 };
- - time64_t expire_time;
- -
- - unshare_fs_struct();
- -
- - CDEBUG(D_HA, "Starting Ping Evictor\n");
- - pet_state = PET_READY;
- - while (1) {
- - l_wait_event(pet_waitq, (!list_empty(&pet_list)) ||
- - (pet_state == PET_TERMINATE), &lwi);
- -
- - /* loop until all obd's will be removed */
- - if ((pet_state == PET_TERMINATE) && list_empty(&pet_list))
- - break;
- -
- - /* we only get here if pet_exp != NULL, and the end of this
- - * loop is the only place which sets it NULL again, so lock
- - * is not strictly necessary. */
- - spin_lock(&pet_lock);
- - obd = list_entry(pet_list.next, struct obd_device,
- - obd_evict_list);
- - spin_unlock(&pet_lock);
- -
- - expire_time = ktime_get_real_seconds() - PING_EVICT_TIMEOUT;
- -
- - CDEBUG(D_HA, "evicting all exports of obd %s older than %lld\n",
- - obd->obd_name, (s64)expire_time);
- -
- - /* Exports can't be deleted out of the list while we hold
- - * the obd lock (class_unlink_export), which means we can't
- - * lose the last ref on the export. If they've already been
- - * removed from the list, we won't find them here. */
- - spin_lock(&obd->obd_dev_lock);
- - while (!list_empty(&obd->obd_exports_timed)) {
- - exp = list_entry(obd->obd_exports_timed.next,
- - struct obd_export,
- - exp_obd_chain_timed);
- - if (expire_time > exp->exp_last_request_time) {
- - class_export_get(exp);
- - spin_unlock(&obd->obd_dev_lock);
- - LCONSOLE_WARN("%s: haven't heard from client %s (at %s) in %ld seconds. I think it's dead, and I am evicting it. exp %p, cur %lld expire %lld last %lld\n",
- - obd->obd_name,
- - obd_uuid2str(&exp->exp_client_uuid),
- - obd_export_nid2str(exp),
- - (long)(ktime_get_real_seconds() -
- - exp->exp_last_request_time),
- - exp, (s64)ktime_get_real_seconds(),
- - (s64)expire_time,
- - (s64)exp->exp_last_request_time);
- - CDEBUG(D_HA, "Last request was at %lld\n",
- - (s64)exp->exp_last_request_time);
- - class_fail_export(exp);
- - class_export_put(exp);
- - spin_lock(&obd->obd_dev_lock);
- - } else {
- - /* List is sorted, so everyone below is ok */
- - break;
- - }
- - }
- - spin_unlock(&obd->obd_dev_lock);
- -
- - spin_lock(&pet_lock);
- - list_del_init(&obd->obd_evict_list);
- - spin_unlock(&pet_lock);
- -
- - class_decref(obd, "evictor", obd);
- - }
- - CDEBUG(D_HA, "Exiting Ping Evictor\n");
- -
- - return 0;
- -}
- -
- -void ping_evictor_start(void)
- -{
- - struct task_struct *task;
- -
- - if (++pet_refcount > 1)
- - return;
- -
- - init_waitqueue_head(&pet_waitq);
- -
- - task = kthread_run(ping_evictor_main, NULL, "ll_evictor");
- - if (IS_ERR(task)) {
- - pet_refcount--;
- - CERROR("Cannot start ping evictor thread: %ld\n",
- - PTR_ERR(task));
- - }
- -}
- -EXPORT_SYMBOL(ping_evictor_start);
- -
- -void ping_evictor_stop(void)
- -{
- - if (--pet_refcount > 0)
- - return;
- -
- - pet_state = PET_TERMINATE;
- - wake_up(&pet_waitq);
- -}
- -EXPORT_SYMBOL(ping_evictor_stop);
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
- index 34c7e28afdaf..9274db2521df 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
- +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
- @@ -137,7 +137,6 @@ ptlrpc_nrs_req_peek_nolock(struct ptlrpc_service_part *svcpt, bool hp)
- return ptlrpc_nrs_req_get_nolock0(svcpt, hp, true, false);
- }
- -void ptlrpc_nrs_req_del_nolock(struct ptlrpc_request *req);
- bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp);
- int ptlrpc_nrs_policy_control(const struct ptlrpc_service *svc,
- @@ -243,7 +242,6 @@ int ptlrpc_stop_pinger(void);
- void ptlrpc_pinger_sending_on_import(struct obd_import *imp);
- void ptlrpc_pinger_commit_expected(struct obd_import *imp);
- void ptlrpc_pinger_wake_up(void);
- -void ptlrpc_ping_import_soon(struct obd_import *imp);
- int ping_evictor_wake(struct obd_export *exp);
- /* sec_null.c */
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
- index 00efdbf40f46..ce036a1ac466 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
- @@ -196,48 +196,6 @@ ptlrpcd_select_pc(struct ptlrpc_request *req)
- }
- /**
- - * Move all request from an existing request set to the ptlrpcd queue.
- - * All requests from the set must be in phase RQ_PHASE_NEW.
- - */
- -void ptlrpcd_add_rqset(struct ptlrpc_request_set *set)
- -{
- - struct list_head *tmp, *pos;
- - struct ptlrpcd_ctl *pc;
- - struct ptlrpc_request_set *new;
- - int count, i;
- -
- - pc = ptlrpcd_select_pc(NULL);
- - new = pc->pc_set;
- -
- - list_for_each_safe(pos, tmp, &set->set_requests) {
- - struct ptlrpc_request *req =
- - list_entry(pos, struct ptlrpc_request,
- - rq_set_chain);
- -
- - LASSERT(req->rq_phase == RQ_PHASE_NEW);
- - req->rq_set = new;
- - req->rq_queued_time = cfs_time_current();
- - }
- -
- - spin_lock(&new->set_new_req_lock);
- - list_splice_init(&set->set_requests, &new->set_new_requests);
- - i = atomic_read(&set->set_remaining);
- - count = atomic_add_return(i, &new->set_new_count);
- - atomic_set(&set->set_remaining, 0);
- - spin_unlock(&new->set_new_req_lock);
- - if (count == i) {
- - wake_up(&new->set_waitq);
- -
- - /* XXX: It maybe unnecessary to wakeup all the partners. But to
- - * guarantee the async RPC can be processed ASAP, we have
- - * no other better choice. It maybe fixed in future. */
- - for (i = 0; i < pc->pc_npartners; i++)
- - wake_up(&pc->pc_partners[i]->pc_set->set_waitq);
- - }
- -}
- -EXPORT_SYMBOL(ptlrpcd_add_rqset);
- -
- -/**
- * Return transferred RPCs count.
- */
- static int ptlrpcd_steal_rqset(struct ptlrpc_request_set *des,
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c
- index 5ee6641ea023..67604b560670 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
- @@ -297,46 +297,6 @@ void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync)
- }
- EXPORT_SYMBOL(sptlrpc_cli_ctx_put);
- -/**
- - * Expire the client context immediately.
- - *
- - * \pre Caller must hold at least 1 reference on the \a ctx.
- - */
- -void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx)
- -{
- - LASSERT(ctx->cc_ops->force_die);
- - ctx->cc_ops->force_die(ctx, 0);
- -}
- -EXPORT_SYMBOL(sptlrpc_cli_ctx_expire);
- -
- -/**
- - * To wake up the threads who are waiting for this client context. Called
- - * after some status change happened on \a ctx.
- - */
- -void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx)
- -{
- - struct ptlrpc_request *req, *next;
- -
- - spin_lock(&ctx->cc_lock);
- - list_for_each_entry_safe(req, next, &ctx->cc_req_list,
- - rq_ctx_chain) {
- - list_del_init(&req->rq_ctx_chain);
- - ptlrpc_client_wake_req(req);
- - }
- - spin_unlock(&ctx->cc_lock);
- -}
- -EXPORT_SYMBOL(sptlrpc_cli_ctx_wakeup);
- -
- -int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize)
- -{
- - LASSERT(ctx->cc_ops);
- -
- - if (ctx->cc_ops->display == NULL)
- - return 0;
- -
- - return ctx->cc_ops->display(ctx, buf, bufsize);
- -}
- -
- static int import_sec_check_expire(struct obd_import *imp)
- {
- int adapt = 0;
- @@ -1229,12 +1189,6 @@ static void sec_cop_destroy_sec(struct ptlrpc_sec *sec)
- sptlrpc_policy_put(policy);
- }
- -void sptlrpc_sec_destroy(struct ptlrpc_sec *sec)
- -{
- - sec_cop_destroy_sec(sec);
- -}
- -EXPORT_SYMBOL(sptlrpc_sec_destroy);
- -
- static void sptlrpc_sec_kill(struct ptlrpc_sec *sec)
- {
- LASSERT_ATOMIC_POS(&sec->ps_refcount);
- @@ -1507,13 +1461,6 @@ static void import_flush_ctx_common(struct obd_import *imp,
- sptlrpc_sec_put(sec);
- }
- -void sptlrpc_import_flush_root_ctx(struct obd_import *imp)
- -{
- - /* it's important to use grace mode, see explain in
- - * sptlrpc_req_refresh_ctx() */
- - import_flush_ctx_common(imp, 0, 1, 1);
- -}
- -
- void sptlrpc_import_flush_my_ctx(struct obd_import *imp)
- {
- import_flush_ctx_common(imp, from_kuid(&init_user_ns, current_uid()),
- @@ -1697,16 +1644,6 @@ void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req)
- req->rq_repmsg = NULL;
- }
- -int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp,
- - struct ptlrpc_cli_ctx *ctx)
- -{
- - struct ptlrpc_sec_policy *policy = ctx->cc_sec->ps_policy;
- -
- - if (!policy->sp_cops->install_rctx)
- - return 0;
- - return policy->sp_cops->install_rctx(imp, ctx->cc_sec, ctx);
- -}
- -
- int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp,
- struct ptlrpc_svc_ctx *ctx)
- {
- @@ -1921,46 +1858,6 @@ int sptlrpc_target_export_check(struct obd_export *exp,
- }
- EXPORT_SYMBOL(sptlrpc_target_export_check);
- -void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
- - struct sptlrpc_rule_set *rset)
- -{
- - struct obd_export *exp;
- - struct sptlrpc_flavor new_flvr;
- -
- - LASSERT(obd);
- -
- - spin_lock(&obd->obd_dev_lock);
- -
- - list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) {
- - if (exp->exp_connection == NULL)
- - continue;
- -
- - /* note if this export had just been updated flavor
- - * (exp_flvr_changed == 1), this will override the
- - * previous one. */
- - spin_lock(&exp->exp_lock);
- - sptlrpc_target_choose_flavor(rset, exp->exp_sp_peer,
- - exp->exp_connection->c_peer.nid,
- - &new_flvr);
- - if (exp->exp_flvr_changed ||
- - !flavor_equal(&new_flvr, &exp->exp_flvr)) {
- - exp->exp_flvr_old[1] = new_flvr;
- - exp->exp_flvr_expire[1] = 0;
- - exp->exp_flvr_changed = 1;
- - exp->exp_flvr_adapt = 1;
- -
- - CDEBUG(D_SEC, "exp %p (%s): updated flavor %x->%x\n",
- - exp, sptlrpc_part2name(exp->exp_sp_peer),
- - exp->exp_flvr.sf_rpc,
- - exp->exp_flvr_old[1].sf_rpc);
- - }
- - spin_unlock(&exp->exp_lock);
- - }
- -
- - spin_unlock(&obd->obd_dev_lock);
- -}
- -EXPORT_SYMBOL(sptlrpc_target_update_exp_flavor);
- -
- static int sptlrpc_svc_check_from(struct ptlrpc_request *req, int svc_rc)
- {
- /* peer's claim is unreliable unless gss is being used */
- @@ -2183,19 +2080,6 @@ void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req)
- req->rq_svc_ctx = NULL;
- }
- -void sptlrpc_svc_ctx_invalidate(struct ptlrpc_request *req)
- -{
- - struct ptlrpc_svc_ctx *ctx = req->rq_svc_ctx;
- -
- - if (ctx == NULL)
- - return;
- -
- - LASSERT_ATOMIC_POS(&ctx->sc_refcount);
- - if (ctx->sc_policy->sp_sops->invalidate_ctx)
- - ctx->sc_policy->sp_sops->invalidate_ctx(ctx);
- -}
- -EXPORT_SYMBOL(sptlrpc_svc_ctx_invalidate);
- -
- /****************************************
- * bulk security *
- ****************************************/
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
- index c18b71c71181..c89973c0e3a2 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
- @@ -302,150 +302,6 @@ static unsigned long enc_pools_cleanup(struct page ***pools, int npools)
- return cleaned;
- }
- -/*
- - * merge @npools pointed by @pools which contains @npages new pages
- - * into current pools.
- - *
- - * we have options to avoid most memory copy with some tricks. but we choose
- - * the simplest way to avoid complexity. It's not frequently called.
- - */
- -static void enc_pools_insert(struct page ***pools, int npools, int npages)
- -{
- - int freeslot;
- - int op_idx, np_idx, og_idx, ng_idx;
- - int cur_npools, end_npools;
- -
- - LASSERT(npages > 0);
- - LASSERT(page_pools.epp_total_pages+npages <= page_pools.epp_max_pages);
- - LASSERT(npages_to_npools(npages) == npools);
- - LASSERT(page_pools.epp_growing);
- -
- - spin_lock(&page_pools.epp_lock);
- -
- - /*
- - * (1) fill all the free slots of current pools.
- - */
- - /* free slots are those left by rent pages, and the extra ones with
- - * index >= total_pages, locate at the tail of last pool. */
- - freeslot = page_pools.epp_total_pages % PAGES_PER_POOL;
- - if (freeslot != 0)
- - freeslot = PAGES_PER_POOL - freeslot;
- - freeslot += page_pools.epp_total_pages - page_pools.epp_free_pages;
- -
- - op_idx = page_pools.epp_free_pages / PAGES_PER_POOL;
- - og_idx = page_pools.epp_free_pages % PAGES_PER_POOL;
- - np_idx = npools - 1;
- - ng_idx = (npages - 1) % PAGES_PER_POOL;
- -
- - while (freeslot) {
- - LASSERT(page_pools.epp_pools[op_idx][og_idx] == NULL);
- - LASSERT(pools[np_idx][ng_idx] != NULL);
- -
- - page_pools.epp_pools[op_idx][og_idx] = pools[np_idx][ng_idx];
- - pools[np_idx][ng_idx] = NULL;
- -
- - freeslot--;
- -
- - if (++og_idx == PAGES_PER_POOL) {
- - op_idx++;
- - og_idx = 0;
- - }
- - if (--ng_idx < 0) {
- - if (np_idx == 0)
- - break;
- - np_idx--;
- - ng_idx = PAGES_PER_POOL - 1;
- - }
- - }
- -
- - /*
- - * (2) add pools if needed.
- - */
- - cur_npools = (page_pools.epp_total_pages + PAGES_PER_POOL - 1) /
- - PAGES_PER_POOL;
- - end_npools = (page_pools.epp_total_pages + npages + PAGES_PER_POOL - 1)
- - / PAGES_PER_POOL;
- - LASSERT(end_npools <= page_pools.epp_max_pools);
- -
- - np_idx = 0;
- - while (cur_npools < end_npools) {
- - LASSERT(page_pools.epp_pools[cur_npools] == NULL);
- - LASSERT(np_idx < npools);
- - LASSERT(pools[np_idx] != NULL);
- -
- - page_pools.epp_pools[cur_npools++] = pools[np_idx];
- - pools[np_idx++] = NULL;
- - }
- -
- - page_pools.epp_total_pages += npages;
- - page_pools.epp_free_pages += npages;
- - page_pools.epp_st_lowfree = page_pools.epp_free_pages;
- -
- - if (page_pools.epp_total_pages > page_pools.epp_st_max_pages)
- - page_pools.epp_st_max_pages = page_pools.epp_total_pages;
- -
- - CDEBUG(D_SEC, "add %d pages to total %lu\n", npages,
- - page_pools.epp_total_pages);
- -
- - spin_unlock(&page_pools.epp_lock);
- -}
- -
- -static int enc_pools_add_pages(int npages)
- -{
- - static DEFINE_MUTEX(add_pages_mutex);
- - struct page ***pools;
- - int npools, alloced = 0;
- - int i, j, rc = -ENOMEM;
- -
- - if (npages < PTLRPC_MAX_BRW_PAGES)
- - npages = PTLRPC_MAX_BRW_PAGES;
- -
- - mutex_lock(&add_pages_mutex);
- -
- - if (npages + page_pools.epp_total_pages > page_pools.epp_max_pages)
- - npages = page_pools.epp_max_pages - page_pools.epp_total_pages;
- - LASSERT(npages > 0);
- -
- - page_pools.epp_st_grows++;
- -
- - npools = npages_to_npools(npages);
- - pools = kcalloc(npools, sizeof(*pools), GFP_NOFS);
- - if (pools == NULL)
- - goto out;
- -
- - for (i = 0; i < npools; i++) {
- - pools[i] = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS);
- - if (!pools[i])
- - goto out_pools;
- -
- - for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) {
- - pools[i][j] = alloc_page(GFP_NOFS |
- - __GFP_HIGHMEM);
- - if (pools[i][j] == NULL)
- - goto out_pools;
- -
- - alloced++;
- - }
- - }
- - LASSERT(alloced == npages);
- -
- - enc_pools_insert(pools, npools, npages);
- - CDEBUG(D_SEC, "added %d pages into pools\n", npages);
- - rc = 0;
- -
- -out_pools:
- - enc_pools_cleanup(pools, npools);
- - kfree(pools);
- -out:
- - if (rc) {
- - page_pools.epp_st_grow_fails++;
- - CERROR("Failed to allocate %d enc pages\n", npages);
- - }
- -
- - mutex_unlock(&add_pages_mutex);
- - return rc;
- -}
- -
- static inline void enc_pools_wakeup(void)
- {
- assert_spin_locked(&page_pools.epp_lock);
- @@ -457,156 +313,6 @@ static inline void enc_pools_wakeup(void)
- }
- }
- -static int enc_pools_should_grow(int page_needed, time64_t now)
- -{
- - /* don't grow if someone else is growing the pools right now,
- - * or the pools has reached its full capacity
- - */
- - if (page_pools.epp_growing ||
- - page_pools.epp_total_pages == page_pools.epp_max_pages)
- - return 0;
- -
- - /* if total pages is not enough, we need to grow */
- - if (page_pools.epp_total_pages < page_needed)
- - return 1;
- -
- - /*
- - * we wanted to return 0 here if there was a shrink just happened
- - * moment ago, but this may cause deadlock if both client and ost
- - * live on single node.
- - */
- -#if 0
- - if (now - page_pools.epp_last_shrink < 2)
- - return 0;
- -#endif
- -
- - /*
- - * here we perhaps need consider other factors like wait queue
- - * length, idle index, etc. ?
- - */
- -
- - /* grow the pools in any other cases */
- - return 1;
- -}
- -
- -/*
- - * we allocate the requested pages atomically.
- - */
- -int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc)
- -{
- - wait_queue_t waitlink;
- - unsigned long this_idle = -1;
- - unsigned long tick = 0;
- - long now;
- - int p_idx, g_idx;
- - int i;
- -
- - LASSERT(desc->bd_iov_count > 0);
- - LASSERT(desc->bd_iov_count <= page_pools.epp_max_pages);
- -
- - /* resent bulk, enc iov might have been allocated previously */
- - if (desc->bd_enc_iov != NULL)
- - return 0;
- -
- - desc->bd_enc_iov = kcalloc(desc->bd_iov_count,
- - sizeof(*desc->bd_enc_iov), GFP_NOFS);
- - if (desc->bd_enc_iov == NULL)
- - return -ENOMEM;
- -
- - spin_lock(&page_pools.epp_lock);
- -
- - page_pools.epp_st_access++;
- -again:
- - if (unlikely(page_pools.epp_free_pages < desc->bd_iov_count)) {
- - if (tick == 0)
- - tick = cfs_time_current();
- -
- - now = ktime_get_seconds();
- -
- - page_pools.epp_st_missings++;
- - page_pools.epp_pages_short += desc->bd_iov_count;
- -
- - if (enc_pools_should_grow(desc->bd_iov_count, now)) {
- - page_pools.epp_growing = 1;
- -
- - spin_unlock(&page_pools.epp_lock);
- - enc_pools_add_pages(page_pools.epp_pages_short / 2);
- - spin_lock(&page_pools.epp_lock);
- -
- - page_pools.epp_growing = 0;
- -
- - enc_pools_wakeup();
- - } else {
- - if (++page_pools.epp_waitqlen >
- - page_pools.epp_st_max_wqlen)
- - page_pools.epp_st_max_wqlen =
- - page_pools.epp_waitqlen;
- -
- - set_current_state(TASK_UNINTERRUPTIBLE);
- - init_waitqueue_entry(&waitlink, current);
- - add_wait_queue(&page_pools.epp_waitq, &waitlink);
- -
- - spin_unlock(&page_pools.epp_lock);
- - schedule();
- - remove_wait_queue(&page_pools.epp_waitq, &waitlink);
- - LASSERT(page_pools.epp_waitqlen > 0);
- - spin_lock(&page_pools.epp_lock);
- - page_pools.epp_waitqlen--;
- - }
- -
- - LASSERT(page_pools.epp_pages_short >= desc->bd_iov_count);
- - page_pools.epp_pages_short -= desc->bd_iov_count;
- -
- - this_idle = 0;
- - goto again;
- - }
- -
- - /* record max wait time */
- - if (unlikely(tick != 0)) {
- - tick = cfs_time_current() - tick;
- - if (tick > page_pools.epp_st_max_wait)
- - page_pools.epp_st_max_wait = tick;
- - }
- -
- - /* proceed with rest of allocation */
- - page_pools.epp_free_pages -= desc->bd_iov_count;
- -
- - p_idx = page_pools.epp_free_pages / PAGES_PER_POOL;
- - g_idx = page_pools.epp_free_pages % PAGES_PER_POOL;
- -
- - for (i = 0; i < desc->bd_iov_count; i++) {
- - LASSERT(page_pools.epp_pools[p_idx][g_idx] != NULL);
- - desc->bd_enc_iov[i].kiov_page =
- - page_pools.epp_pools[p_idx][g_idx];
- - page_pools.epp_pools[p_idx][g_idx] = NULL;
- -
- - if (++g_idx == PAGES_PER_POOL) {
- - p_idx++;
- - g_idx = 0;
- - }
- - }
- -
- - if (page_pools.epp_free_pages < page_pools.epp_st_lowfree)
- - page_pools.epp_st_lowfree = page_pools.epp_free_pages;
- -
- - /*
- - * new idle index = (old * weight + new) / (weight + 1)
- - */
- - if (this_idle == -1) {
- - this_idle = page_pools.epp_free_pages * IDLE_IDX_MAX /
- - page_pools.epp_total_pages;
- - }
- - page_pools.epp_idle_idx = (page_pools.epp_idle_idx * IDLE_IDX_WEIGHT +
- - this_idle) /
- - (IDLE_IDX_WEIGHT + 1);
- -
- - page_pools.epp_last_access = ktime_get_seconds();
- -
- - spin_unlock(&page_pools.epp_lock);
- - return 0;
- -}
- -EXPORT_SYMBOL(sptlrpc_enc_pool_get_pages);
- -
- void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc)
- {
- int p_idx, g_idx;
- @@ -651,41 +357,6 @@ void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc)
- }
- EXPORT_SYMBOL(sptlrpc_enc_pool_put_pages);
- -/*
- - * we don't do much stuff for add_user/del_user anymore, except adding some
- - * initial pages in add_user() if current pools are empty, rest would be
- - * handled by the pools's self-adaption.
- - */
- -int sptlrpc_enc_pool_add_user(void)
- -{
- - int need_grow = 0;
- -
- - spin_lock(&page_pools.epp_lock);
- - if (page_pools.epp_growing == 0 && page_pools.epp_total_pages == 0) {
- - page_pools.epp_growing = 1;
- - need_grow = 1;
- - }
- - spin_unlock(&page_pools.epp_lock);
- -
- - if (need_grow) {
- - enc_pools_add_pages(PTLRPC_MAX_BRW_PAGES +
- - PTLRPC_MAX_BRW_PAGES);
- -
- - spin_lock(&page_pools.epp_lock);
- - page_pools.epp_growing = 0;
- - enc_pools_wakeup();
- - spin_unlock(&page_pools.epp_lock);
- - }
- - return 0;
- -}
- -EXPORT_SYMBOL(sptlrpc_enc_pool_add_user);
- -
- -int sptlrpc_enc_pool_del_user(void)
- -{
- - return 0;
- -}
- -EXPORT_SYMBOL(sptlrpc_enc_pool_del_user);
- -
- static inline void enc_pools_alloc(void)
- {
- LASSERT(page_pools.epp_max_pools);
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
- index 7769ab225a2d..0d29b8734a53 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
- @@ -48,27 +48,6 @@
- #include "ptlrpc_internal.h"
- -const char *sptlrpc_part2name(enum lustre_sec_part part)
- -{
- - switch (part) {
- - case LUSTRE_SP_CLI:
- - return "cli";
- - case LUSTRE_SP_MDT:
- - return "mdt";
- - case LUSTRE_SP_OST:
- - return "ost";
- - case LUSTRE_SP_MGC:
- - return "mgc";
- - case LUSTRE_SP_MGS:
- - return "mgs";
- - case LUSTRE_SP_ANY:
- - return "any";
- - default:
- - return "err";
- - }
- -}
- -EXPORT_SYMBOL(sptlrpc_part2name);
- -
- enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd)
- {
- const char *type = obd->obd_type->typ_name;
- @@ -430,19 +409,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
- }
- EXPORT_SYMBOL(sptlrpc_rule_set_choose);
- -void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset)
- -{
- - struct sptlrpc_rule *r;
- - int n;
- -
- - for (n = 0; n < rset->srs_nrule; n++) {
- - r = &rset->srs_rules[n];
- - CDEBUG(D_SEC, "<%02d> from %x to %x, net %x, rpc %x\n", n,
- - r->sr_from, r->sr_to, r->sr_netid, r->sr_flvr.sf_rpc);
- - }
- -}
- -EXPORT_SYMBOL(sptlrpc_rule_set_dump);
- -
- /**********************************
- * sptlrpc configuration support *
- **********************************/
- @@ -836,20 +802,6 @@ out:
- flavor_set_flags(sf, from, to, 1);
- }
- -/**
- - * called by target devices, determine the expected flavor from
- - * certain peer (from, nid).
- - */
- -void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
- - enum lustre_sec_part from,
- - lnet_nid_t nid,
- - struct sptlrpc_flavor *sf)
- -{
- - if (sptlrpc_rule_set_choose(rset, from, LUSTRE_SP_ANY, nid, sf) == 0)
- - get_default_flavor(sf);
- -}
- -EXPORT_SYMBOL(sptlrpc_target_choose_flavor);
- -
- #define SEC_ADAPT_DELAY (10)
- /**
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
- index c3ad1dabced8..520329f88465 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
- @@ -103,21 +103,6 @@ void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec)
- }
- EXPORT_SYMBOL(sptlrpc_gc_del_sec);
- -void sptlrpc_gc_add_ctx(struct ptlrpc_cli_ctx *ctx)
- -{
- - LASSERT(list_empty(&ctx->cc_gc_chain));
- -
- - CDEBUG(D_SEC, "hand over ctx %p(%u->%s)\n",
- - ctx, ctx->cc_vcred.vc_uid, sec2target_str(ctx->cc_sec));
- - spin_lock(&sec_gc_ctx_list_lock);
- - list_add(&ctx->cc_gc_chain, &sec_gc_ctx_list);
- - spin_unlock(&sec_gc_ctx_list_lock);
- -
- - thread_add_flags(&sec_gc_thread, SVC_SIGNAL);
- - wake_up(&sec_gc_thread.t_ctl_waitq);
- -}
- -EXPORT_SYMBOL(sptlrpc_gc_add_ctx);
- -
- static void sec_process_ctx_list(void)
- {
- struct ptlrpc_cli_ctx *ctx;
- diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c
- index 623871beb5aa..d8ae490afdcf 100644
- --- a/drivers/staging/lustre/lustre/ptlrpc/service.c
- +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
- @@ -179,33 +179,6 @@ ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, int post)
- return rc;
- }
- -/**
- - * Part of Rep-Ack logic.
- - * Puts a lock and its mode into reply state associated to request reply.
- - */
- -void
- -ptlrpc_save_lock(struct ptlrpc_request *req,
- - struct lustre_handle *lock, int mode, int no_ack)
- -{
- - struct ptlrpc_reply_state *rs = req->rq_reply_state;
- - int idx;
- -
- - LASSERT(rs != NULL);
- - LASSERT(rs->rs_nlocks < RS_MAX_LOCKS);
- -
- - if (req->rq_export->exp_disconnected) {
- - ldlm_lock_decref(lock, mode);
- - } else {
- - idx = rs->rs_nlocks++;
- - rs->rs_locks[idx] = *lock;
- - rs->rs_modes[idx] = mode;
- - rs->rs_difficult = 1;
- - rs->rs_no_ack = !!no_ack;
- - }
- -}
- -EXPORT_SYMBOL(ptlrpc_save_lock);
- -
- -
- struct ptlrpc_hr_partition;
- struct ptlrpc_hr_thread {
- @@ -246,12 +219,6 @@ struct ptlrpc_hr_service {
- struct ptlrpc_hr_partition **hr_partitions;
- };
- -struct rs_batch {
- - struct list_head rsb_replies;
- - unsigned int rsb_n_replies;
- - struct ptlrpc_service_part *rsb_svcpt;
- -};
- -
- /** reply handling service. */
- static struct ptlrpc_hr_service ptlrpc_hr;
- @@ -261,17 +228,6 @@ static struct ptlrpc_hr_service ptlrpc_hr;
- #define MAX_SCHEDULED 256
- /**
- - * Initialize a reply batch.
- - *
- - * \param b batch
- - */
- -static void rs_batch_init(struct rs_batch *b)
- -{
- - memset(b, 0, sizeof(*b));
- - INIT_LIST_HEAD(&b->rsb_replies);
- -}
- -
- -/**
- * Choose an hr thread to dispatch requests to.
- */
- static struct ptlrpc_hr_thread *
- @@ -297,76 +253,6 @@ ptlrpc_hr_select(struct ptlrpc_service_part *svcpt)
- }
- /**
- - * Dispatch all replies accumulated in the batch to one from
- - * dedicated reply handling threads.
- - *
- - * \param b batch
- - */
- -static void rs_batch_dispatch(struct rs_batch *b)
- -{
- - if (b->rsb_n_replies != 0) {
- - struct ptlrpc_hr_thread *hrt;
- -
- - hrt = ptlrpc_hr_select(b->rsb_svcpt);
- -
- - spin_lock(&hrt->hrt_lock);
- - list_splice_init(&b->rsb_replies, &hrt->hrt_queue);
- - spin_unlock(&hrt->hrt_lock);
- -
- - wake_up(&hrt->hrt_waitq);
- - b->rsb_n_replies = 0;
- - }
- -}
- -
- -/**
- - * Add a reply to a batch.
- - * Add one reply object to a batch, schedule batched replies if overload.
- - *
- - * \param b batch
- - * \param rs reply
- - */
- -static void rs_batch_add(struct rs_batch *b, struct ptlrpc_reply_state *rs)
- -{
- - struct ptlrpc_service_part *svcpt = rs->rs_svcpt;
- -
- - if (svcpt != b->rsb_svcpt || b->rsb_n_replies >= MAX_SCHEDULED) {
- - if (b->rsb_svcpt != NULL) {
- - rs_batch_dispatch(b);
- - spin_unlock(&b->rsb_svcpt->scp_rep_lock);
- - }
- - spin_lock(&svcpt->scp_rep_lock);
- - b->rsb_svcpt = svcpt;
- - }
- - spin_lock(&rs->rs_lock);
- - rs->rs_scheduled_ever = 1;
- - if (rs->rs_scheduled == 0) {
- - list_move(&rs->rs_list, &b->rsb_replies);
- - rs->rs_scheduled = 1;
- - b->rsb_n_replies++;
- - }
- - rs->rs_committed = 1;
- - spin_unlock(&rs->rs_lock);
- -}
- -
- -/**
- - * Reply batch finalization.
- - * Dispatch remaining replies from the batch
- - * and release remaining spinlock.
- - *
- - * \param b batch
- - */
- -static void rs_batch_fini(struct rs_batch *b)
- -{
- - if (b->rsb_svcpt != NULL) {
- - rs_batch_dispatch(b);
- - spin_unlock(&b->rsb_svcpt->scp_rep_lock);
- - }
- -}
- -
- -#define DECLARE_RS_BATCH(b) struct rs_batch b
- -
- -
- -/**
- * Put reply state into a queue for processing because we received
- * ACK from the client
- */
- @@ -403,32 +289,6 @@ ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs)
- }
- EXPORT_SYMBOL(ptlrpc_schedule_difficult_reply);
- -void ptlrpc_commit_replies(struct obd_export *exp)
- -{
- - struct ptlrpc_reply_state *rs, *nxt;
- - DECLARE_RS_BATCH(batch);
- -
- - rs_batch_init(&batch);
- - /* Find any replies that have been committed and get their service
- - * to attend to complete them. */
- -
- - /* CAVEAT EMPTOR: spinlock ordering!!! */
- - spin_lock(&exp->exp_uncommitted_replies_lock);
- - list_for_each_entry_safe(rs, nxt, &exp->exp_uncommitted_replies,
- - rs_obd_list) {
- - LASSERT(rs->rs_difficult);
- - /* VBR: per-export last_committed */
- - LASSERT(rs->rs_export);
- - if (rs->rs_transno <= exp->exp_last_committed) {
- - list_del_init(&rs->rs_obd_list);
- - rs_batch_add(&batch, rs);
- - }
- - }
- - spin_unlock(&exp->exp_uncommitted_replies_lock);
- - rs_batch_fini(&batch);
- -}
- -EXPORT_SYMBOL(ptlrpc_commit_replies);
- -
- static int
- ptlrpc_server_post_idle_rqbds(struct ptlrpc_service_part *svcpt)
- {
- @@ -963,35 +823,6 @@ void ptlrpc_server_drop_request(struct ptlrpc_request *req)
- }
- }
- -/** Change request export and move hp request from old export to new */
- -void ptlrpc_request_change_export(struct ptlrpc_request *req,
- - struct obd_export *export)
- -{
- - if (req->rq_export != NULL) {
- - if (!list_empty(&req->rq_exp_list)) {
- - /* remove rq_exp_list from last export */
- - spin_lock_bh(&req->rq_export->exp_rpc_lock);
- - list_del_init(&req->rq_exp_list);
- - spin_unlock_bh(&req->rq_export->exp_rpc_lock);
- -
- - /* export has one reference already, so it`s safe to
- - * add req to export queue here and get another
- - * reference for request later */
- - spin_lock_bh(&export->exp_rpc_lock);
- - list_add(&req->rq_exp_list, &export->exp_hp_rpcs);
- - spin_unlock_bh(&export->exp_rpc_lock);
- - }
- - class_export_rpc_dec(req->rq_export);
- - class_export_put(req->rq_export);
- - }
- -
- - /* request takes one export refcount */
- - req->rq_export = class_export_get(export);
- - class_export_rpc_inc(export);
- -
- - return;
- -}
- -
- /**
- * to finish a request: stop sending more early replies, and release
- * the request.
- @@ -1070,37 +901,6 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay)
- struct obd_export, exp_obd_chain_timed);
- oldest_time = oldest_exp->exp_last_request_time;
- spin_unlock(&exp->exp_obd->obd_dev_lock);
- -
- - if (exp->exp_obd->obd_recovering) {
- - /* be nice to everyone during recovery */
- - return;
- - }
- -
- - /* Note - racing to start/reset the obd_eviction timer is safe */
- - if (exp->exp_obd->obd_eviction_timer == 0) {
- - /* Check if the oldest entry is expired. */
- - if (ktime_get_real_seconds() > (oldest_time + PING_EVICT_TIMEOUT +
- - extra_delay)) {
- - /* We need a second timer, in case the net was down and
- - * it just came back. Since the pinger may skip every
- - * other PING_INTERVAL (see note in ptlrpc_pinger_main),
- - * we better wait for 3. */
- - exp->exp_obd->obd_eviction_timer =
- - ktime_get_real_seconds() + 3 * PING_INTERVAL;
- - CDEBUG(D_HA, "%s: Think about evicting %s from %lld\n",
- - exp->exp_obd->obd_name,
- - obd_export_nid2str(oldest_exp), (s64)oldest_time);
- - }
- - } else {
- - if (ktime_get_real_seconds() >
- - (exp->exp_obd->obd_eviction_timer + extra_delay)) {
- - /* The evictor won't evict anyone who we've heard from
- - * recently, so we don't have to check before we start
- - * it. */
- - if (!ping_evictor_wake(exp))
- - exp->exp_obd->obd_eviction_timer = 0;
- - }
- - }
- }
- /**
- @@ -1549,30 +1349,6 @@ static void ptlrpc_server_hpreq_fini(struct ptlrpc_request *req)
- }
- }
- -static int ptlrpc_hpreq_check(struct ptlrpc_request *req)
- -{
- - return 1;
- -}
- -
- -static struct ptlrpc_hpreq_ops ptlrpc_hpreq_common = {
- - .hpreq_check = ptlrpc_hpreq_check,
- -};
- -
- -/* Hi-Priority RPC check by RPC operation code. */
- -int ptlrpc_hpreq_handler(struct ptlrpc_request *req)
- -{
- - int opc = lustre_msg_get_opc(req->rq_reqmsg);
- -
- - /* Check for export to let only reconnects for not yet evicted
- - * export to become a HP rpc. */
- - if ((req->rq_export != NULL) &&
- - (opc == OBD_PING || opc == MDS_CONNECT || opc == OST_CONNECT))
- - req->rq_ops = &ptlrpc_hpreq_common;
- -
- - return 0;
- -}
- -EXPORT_SYMBOL(ptlrpc_hpreq_handler);
- -
- static int ptlrpc_server_request_add(struct ptlrpc_service_part *svcpt,
- struct ptlrpc_request *req)
- {
- @@ -3050,61 +2826,3 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service)
- return 0;
- }
- EXPORT_SYMBOL(ptlrpc_unregister_service);
- -
- -/**
- - * Returns 0 if the service is healthy.
- - *
- - * Right now, it just checks to make sure that requests aren't languishing
- - * in the queue. We'll use this health check to govern whether a node needs
- - * to be shot, so it's intentionally non-aggressive. */
- -static int ptlrpc_svcpt_health_check(struct ptlrpc_service_part *svcpt)
- -{
- - struct ptlrpc_request *request = NULL;
- - struct timespec64 right_now;
- - struct timespec64 timediff;
- -
- - ktime_get_real_ts64(&right_now);
- -
- - spin_lock(&svcpt->scp_req_lock);
- - /* How long has the next entry been waiting? */
- - if (ptlrpc_server_high_pending(svcpt, true))
- - request = ptlrpc_nrs_req_peek_nolock(svcpt, true);
- - else if (ptlrpc_server_normal_pending(svcpt, true))
- - request = ptlrpc_nrs_req_peek_nolock(svcpt, false);
- -
- - if (request == NULL) {
- - spin_unlock(&svcpt->scp_req_lock);
- - return 0;
- - }
- -
- - timediff = timespec64_sub(right_now, request->rq_arrival_time);
- - spin_unlock(&svcpt->scp_req_lock);
- -
- - if ((timediff.tv_sec) >
- - (AT_OFF ? obd_timeout * 3 / 2 : at_max)) {
- - CERROR("%s: unhealthy - request has been waiting %llds\n",
- - svcpt->scp_service->srv_name, (s64)timediff.tv_sec);
- - return -1;
- - }
- -
- - return 0;
- -}
- -
- -int
- -ptlrpc_service_health_check(struct ptlrpc_service *svc)
- -{
- - struct ptlrpc_service_part *svcpt;
- - int i;
- -
- - if (svc == NULL)
- - return 0;
- -
- - ptlrpc_service_for_each_part(svcpt, i, svc) {
- - int rc = ptlrpc_svcpt_health_check(svcpt);
- -
- - if (rc != 0)
- - return rc;
- - }
- - return 0;
- -}
- -EXPORT_SYMBOL(ptlrpc_service_health_check);
Advertisement
Add Comment
Please, Sign In to add comment