Guest User

Untitled

a guest
Sep 24th, 2015
183
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. staging/lustre: remove lots of dead code
  2.  
  3. All these functions are never called in lustre and can be removed.
  4.  
  5. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  6.  
  7.  drivers/staging/lustre/lustre/fid/lproc_fid.c      |    1 -
  8.  drivers/staging/lustre/lustre/fld/fld_cache.c      |    1 -
  9.  drivers/staging/lustre/lustre/fld/fld_internal.h   |    3 -
  10.  drivers/staging/lustre/lustre/fld/fld_request.c    |    1 -
  11.  drivers/staging/lustre/lustre/fld/lproc_fld.c      |    1 -
  12.  drivers/staging/lustre/lustre/include/cl_object.h  |   25 -
  13.  drivers/staging/lustre/lustre/include/dt_object.h  |  144 ---
  14.  .../staging/lustre/lustre/include/lprocfs_status.h |   39 +-
  15.  drivers/staging/lustre/lustre/include/lu_object.h  |   27 -
  16.  .../lustre/lustre/include/lustre/lustre_idl.h      |    8 -
  17.  .../lustre/lustre/include/lustre/lustre_user.h     |    2 -
  18.  .../staging/lustre/lustre/include/lustre_capa.h    |    9 -
  19.  .../staging/lustre/lustre/include/lustre_debug.h   |    1 -
  20.  .../staging/lustre/lustre/include/lustre_disk.h    |    2 -
  21.  .../staging/lustre/lustre/include/lustre_eacl.h    |    4 -
  22.  .../staging/lustre/lustre/include/lustre_export.h  |    7 -
  23.  .../staging/lustre/lustre/include/lustre_handles.h |    1 -
  24.  .../staging/lustre/lustre/include/lustre_import.h  |    1 -
  25.  drivers/staging/lustre/lustre/include/lustre_lib.h |    1 -
  26.  drivers/staging/lustre/lustre/include/lustre_log.h |   47 +-
  27.  drivers/staging/lustre/lustre/include/lustre_net.h |   41 -
  28.  .../staging/lustre/lustre/include/lustre_param.h   |    6 -
  29.  .../lustre/lustre/include/lustre_req_layout.h      |    7 -
  30.  drivers/staging/lustre/lustre/include/lustre_sec.h |   20 -
  31.  drivers/staging/lustre/lustre/include/obd.h        |    1 -
  32.  drivers/staging/lustre/lustre/include/obd_class.h  |   29 -
  33.  drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c    |    5 -
  34.  drivers/staging/lustre/lustre/obdclass/acl.c       |  119 ---
  35.  drivers/staging/lustre/lustre/obdclass/capa.c      |  323 -------
  36.  drivers/staging/lustre/lustre/obdclass/cl_io.c     |   65 --
  37.  drivers/staging/lustre/lustre/obdclass/cl_lock.c   |   37 +-
  38.  drivers/staging/lustre/lustre/obdclass/cl_object.c |   41 -
  39.  drivers/staging/lustre/lustre/obdclass/debug.c     |   10 -
  40.  drivers/staging/lustre/lustre/obdclass/dt_object.c | 1001 --------------------
  41.  drivers/staging/lustre/lustre/obdclass/genops.c    |  239 -----
  42.  .../lustre/lustre/obdclass/linux/linux-obdo.c      |  137 ---
  43.  .../lustre/lustre/obdclass/linux/linux-sysctl.c    |    4 -
  44.  drivers/staging/lustre/lustre/obdclass/llog.c      |  378 +-------
  45.  drivers/staging/lustre/lustre/obdclass/llog_cat.c  |  499 ----------
  46.  .../staging/lustre/lustre/obdclass/llog_internal.h |   10 -
  47.  drivers/staging/lustre/lustre/obdclass/llog_obd.c  |   30 -
  48.  .../lustre/lustre/obdclass/lprocfs_status.c        |  334 -------
  49.  drivers/staging/lustre/lustre/obdclass/lu_object.c |  241 -----
  50.  .../lustre/lustre/obdclass/lustre_handles.c        |   13 -
  51.  .../staging/lustre/lustre/obdclass/obd_config.c    |  257 -----
  52.  drivers/staging/lustre/lustre/obdclass/obd_mount.c |   27 -
  53.  drivers/staging/lustre/lustre/obdclass/obdo.c      |  170 ----
  54.  .../staging/lustre/lustre/obdclass/statfs_pack.c   |   14 -
  55.  drivers/staging/lustre/lustre/ptlrpc/client.c      |   95 --
  56.  drivers/staging/lustre/lustre/ptlrpc/import.c      |   11 -
  57.  drivers/staging/lustre/lustre/ptlrpc/layout.c      |  126 ---
  58.  .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c    |   30 -
  59.  drivers/staging/lustre/lustre/ptlrpc/nrs.c         |  123 ---
  60.  .../staging/lustre/lustre/ptlrpc/pack_generic.c    |  197 ----
  61.  drivers/staging/lustre/lustre/ptlrpc/pinger.c      |  154 ---
  62.  .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |    2 -
  63.  drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c     |   42 -
  64.  drivers/staging/lustre/lustre/ptlrpc/sec.c         |  116 ---
  65.  drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c    |  329 -------
  66.  drivers/staging/lustre/lustre/ptlrpc/sec_config.c  |   48 -
  67.  drivers/staging/lustre/lustre/ptlrpc/sec_gc.c      |   15 -
  68.  drivers/staging/lustre/lustre/ptlrpc/service.c     |  282 ------
  69.  62 files changed, 19 insertions(+), 5934 deletions(-)
  70.  
  71. diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c
  72. index cc2201c25339..bf12723c9b1c 100644
  73. --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
  74. +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
  75. @@ -47,7 +47,6 @@
  76.  
  77.  #include "../include/obd.h"
  78.  #include "../include/obd_class.h"
  79. -#include "../include/dt_object.h"
  80.  #include "../include/obd_support.h"
  81.  #include "../include/lustre_req_layout.h"
  82.  #include "../include/lustre_fid.h"
  83. diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c
  84. index 5eeb36dc988f..446917484637 100644
  85. --- a/drivers/staging/lustre/lustre/fld/fld_cache.c
  86. +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
  87. @@ -53,7 +53,6 @@
  88.  #include "../include/obd_support.h"
  89.  #include "../include/lprocfs_status.h"
  90.  
  91. -#include "../include/dt_object.h"
  92.  #include "../include/lustre_req_layout.h"
  93.  #include "../include/lustre_fld.h"
  94.  #include "fld_internal.h"
  95. diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h
  96. index 844576b9bc6f..fbb232de6c74 100644
  97. --- a/drivers/staging/lustre/lustre/fld/fld_internal.h
  98. +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h
  99. @@ -42,7 +42,6 @@
  100.  #define __FLD_INTERNAL_H
  101.  
  102.  #include "../include/lustre/lustre_idl.h"
  103. -#include "../include/dt_object.h"
  104.  
  105.  #include "../../include/linux/libcfs/libcfs.h"
  106.  #include "../include/lustre_req_layout.h"
  107. @@ -175,8 +174,6 @@ void fld_dump_cache_entries(struct fld_cache *cache);
  108.  struct fld_cache_entry
  109.  *fld_cache_entry_lookup_nolock(struct fld_cache *cache,
  110.                   struct lu_seq_range *range);
  111. -int fld_write_range(const struct lu_env *env, struct dt_object *dt,
  112. -           const struct lu_seq_range *range, struct thandle *th);
  113.  
  114.  static inline const char *
  115.  fld_target_name(struct lu_fld_target *tar)
  116. diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c
  117. index 1e450bf95383..3fd91bc77da5 100644
  118. --- a/drivers/staging/lustre/lustre/fld/fld_request.c
  119. +++ b/drivers/staging/lustre/lustre/fld/fld_request.c
  120. @@ -52,7 +52,6 @@
  121.  #include "../include/obd_support.h"
  122.  #include "../include/lprocfs_status.h"
  123.  
  124. -#include "../include/dt_object.h"
  125.  #include "../include/lustre_req_layout.h"
  126.  #include "../include/lustre_fld.h"
  127.  #include "../include/lustre_mdc.h"
  128. diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c b/drivers/staging/lustre/lustre/fld/lproc_fld.c
  129. index da822101e005..603f56e6095b 100644
  130. --- a/drivers/staging/lustre/lustre/fld/lproc_fld.c
  131. +++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c
  132. @@ -48,7 +48,6 @@
  133.  
  134.  #include "../include/obd.h"
  135.  #include "../include/obd_class.h"
  136. -#include "../include/dt_object.h"
  137.  #include "../include/obd_support.h"
  138.  #include "../include/lustre_req_layout.h"
  139.  #include "../include/lustre_fld.h"
  140. diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h
  141. index 90fbaa22e510..1ee4b185a35f 100644
  142. --- a/drivers/staging/lustre/lustre/include/cl_object.h
  143. +++ b/drivers/staging/lustre/lustre/include/cl_object.h
  144. @@ -2737,7 +2737,6 @@ struct cl_object *cl_object_find(const struct lu_env *env, struct cl_device *cd,
  145.                  const struct cl_object_conf *c);
  146.  
  147.  int  cl_object_header_init(struct cl_object_header *h);
  148. -void cl_object_header_fini(struct cl_object_header *h);
  149.  void cl_object_put (const struct lu_env *env, struct cl_object *o);
  150.  void cl_object_get (struct cl_object *o);
  151.  void cl_object_attr_lock  (struct cl_object *o);
  152. @@ -2752,7 +2751,6 @@ int  cl_conf_set    (const struct lu_env *env, struct cl_object *obj,
  153.                const struct cl_object_conf *conf);
  154.  void cl_object_prune      (const struct lu_env *env, struct cl_object *obj);
  155.  void cl_object_kill       (const struct lu_env *env, struct cl_object *obj);
  156. -int  cl_object_has_locks  (struct cl_object *obj);
  157.  
  158.  /**
  159.   * Returns true, iff \a o0 and \a o1 are slices of the same object.
  160. @@ -2939,10 +2937,6 @@ void  cl_lock_release   (const struct lu_env *env, struct cl_lock *lock,
  161.  void  cl_lock_user_add  (const struct lu_env *env, struct cl_lock *lock);
  162.  void  cl_lock_user_del  (const struct lu_env *env, struct cl_lock *lock);
  163.  
  164. -enum cl_lock_state cl_lock_intransit(const struct lu_env *env,
  165. -                    struct cl_lock *lock);
  166. -void cl_lock_extransit(const struct lu_env *env, struct cl_lock *lock,
  167. -              enum cl_lock_state state);
  168.  int cl_lock_is_intransit(struct cl_lock *lock);
  169.  
  170.  int cl_lock_enqueue_wait(const struct lu_env *env, struct cl_lock *lock,
  171. @@ -2980,8 +2974,6 @@ int cl_lock_enqueue_wait(const struct lu_env *env, struct cl_lock *lock,
  172.   *
  173.   * @{ */
  174.  
  175. -int   cl_enqueue    (const struct lu_env *env, struct cl_lock *lock,
  176. -            struct cl_io *io, __u32 flags);
  177.  int   cl_wait       (const struct lu_env *env, struct cl_lock *lock);
  178.  void  cl_unuse      (const struct lu_env *env, struct cl_lock *lock);
  179.  int   cl_enqueue_try(const struct lu_env *env, struct cl_lock *lock,
  180. @@ -2993,14 +2985,12 @@ int   cl_use_try    (const struct lu_env *env, struct cl_lock *lock, int atomic)
  181.  /** @} statemachine */
  182.  
  183.  void cl_lock_signal      (const struct lu_env *env, struct cl_lock *lock);
  184. -int  cl_lock_state_wait  (const struct lu_env *env, struct cl_lock *lock);
  185.  void cl_lock_state_set   (const struct lu_env *env, struct cl_lock *lock,
  186.               enum cl_lock_state state);
  187.  int  cl_queue_match      (const struct list_head *queue,
  188.               const struct cl_lock_descr *need);
  189.  
  190.  void cl_lock_mutex_get  (const struct lu_env *env, struct cl_lock *lock);
  191. -int  cl_lock_mutex_try  (const struct lu_env *env, struct cl_lock *lock);
  192.  void cl_lock_mutex_put  (const struct lu_env *env, struct cl_lock *lock);
  193.  int  cl_lock_is_mutexed (struct cl_lock *lock);
  194.  int  cl_lock_nr_mutexed (const struct lu_env *env);
  195. @@ -3021,8 +3011,6 @@ int  cl_lock_closure_build(const struct lu_env *env, struct cl_lock *lock,
  196.                struct cl_lock_closure *closure);
  197.  void cl_lock_disclosure   (const struct lu_env *env,
  198.                struct cl_lock_closure *closure);
  199. -int  cl_lock_enclosure    (const struct lu_env *env, struct cl_lock *lock,
  200. -              struct cl_lock_closure *closure);
  201.  
  202.  void cl_lock_cancel(const struct lu_env *env, struct cl_lock *lock);
  203.  void cl_lock_delete(const struct lu_env *env, struct cl_lock *lock);
  204. @@ -3066,10 +3054,6 @@ int   cl_io_submit_rw    (const struct lu_env *env, struct cl_io *io,
  205.  int   cl_io_submit_sync  (const struct lu_env *env, struct cl_io *io,
  206.               enum cl_req_type iot, struct cl_2queue *queue,
  207.               long timeout);
  208. -void  cl_io_rw_advance   (const struct lu_env *env, struct cl_io *io,
  209. -             size_t nob);
  210. -int   cl_io_cancel       (const struct lu_env *env, struct cl_io *io,
  211. -             struct cl_page_list *queue);
  212.  int   cl_io_is_going     (const struct lu_env *env);
  213.  
  214.  /**
  215. @@ -3101,9 +3085,6 @@ static inline int cl_io_is_trunc(const struct cl_io *io)
  216.  
  217.  struct cl_io *cl_io_top(struct cl_io *io);
  218.  
  219. -void cl_io_print(const struct lu_env *env, void *cookie,
  220. -        lu_printer_t printer, const struct cl_io *io);
  221. -
  222.  #define CL_IO_SLICE_CLEAN(foo_io, base)                    \
  223.  do {                                   \
  224.     typeof(foo_io) __foo_io = (foo_io);             \
  225. @@ -3151,8 +3132,6 @@ void cl_page_list_disown (const struct lu_env *env,
  226.               struct cl_io *io, struct cl_page_list *plist);
  227.  int  cl_page_list_own    (const struct lu_env *env,
  228.               struct cl_io *io, struct cl_page_list *plist);
  229. -void cl_page_list_assume (const struct lu_env *env,
  230. -             struct cl_io *io, struct cl_page_list *plist);
  231.  void cl_page_list_discard(const struct lu_env *env,
  232.               struct cl_io *io, struct cl_page_list *plist);
  233.  int  cl_page_list_unmap  (const struct lu_env *env,
  234. @@ -3163,8 +3142,6 @@ void cl_2queue_init     (struct cl_2queue *queue);
  235.  void cl_2queue_add      (struct cl_2queue *queue, struct cl_page *page);
  236.  void cl_2queue_disown   (const struct lu_env *env,
  237.              struct cl_io *io, struct cl_2queue *queue);
  238. -void cl_2queue_assume   (const struct lu_env *env,
  239. -            struct cl_io *io, struct cl_2queue *queue);
  240.  void cl_2queue_discard  (const struct lu_env *env,
  241.              struct cl_io *io, struct cl_2queue *queue);
  242.  void cl_2queue_fini     (const struct lu_env *env, struct cl_2queue *queue);
  243. @@ -3257,7 +3234,6 @@ struct cl_env_nest {
  244.     void *cen_cookie;
  245.  };
  246.  
  247. -struct lu_env *cl_env_peek       (int *refcheck);
  248.  struct lu_env *cl_env_get  (int *refcheck);
  249.  struct lu_env *cl_env_alloc      (int *refcheck, __u32 tags);
  250.  struct lu_env *cl_env_nested_get (struct cl_env_nest *nest);
  251. @@ -3273,7 +3249,6 @@ void     cl_env_unplant    (struct lu_env *env, int *refcheck);
  252.  /*
  253.   * Misc
  254.   */
  255. -void cl_attr2lvb(struct ost_lvb *lvb, const struct cl_attr *attr);
  256.  void cl_lvb2attr(struct cl_attr *attr, const struct ost_lvb *lvb);
  257.  
  258.  struct cl_device *cl_type_setup(const struct lu_env *env, struct lu_site *site,
  259. diff --git a/drivers/staging/lustre/lustre/include/dt_object.h b/drivers/staging/lustre/lustre/include/dt_object.h
  260. index abae31b41e74..4fc92cd29be6 100644
  261. --- a/drivers/staging/lustre/lustre/include/dt_object.h
  262. +++ b/drivers/staging/lustre/lustre/include/dt_object.h
  263. @@ -207,23 +207,6 @@ enum dt_index_flags {
  264.  };
  265.  
  266.  /**
  267. - * Features, required from index to support file system directories (mapping
  268. - * names to fids).
  269. - */
  270. -extern const struct dt_index_features dt_directory_features;
  271. -extern const struct dt_index_features dt_otable_features;
  272. -extern const struct dt_index_features dt_lfsck_features;
  273. -
  274. -/* index features supported by the accounting objects */
  275. -extern const struct dt_index_features dt_acct_features;
  276. -
  277. -/* index features supported by the quota global indexes */
  278. -extern const struct dt_index_features dt_quota_glb_features;
  279. -
  280. -/* index features supported by the quota slave indexes */
  281. -extern const struct dt_index_features dt_quota_slv_features;
  282. -
  283. -/**
  284.   * This is a general purpose dt allocation hint.
  285.   * It now contains the parent object.
  286.   * It can contain any allocation hint in the future.
  287. @@ -272,8 +255,6 @@ struct dt_object_format {
  288.     } u;
  289.  };
  290.  
  291. -enum dt_format_type dt_mode_to_dft(__u32 mode);
  292. -
  293.  typedef __u64 dt_obj_version_t;
  294.  
  295.  /**
  296. @@ -658,9 +639,6 @@ struct dt_device {
  297.     struct list_head             dd_txn_callbacks;
  298.  };
  299.  
  300. -int  dt_device_init(struct dt_device *dev, struct lu_device_type *t);
  301. -void dt_device_fini(struct dt_device *dev);
  302. -
  303.  static inline int lu_device_is_dt(const struct lu_device *d)
  304.  {
  305.     return ergo(d != NULL, d->ld_type->ldt_tags & LU_DEVICE_DT);
  306. @@ -703,11 +681,6 @@ static inline struct dt_object *lu2dt(struct lu_object *l)
  307.     return container_of0(l, struct dt_object, do_lu);
  308.  }
  309.  
  310. -int  dt_object_init(struct dt_object *obj,
  311. -           struct lu_object_header *h, struct lu_device *d);
  312. -
  313. -void dt_object_fini(struct dt_object *obj);
  314. -
  315.  static inline int dt_object_exists(const struct dt_object *dt)
  316.  {
  317.     return lu_object_exists(&dt->do_lu);
  318. @@ -789,16 +762,6 @@ struct dt_txn_callback {
  319.     struct list_head       dtc_linkage;
  320.  };
  321.  
  322. -void dt_txn_callback_add(struct dt_device *dev, struct dt_txn_callback *cb);
  323. -void dt_txn_callback_del(struct dt_device *dev, struct dt_txn_callback *cb);
  324. -
  325. -int dt_txn_hook_start(const struct lu_env *env,
  326. -             struct dt_device *dev, struct thandle *txn);
  327. -int dt_txn_hook_stop(const struct lu_env *env, struct thandle *txn);
  328. -void dt_txn_hook_commit(struct thandle *txn);
  329. -
  330. -int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj);
  331. -
  332.  /**
  333.   * Callback function used for parsing path.
  334.   * \see llo_store_resolve
  335. @@ -809,10 +772,6 @@ typedef int (*dt_entry_func_t)(const struct lu_env *env,
  336.  
  337.  #define DT_MAX_PATH 1024
  338.  
  339. -int dt_path_parser(const struct lu_env *env,
  340. -          char *local, dt_entry_func_t entry_func,
  341. -          void *data);
  342. -
  343.  struct dt_object *
  344.  dt_store_resolve(const struct lu_env *env, struct dt_device *dt,
  345.          const char *path, struct lu_fid *fid);
  346. @@ -823,24 +782,6 @@ struct dt_object *dt_store_open(const struct lu_env *env,
  347.                 const char *filename,
  348.                 struct lu_fid *fid);
  349.  
  350. -struct dt_object *dt_find_or_create(const struct lu_env *env,
  351. -                   struct dt_device *dt,
  352. -                   const struct lu_fid *fid,
  353. -                   struct dt_object_format *dof,
  354. -                   struct lu_attr *attr);
  355. -
  356. -struct dt_object *dt_locate_at(const struct lu_env *env,
  357. -                  struct dt_device *dev,
  358. -                  const struct lu_fid *fid,
  359. -                  struct lu_device *top_dev);
  360. -static inline struct dt_object *
  361. -dt_locate(const struct lu_env *env, struct dt_device *dev,
  362. -     const struct lu_fid *fid)
  363. -{
  364. -   return dt_locate_at(env, dev, fid, dev->dd_lu_dev.ld_site->ls_top_dev);
  365. -}
  366. -
  367. -
  368.  int local_oid_storage_init(const struct lu_env *env, struct dt_device *dev,
  369.                const struct lu_fid *first_fid,
  370.                struct local_oid_storage **los);
  371. @@ -886,51 +827,10 @@ local_index_find_or_create_with_fid(const struct lu_env *env,
  372.  int local_object_unlink(const struct lu_env *env, struct dt_device *dt,
  373.             struct dt_object *parent, const char *name);
  374.  
  375. -static inline int dt_object_lock(const struct lu_env *env,
  376. -                struct dt_object *o, struct lustre_handle *lh,
  377. -                struct ldlm_enqueue_info *einfo,
  378. -                void *policy)
  379. -{
  380. -   LASSERT(o);
  381. -   LASSERT(o->do_ops);
  382. -   LASSERT(o->do_ops->do_object_lock);
  383. -   return o->do_ops->do_object_lock(env, o, lh, einfo, policy);
  384. -}
  385. -
  386. -int dt_lookup_dir(const struct lu_env *env, struct dt_object *dir,
  387. -         const char *name, struct lu_fid *fid);
  388. -
  389. -static inline int dt_object_sync(const struct lu_env *env, struct dt_object *o,
  390. -                __u64 start, __u64 end)
  391. -{
  392. -   LASSERT(o);
  393. -   LASSERT(o->do_ops);
  394. -   LASSERT(o->do_ops->do_object_sync);
  395. -   return o->do_ops->do_object_sync(env, o, start, end);
  396. -}
  397. -
  398. -int dt_declare_version_set(const struct lu_env *env, struct dt_object *o,
  399. -              struct thandle *th);
  400. -void dt_version_set(const struct lu_env *env, struct dt_object *o,
  401. -           dt_obj_version_t version, struct thandle *th);
  402. -dt_obj_version_t dt_version_get(const struct lu_env *env, struct dt_object *o);
  403. -
  404. -
  405. -int dt_read(const struct lu_env *env, struct dt_object *dt,
  406. -       struct lu_buf *buf, loff_t *pos);
  407. -int dt_record_read(const struct lu_env *env, struct dt_object *dt,
  408. -          struct lu_buf *buf, loff_t *pos);
  409. -int dt_record_write(const struct lu_env *env, struct dt_object *dt,
  410. -           const struct lu_buf *buf, loff_t *pos, struct thandle *th);
  411.  typedef int (*dt_index_page_build_t)(const struct lu_env *env,
  412.                      union lu_page *lp, int nob,
  413.                      const struct dt_it_ops *iops,
  414.                      struct dt_it *it, __u32 attr, void *arg);
  415. -int dt_index_walk(const struct lu_env *env, struct dt_object *obj,
  416. -         const struct lu_rdpg *rdpg, dt_index_page_build_t filler,
  417. -         void *arg);
  418. -int dt_index_read(const struct lu_env *env, struct dt_device *dev,
  419. -         struct idx_info *ii, const struct lu_rdpg *rdpg);
  420.  
  421.  static inline struct thandle *dt_trans_create(const struct lu_env *env,
  422.                           struct dt_device *d)
  423. @@ -1449,48 +1349,4 @@ static inline int dt_lookup(const struct lu_env *env,
  424.  
  425.  #define LU221_BAD_TIME (0x80000000U + 24 * 3600)
  426.  
  427. -struct dt_find_hint {
  428. -   struct lu_fid   *dfh_fid;
  429. -   struct dt_device     *dfh_dt;
  430. -   struct dt_object     *dfh_o;
  431. -};
  432. -
  433. -struct dt_thread_info {
  434. -   char             dti_buf[DT_MAX_PATH];
  435. -   struct dt_find_hint      dti_dfh;
  436. -   struct lu_attr     dti_attr;
  437. -   struct lu_fid       dti_fid;
  438. -   struct dt_object_format  dti_dof;
  439. -   struct lustre_mdt_attrs  dti_lma;
  440. -   struct lu_buf       dti_lb;
  441. -   loff_t         dti_off;
  442. -};
  443. -
  444. -extern struct lu_context_key dt_key;
  445. -
  446. -static inline struct dt_thread_info *dt_info(const struct lu_env *env)
  447. -{
  448. -   struct dt_thread_info *dti;
  449. -
  450. -   dti = lu_context_key_get(&env->le_ctx, &dt_key);
  451. -   LASSERT(dti);
  452. -   return dti;
  453. -}
  454. -
  455. -int dt_global_init(void);
  456. -void dt_global_fini(void);
  457. -
  458. -int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
  459. -             int count, int *eof, void *data);
  460. -int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off,
  461. -                 int count, int *eof, void *data);
  462. -int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off,
  463. -                int count, int *eof, void *data);
  464. -int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off,
  465. -                 int count, int *eof, void *data);
  466. -int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off,
  467. -                int count, int *eof, void *data);
  468. -int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
  469. -               int count, int *eof, void *data);
  470. -
  471.  #endif /* __LUSTRE_DT_OBJECT_H */
  472. diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
  473. index 36c0690361fb..3deff28b2c7f 100644
  474. --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
  475. +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
  476. @@ -537,26 +537,17 @@ extern struct lprocfs_stats *
  477.  lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
  478.  void lprocfs_clear_stats(struct lprocfs_stats *stats);
  479.  void lprocfs_free_stats(struct lprocfs_stats **stats);
  480. -void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats);
  481. -void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats);
  482. -void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
  483.  int lprocfs_alloc_obd_stats(struct obd_device *obddev,
  484.                 unsigned int num_private_stats);
  485. -int lprocfs_alloc_md_stats(struct obd_device *obddev,
  486. -              unsigned int num_private_stats);
  487.  void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
  488.               unsigned conf, const char *name, const char *units);
  489.  void lprocfs_free_obd_stats(struct obd_device *obddev);
  490. -void lprocfs_free_md_stats(struct obd_device *obddev);
  491.  struct obd_export;
  492.  int lprocfs_exp_cleanup(struct obd_export *exp);
  493.  struct dentry *ldebugfs_add_simple(struct dentry *root,
  494.                    char *name,
  495.                    void *data,
  496.                    struct file_operations *fops);
  497. -struct dentry *
  498. -ldebugfs_add_symlink(const char *name, struct dentry *parent,
  499. -            const char *format, ...);
  500.  
  501.  int ldebugfs_register_stats(struct dentry *parent,
  502.                 const char *name,
  503. @@ -591,14 +582,12 @@ int ldebugfs_obd_seq_create(struct obd_device *dev,
  504.  
  505.  /* Generic callbacks */
  506.  
  507. -int lprocfs_rd_u64(struct seq_file *m, void *data);
  508. -int lprocfs_rd_atomic(struct seq_file *m, void *data);
  509. -int lprocfs_wr_atomic(struct file *file, const char __user *buffer,
  510. -             unsigned long count, void *data);
  511. +
  512. + /* Generic callbacks */
  513. +
  514.  int lprocfs_rd_uint(struct seq_file *m, void *data);
  515.  int lprocfs_wr_uint(struct file *file, const char __user *buffer,
  516. -           unsigned long count, void *data);
  517. -int lprocfs_rd_name(struct seq_file *m, void *data);
  518. +                   unsigned long count, void *data);
  519.  int lprocfs_rd_server_uuid(struct seq_file *m, void *data);
  520.  int lprocfs_rd_conn_uuid(struct seq_file *m, void *data);
  521.  int lprocfs_rd_import(struct seq_file *m, void *data);
  522. @@ -609,22 +598,21 @@ struct adaptive_timeout;
  523.  int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at);
  524.  int lprocfs_rd_timeouts(struct seq_file *m, void *data);
  525.  int lprocfs_wr_timeouts(struct file *file, const char __user *buffer,
  526. -           unsigned long count, void *data);
  527. +                       unsigned long count, void *data);
  528.  int lprocfs_wr_evict_client(struct file *file, const char __user *buffer,
  529. -               size_t count, loff_t *off);
  530. +                           size_t count, loff_t *off);
  531.  int lprocfs_wr_ping(struct file *file, const char __user *buffer,
  532. -           size_t count, loff_t *off);
  533. +                   size_t count, loff_t *off);
  534.  int lprocfs_wr_import(struct file *file, const char __user *buffer,
  535. -             size_t count, loff_t *off);
  536. +                     size_t count, loff_t *off);
  537.  int lprocfs_rd_pinger_recov(struct seq_file *m, void *n);
  538.  int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer,
  539. -               size_t count, loff_t *off);
  540. +                           size_t count, loff_t *off);
  541.  
  542.  /* Statfs helpers */
  543.  
  544.  int lprocfs_write_helper(const char __user *buffer, unsigned long count,
  545.              int *val);
  546. -int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
  547.  int lprocfs_write_u64_helper(const char __user *buffer,
  548.                  unsigned long count, __u64 *val);
  549.  int lprocfs_write_frac_u64_helper(const char *buffer,
  550. @@ -738,15 +726,6 @@ ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,
  551.  
  552.  extern const struct sysfs_ops lustre_sysfs_ops;
  553.  
  554. -/* lproc_ptlrpc.c */
  555. -struct ptlrpc_request;
  556. -void target_print_req(void *seq_file, struct ptlrpc_request *req);
  557. -
  558. -/* lproc_status.c */
  559. -int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data);
  560. -int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
  561. -                    size_t count, loff_t *off);
  562. -
  563.  /* all quota proc functions */
  564.  int lprocfs_quota_rd_bunit(char *page, char **start,
  565.                loff_t off, int count,
  566. diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h
  567. index 77560085082a..e2199c2cea44 100644
  568. --- a/drivers/staging/lustre/lustre/include/lu_object.h
  569. +++ b/drivers/staging/lustre/lustre/include/lu_object.h
  570. @@ -672,7 +672,6 @@ void lu_object_add_top    (struct lu_object_header *h, struct lu_object *o);
  571.  void lu_object_add (struct lu_object *before, struct lu_object *o);
  572.  
  573.  void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d);
  574. -void lu_dev_del_linkage(struct lu_site *s, struct lu_device *d);
  575.  
  576.  /**
  577.   * Helpers to initialize and finalize device types.
  578. @@ -710,7 +709,6 @@ static inline int lu_object_is_dying(const struct lu_object_header *h)
  579.  }
  580.  
  581.  void lu_object_put(const struct lu_env *env, struct lu_object *o);
  582. -void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o);
  583.  void lu_object_unhash(const struct lu_env *env, struct lu_object *o);
  584.  
  585.  int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr);
  586. @@ -1241,14 +1239,6 @@ void lu_context_key_degister_many(struct lu_context_key *k, ...);
  587.  void lu_context_key_revive_many  (struct lu_context_key *k, ...);
  588.  void lu_context_key_quiesce_many (struct lu_context_key *k, ...);
  589.  
  590. -/*
  591. - * update/clear ctx/ses tags.
  592. - */
  593. -void lu_context_tags_update(__u32 tags);
  594. -void lu_context_tags_clear(__u32 tags);
  595. -void lu_session_tags_update(__u32 tags);
  596. -void lu_session_tags_clear(__u32 tags);
  597. -
  598.  /**
  599.   * Environment.
  600.   */
  601. @@ -1266,7 +1256,6 @@ struct lu_env {
  602.  int  lu_env_init  (struct lu_env *env, __u32 tags);
  603.  void lu_env_fini  (struct lu_env *env);
  604.  int  lu_env_refill(struct lu_env *env);
  605. -int  lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, __u32 stags);
  606.  
  607.  /** @} lu_context */
  608.  
  609. @@ -1319,21 +1308,5 @@ struct lu_kmem_descr {
  610.  int  lu_kmem_init(struct lu_kmem_descr *caches);
  611.  void lu_kmem_fini(struct lu_kmem_descr *caches);
  612.  
  613. -void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o,
  614. -             const struct lu_fid *fid);
  615. -struct lu_object *lu_object_anon(const struct lu_env *env,
  616. -                struct lu_device *dev,
  617. -                const struct lu_object_conf *conf);
  618. -
  619. -/** null buffer */
  620. -extern struct lu_buf LU_BUF_NULL;
  621. -
  622. -void lu_buf_free(struct lu_buf *buf);
  623. -void lu_buf_alloc(struct lu_buf *buf, int size);
  624. -void lu_buf_realloc(struct lu_buf *buf, int size);
  625. -
  626. -int lu_buf_check_and_grow(struct lu_buf *buf, int len);
  627. -struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, int len);
  628. -
  629.  /** @} lu */
  630.  #endif /* __LUSTRE_LU_OBJECT_H */
  631. diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
  632. index e0cec23e8344..50390414b677 100644
  633. --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
  634. +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
  635. @@ -2587,8 +2587,6 @@ struct lmv_desc {
  636.     struct obd_uuid ld_uuid;
  637.  };
  638.  
  639. -void lustre_swab_lmv_desc(struct lmv_desc *ld);
  640. -
  641.  /* TODO: lmv_stripe_md should contain mds capabilities for all slave fids */
  642.  struct lmv_stripe_md {
  643.     __u32    mea_magic;
  644. @@ -2599,8 +2597,6 @@ struct lmv_stripe_md {
  645.     struct lu_fid mea_ids[0];
  646.  };
  647.  
  648. -void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea);
  649. -
  650.  /* lmv structures */
  651.  #define MEA_MAGIC_LAST_CHAR      0xb2221ca1
  652.  #define MEA_MAGIC_ALL_CHARS      0xb222a11c
  653. @@ -3442,8 +3438,6 @@ struct lu_idxpage {
  654.     char    lip_entries[0];
  655.  };
  656.  
  657. -void lustre_swab_lip_header(struct lu_idxpage *lip);
  658. -
  659.  #define LIP_HDR_SIZE (offsetof(struct lu_idxpage, lip_entries))
  660.  
  661.  /* Gather all possible type associated with a 4KB container */
  662. @@ -3541,8 +3535,6 @@ struct lustre_capa_key {
  663.     __u8    lk_key[CAPA_HMAC_KEY_MAX_LEN];    /**< key */
  664.  } __attribute__((packed));
  665.  
  666. -void lustre_swab_lustre_capa_key(struct lustre_capa_key *k);
  667. -
  668.  /** The link ea holds 1 \a link_ea_entry for each hardlink */
  669.  #define LINK_EA_MAGIC 0x11EAF1DFUL
  670.  struct link_ea_header {
  671. diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
  672. index e9925ef1dbee..1a41366322fe 100644
  673. --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
  674. +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
  675. @@ -406,8 +406,6 @@ static inline int lmv_user_md_size(int stripes, int lmm_magic)
  676.               stripes * sizeof(struct lmv_user_mds_data);
  677.  }
  678.  
  679. -void lustre_swab_lmv_user_md(struct lmv_user_md *lum);
  680. -
  681.  struct ll_recreate_obj {
  682.     __u64 lrc_id;
  683.     __u32 lrc_ost_idx;
  684. diff --git a/drivers/staging/lustre/lustre/include/lustre_capa.h b/drivers/staging/lustre/lustre/include/lustre_capa.h
  685. index b75f7308d777..2454481735b5 100644
  686. --- a/drivers/staging/lustre/lustre/include/lustre_capa.h
  687. +++ b/drivers/staging/lustre/lustre/include/lustre_capa.h
  688. @@ -180,16 +180,7 @@ extern int capa_count[];
  689.  extern struct kmem_cache *capa_cachep;
  690.  
  691.  struct hlist_head *init_capa_hash(void);
  692. -void cleanup_capa_hash(struct hlist_head *hash);
  693.  
  694. -struct obd_capa *capa_add(struct hlist_head *hash,
  695. -             struct lustre_capa *capa);
  696. -struct obd_capa *capa_lookup(struct hlist_head *hash,
  697. -                struct lustre_capa *capa, int alive);
  698. -
  699. -int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key);
  700. -int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen);
  701. -int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen);
  702.  void capa_cpy(void *dst, struct obd_capa *ocapa);
  703.  static inline struct obd_capa *alloc_capa(int site)
  704.  {
  705. diff --git a/drivers/staging/lustre/lustre/include/lustre_debug.h b/drivers/staging/lustre/lustre/include/lustre_debug.h
  706. index 6c92d0bc943b..8a089413c92e 100644
  707. --- a/drivers/staging/lustre/lustre/include/lustre_debug.h
  708. +++ b/drivers/staging/lustre/lustre/include/lustre_debug.h
  709. @@ -46,7 +46,6 @@
  710.  #include "obd.h"
  711.  
  712.  /* lib/debug.c */
  713. -void dump_lniobuf(struct niobuf_local *lnb);
  714.  int dump_req(struct ptlrpc_request *req);
  715.  int block_debug_setup(void *addr, int len, __u64 off, __u64 id);
  716.  int block_debug_check(char *who, void *addr, int len, __u64 off, __u64 id);
  717. diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h
  718. index ec33259ca7df..4178c8563dd3 100644
  719. --- a/drivers/staging/lustre/lustre/include/lustre_disk.h
  720. +++ b/drivers/staging/lustre/lustre/include/lustre_disk.h
  721. @@ -385,8 +385,6 @@ struct lustre_mount_info {
  722.  /* obd_mount.c */
  723.  int server_name2fsname(const char *svname, char *fsname, const char **endptr);
  724.  int server_name2index(const char *svname, __u32 *idx, const char **endptr);
  725. -int server_name2svname(const char *label, char *svname, const char **endptr,
  726. -              size_t svsize);
  727.  
  728.  int lustre_put_lsi(struct super_block *sb);
  729.  int lustre_start_simple(char *obdname, char *type, char *uuid,
  730. diff --git a/drivers/staging/lustre/lustre/include/lustre_eacl.h b/drivers/staging/lustre/lustre/include/lustre_eacl.h
  731. index 0f8f76c43ee1..499f9c8e1ae1 100644
  732. --- a/drivers/staging/lustre/lustre/include/lustre_eacl.h
  733. +++ b/drivers/staging/lustre/lustre/include/lustre_eacl.h
  734. @@ -80,10 +80,6 @@ extern void
  735.  lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size);
  736.  extern void
  737.  lustre_ext_acl_xattr_free(ext_acl_xattr_header *header);
  738. -extern int
  739. -lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size,
  740. -                ext_acl_xattr_header *ext_header,
  741. -                posix_acl_xattr_header **out);
  742.  extern ext_acl_xattr_header *
  743.  lustre_acl_xattr_merge2ext(posix_acl_xattr_header *posix_header, int size,
  744.                ext_acl_xattr_header *ext_header);
  745. diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h
  746. index b06ee9ff22ae..e0fddaf4eda5 100644
  747. --- a/drivers/staging/lustre/lustre/include/lustre_export.h
  748. +++ b/drivers/staging/lustre/lustre/include/lustre_export.h
  749. @@ -265,12 +265,6 @@ static inline int exp_connect_multibulk(struct obd_export *exp)
  750.     return exp_max_brw_size(exp) > ONE_MB_BRW_SIZE;
  751.  }
  752.  
  753. -static inline int exp_expired(struct obd_export *exp, long age)
  754. -{
  755. -   LASSERT(exp->exp_delayed);
  756. -   return exp->exp_last_request_time + age < ktime_get_real_seconds();
  757. -}
  758. -
  759.  static inline int exp_connect_cancelset(struct obd_export *exp)
  760.  {
  761.     LASSERT(exp != NULL);
  762. @@ -368,7 +362,6 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp)
  763.  }
  764.  
  765.  struct obd_export *class_conn2export(struct lustre_handle *conn);
  766. -struct obd_device *class_conn2obd(struct lustre_handle *conn);
  767.  
  768.  /** @} export */
  769.  
  770. diff --git a/drivers/staging/lustre/lustre/include/lustre_handles.h b/drivers/staging/lustre/lustre/include/lustre_handles.h
  771. index 726bbd3eaf55..4d51c8ac3906 100644
  772. --- a/drivers/staging/lustre/lustre/include/lustre_handles.h
  773. +++ b/drivers/staging/lustre/lustre/include/lustre_handles.h
  774. @@ -86,7 +86,6 @@ struct portals_handle {
  775.  void class_handle_hash(struct portals_handle *,
  776.                struct portals_handle_ops *ops);
  777.  void class_handle_unhash(struct portals_handle *);
  778. -void class_handle_hash_back(struct portals_handle *);
  779.  void *class_handle2object(__u64 cookie);
  780.  void class_handle_free_cb(struct rcu_head *rcu);
  781.  int class_handle_init(void);
  782. diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h
  783. index 079db528ba74..660d29032ad4 100644
  784. --- a/drivers/staging/lustre/lustre/include/lustre_import.h
  785. +++ b/drivers/staging/lustre/lustre/include/lustre_import.h
  786. @@ -374,7 +374,6 @@ extern unsigned int at_max;
  787.  /* genops.c */
  788.  struct obd_export;
  789.  struct obd_import *class_exp2cliimp(struct obd_export *);
  790. -struct obd_import *class_conn2cliimp(struct lustre_handle *);
  791.  
  792.  /** @} import */
  793.  
  794. diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
  795. index b380359cadab..35175fd3da88 100644
  796. --- a/drivers/staging/lustre/lustre/include/lustre_lib.h
  797. +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
  798. @@ -100,7 +100,6 @@ struct obd_client_handle {
  799.  #define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed
  800.  
  801.  /* statfs_pack.c */
  802. -void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs);
  803.  void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs);
  804.  
  805.  /*
  806. diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h
  807. index 2187fb615e9a..4bece1871c30 100644
  808. --- a/drivers/staging/lustre/lustre/include/lustre_log.h
  809. +++ b/drivers/staging/lustre/lustre/include/lustre_log.h
  810. @@ -58,7 +58,6 @@
  811.  
  812.  #include "obd_class.h"
  813.  #include "lustre/lustre_idl.h"
  814. -#include "dt_object.h"
  815.  
  816.  #define LOG_NAME_LIMIT(logname, name)         \
  817.     snprintf(logname, sizeof(logname), "LOGS/%s", name)
  818. @@ -117,24 +116,17 @@ struct llog_handle;
  819.  /* llog.c  -  general API */
  820.  int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,
  821.              int flags, struct obd_uuid *uuid);
  822. -int llog_copy_handler(const struct lu_env *env, struct llog_handle *llh,
  823. -             struct llog_rec_hdr *rec, void *data);
  824.  int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
  825.          llog_cb_t cb, void *data, void *catdata);
  826.  int llog_process_or_fork(const struct lu_env *env,
  827.              struct llog_handle *loghandle,
  828.              llog_cb_t cb, void *data, void *catdata, bool fork);
  829. -int llog_reverse_process(const struct lu_env *env,
  830. -            struct llog_handle *loghandle, llog_cb_t cb,
  831. -            void *data, void *catdata);
  832.  int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle,
  833.             int index);
  834.  int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt,
  835.           struct llog_handle **lgh, struct llog_logid *logid,
  836.           char *name, enum llog_open_param open_param);
  837.  int llog_close(const struct lu_env *env, struct llog_handle *cathandle);
  838. -int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt,
  839. -         char *name);
  840.  int llog_backup(const struct lu_env *env, struct obd_device *obd,
  841.         struct llog_ctxt *ctxt, struct llog_ctxt *bak_ctxt,
  842.         char *name, char *backup);
  843. @@ -172,29 +164,14 @@ struct llog_process_cat_data {
  844.     int       lpcd_last_idx;
  845.  };
  846.  
  847. +struct thandle;
  848. +
  849.  int llog_cat_close(const struct lu_env *env, struct llog_handle *cathandle);
  850. -int llog_cat_add_rec(const struct lu_env *env, struct llog_handle *cathandle,
  851. -            struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
  852. -            void *buf, struct thandle *th);
  853. -int llog_cat_declare_add_rec(const struct lu_env *env,
  854. -                struct llog_handle *cathandle,
  855. -                struct llog_rec_hdr *rec, struct thandle *th);
  856. -int llog_cat_add(const struct lu_env *env, struct llog_handle *cathandle,
  857. -        struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
  858. -        void *buf);
  859. -int llog_cat_cancel_records(const struct lu_env *env,
  860. -               struct llog_handle *cathandle, int count,
  861. -               struct llog_cookie *cookies);
  862.  int llog_cat_process_or_fork(const struct lu_env *env,
  863.                  struct llog_handle *cat_llh, llog_cb_t cb,
  864.                  void *data, int startcat, int startidx, bool fork);
  865.  int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
  866.              llog_cb_t cb, void *data, int startcat, int startidx);
  867. -int llog_cat_reverse_process(const struct lu_env *env,
  868. -                struct llog_handle *cat_llh, llog_cb_t cb,
  869. -                void *data);
  870. -int llog_cat_init_and_process(const struct lu_env *env,
  871. -                 struct llog_handle *llh);
  872.  
  873.  /* llog_obd.c */
  874.  int llog_setup(const struct lu_env *env, struct obd_device *obd,
  875. @@ -202,9 +179,6 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
  876.            struct obd_device *disk_obd, struct llog_operations *op);
  877.  int __llog_ctxt_put(const struct lu_env *env, struct llog_ctxt *ctxt);
  878.  int llog_cleanup(const struct lu_env *env, struct llog_ctxt *);
  879. -int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
  880. -int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
  881. -       struct llog_cookie *cookies, int flags);
  882.  
  883.  /* llog_net.c */
  884.  int llog_initiator_connect(struct llog_ctxt *ctxt);
  885. @@ -254,8 +228,6 @@ struct llog_operations {
  886.     int (*lop_declare_create)(const struct lu_env *env,
  887.                   struct llog_handle *handle,
  888.                   struct thandle *th);
  889. -   int (*lop_create)(const struct lu_env *env, struct llog_handle *handle,
  890. -             struct thandle *th);
  891.     /**
  892.      * write new record in llog. It appends records usually but can edit
  893.      * existing records too.
  894. @@ -510,11 +482,6 @@ static inline int llog_connect(struct llog_ctxt *ctxt,
  895.  }
  896.  
  897.  /* llog.c */
  898. -int llog_exist(struct llog_handle *loghandle);
  899. -int llog_declare_create(const struct lu_env *env,
  900. -           struct llog_handle *loghandle, struct thandle *th);
  901. -int llog_create(const struct lu_env *env, struct llog_handle *handle,
  902. -       struct thandle *th);
  903.  int llog_declare_write_rec(const struct lu_env *env,
  904.                struct llog_handle *handle,
  905.                struct llog_rec_hdr *rec, int idx,
  906. @@ -522,20 +489,10 @@ int llog_declare_write_rec(const struct lu_env *env,
  907.  int llog_write_rec(const struct lu_env *env, struct llog_handle *handle,
  908.            struct llog_rec_hdr *rec, struct llog_cookie *logcookies,
  909.            int numcookies, void *buf, int idx, struct thandle *th);
  910. -int llog_add(const struct lu_env *env, struct llog_handle *lgh,
  911. -        struct llog_rec_hdr *rec, struct llog_cookie *logcookies,
  912. -        void *buf, struct thandle *th);
  913. -int llog_declare_add(const struct lu_env *env, struct llog_handle *lgh,
  914. -            struct llog_rec_hdr *rec, struct thandle *th);
  915.  int lustre_process_log(struct super_block *sb, char *logname,
  916.                struct config_llog_instance *cfg);
  917.  int lustre_end_log(struct super_block *sb, char *logname,
  918.            struct config_llog_instance *cfg);
  919. -int llog_open_create(const struct lu_env *env, struct llog_ctxt *ctxt,
  920. -            struct llog_handle **res, struct llog_logid *logid,
  921. -            char *name);
  922. -int llog_erase(const struct lu_env *env, struct llog_ctxt *ctxt,
  923. -          struct llog_logid *logid, char *name);
  924.  int llog_write(const struct lu_env *env, struct llog_handle *loghandle,
  925.            struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
  926.            int cookiecount, void *buf, int idx);
  927. diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h
  928. index 0db7810f7d6f..16e606ddfb10 100644
  929. --- a/drivers/staging/lustre/lustre/include/lustre_net.h
  930. +++ b/drivers/staging/lustre/lustre/include/lustre_net.h
  931. @@ -643,7 +643,6 @@ struct ptlrpc_nrs_pol_ops {
  932.      *
  933.      * \see ptlrpc_nrs_req_initialize()
  934.      * \see ptlrpc_nrs_hpreq_add_nolock()
  935. -    * \see ptlrpc_nrs_req_hp_move()
  936.      */
  937.     int (*op_res_get) (struct ptlrpc_nrs_policy *policy,
  938.                    struct ptlrpc_nrs_request *nrq,
  939. @@ -659,7 +658,6 @@ struct ptlrpc_nrs_pol_ops {
  940.      *
  941.      * \see ptlrpc_nrs_req_finalize()
  942.      * \see ptlrpc_nrs_hpreq_add_nolock()
  943. -    * \see ptlrpc_nrs_req_hp_move()
  944.      */
  945.     void    (*op_res_put) (struct ptlrpc_nrs_policy *policy,
  946.                    const struct ptlrpc_nrs_resource *res);
  947. @@ -704,8 +702,6 @@ struct ptlrpc_nrs_pol_ops {
  948.      *
  949.      * \param[in,out] policy The policy the request \a nrq belongs to
  950.      * \param[in,out] nrq    The request to dequeue
  951. -    *
  952. -    * \see ptlrpc_nrs_req_del_nolock()
  953.      */
  954.     void    (*op_req_dequeue) (struct ptlrpc_nrs_policy *policy,
  955.                    struct ptlrpc_nrs_request *nrq);
  956. @@ -1537,10 +1533,6 @@ static inline int ptlrpc_req_interpret(const struct lu_env *env,
  957.   * @{
  958.   */
  959.  int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf);
  960. -int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf);
  961. -void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req);
  962. -void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
  963. -               struct ptlrpc_nrs_pol_info *info);
  964.  
  965.  /*
  966.   * Can the request be moved from the regular NRS head to the high-priority NRS
  967. @@ -2357,22 +2349,17 @@ void ptlrpc_request_committed(struct ptlrpc_request *req, int force);
  968.  
  969.  void ptlrpc_init_client(int req_portal, int rep_portal, char *name,
  970.             struct ptlrpc_client *);
  971. -void ptlrpc_cleanup_client(struct obd_import *imp);
  972.  struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid);
  973.  
  974.  int ptlrpc_queue_wait(struct ptlrpc_request *req);
  975.  int ptlrpc_replay_req(struct ptlrpc_request *req);
  976.  int ptlrpc_unregister_reply(struct ptlrpc_request *req, int async);
  977. -void ptlrpc_restart_req(struct ptlrpc_request *req);
  978.  void ptlrpc_abort_inflight(struct obd_import *imp);
  979. -void ptlrpc_cleanup_imp(struct obd_import *imp);
  980.  void ptlrpc_abort_set(struct ptlrpc_request_set *set);
  981.  
  982.  struct ptlrpc_request_set *ptlrpc_prep_set(void);
  983.  struct ptlrpc_request_set *ptlrpc_prep_fcset(int max, set_producer_func func,
  984.                          void *arg);
  985. -int ptlrpc_set_add_cb(struct ptlrpc_request_set *set,
  986. -             set_interpreter_func fn, void *data);
  987.  int ptlrpc_set_next_timeout(struct ptlrpc_request_set *);
  988.  int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set);
  989.  int ptlrpc_set_wait(struct ptlrpc_request_set *);
  990. @@ -2406,15 +2393,7 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp,
  991.  int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
  992.                  __u32 version, int opcode, char **bufs,
  993.                  struct ptlrpc_cli_ctx *ctx);
  994. -struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, __u32 version,
  995. -                      int opcode, int count, __u32 *lengths,
  996. -                      char **bufs);
  997. -struct ptlrpc_request *ptlrpc_prep_req_pool(struct obd_import *imp,
  998. -                        __u32 version, int opcode,
  999. -                       int count, __u32 *lengths, char **bufs,
  1000. -                       struct ptlrpc_request_pool *pool);
  1001.  void ptlrpc_req_finished(struct ptlrpc_request *request);
  1002. -void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request);
  1003.  struct ptlrpc_request *ptlrpc_request_addref(struct ptlrpc_request *req);
  1004.  struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req,
  1005.                           unsigned npages, unsigned max_brw,
  1006. @@ -2525,12 +2504,8 @@ struct ptlrpc_service_conf {
  1007.   *
  1008.   * @{
  1009.   */
  1010. -void ptlrpc_save_lock(struct ptlrpc_request *req,
  1011. -             struct lustre_handle *lock, int mode, int no_ack);
  1012. -void ptlrpc_commit_replies(struct obd_export *exp);
  1013.  void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs);
  1014.  void ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs);
  1015. -int ptlrpc_hpreq_handler(struct ptlrpc_request *req);
  1016.  struct ptlrpc_service *ptlrpc_register_service(
  1017.                 struct ptlrpc_service_conf *conf,
  1018.                 struct kset *parent,
  1019. @@ -2540,11 +2515,7 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc);
  1020.  int ptlrpc_start_threads(struct ptlrpc_service *svc);
  1021.  int ptlrpc_unregister_service(struct ptlrpc_service *service);
  1022.  int liblustre_check_services(void *arg);
  1023. -void ptlrpc_daemonize(char *name);
  1024. -int ptlrpc_service_health_check(struct ptlrpc_service *);
  1025.  void ptlrpc_server_drop_request(struct ptlrpc_request *req);
  1026. -void ptlrpc_request_change_export(struct ptlrpc_request *req,
  1027. -                 struct obd_export *export);
  1028.  
  1029.  int ptlrpc_hr_init(void);
  1030.  void ptlrpc_hr_fini(void);
  1031. @@ -2579,7 +2550,6 @@ void ptlrpc_buf_set_swabbed(struct ptlrpc_request *req, const int inout,
  1032.  int ptlrpc_unpack_rep_msg(struct ptlrpc_request *req, int len);
  1033.  int ptlrpc_unpack_req_msg(struct ptlrpc_request *req, int len);
  1034.  
  1035. -int lustre_msg_check_version(struct lustre_msg *msg, __u32 version);
  1036.  void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens,
  1037.             char **bufs);
  1038.  int lustre_pack_request(struct ptlrpc_request *, __u32 magic, int count,
  1039. @@ -2603,7 +2573,6 @@ int lustre_msg_early_size(void);
  1040.  void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size);
  1041.  void *lustre_msg_buf(struct lustre_msg *m, int n, int minlen);
  1042.  int lustre_msg_buflen(struct lustre_msg *m, int n);
  1043. -void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len);
  1044.  int lustre_msg_bufcount(struct lustre_msg *m);
  1045.  char *lustre_msg_string(struct lustre_msg *m, int n, int max_len);
  1046.  __u32 lustre_msghdr_get_flags(struct lustre_msg *msg);
  1047. @@ -2616,10 +2585,8 @@ __u32 lustre_msg_get_op_flags(struct lustre_msg *msg);
  1048.  void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags);
  1049.  struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg);
  1050.  __u32 lustre_msg_get_type(struct lustre_msg *msg);
  1051. -__u32 lustre_msg_get_version(struct lustre_msg *msg);
  1052.  void lustre_msg_add_version(struct lustre_msg *msg, int version);
  1053.  __u32 lustre_msg_get_opc(struct lustre_msg *msg);
  1054. -__u64 lustre_msg_get_last_xid(struct lustre_msg *msg);
  1055.  __u64 lustre_msg_get_last_committed(struct lustre_msg *msg);
  1056.  __u64 *lustre_msg_get_versions(struct lustre_msg *msg);
  1057.  __u64 lustre_msg_get_transno(struct lustre_msg *msg);
  1058. @@ -2632,21 +2599,16 @@ __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg);
  1059.  __u32 lustre_msg_get_magic(struct lustre_msg *msg);
  1060.  __u32 lustre_msg_get_timeout(struct lustre_msg *msg);
  1061.  __u32 lustre_msg_get_service_time(struct lustre_msg *msg);
  1062. -char *lustre_msg_get_jobid(struct lustre_msg *msg);
  1063.  __u32 lustre_msg_get_cksum(struct lustre_msg *msg);
  1064.  __u32 lustre_msg_calc_cksum(struct lustre_msg *msg);
  1065.  void lustre_msg_set_handle(struct lustre_msg *msg,
  1066.                struct lustre_handle *handle);
  1067.  void lustre_msg_set_type(struct lustre_msg *msg, __u32 type);
  1068.  void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc);
  1069. -void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid);
  1070. -void lustre_msg_set_last_committed(struct lustre_msg *msg,
  1071. -                  __u64 last_committed);
  1072.  void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions);
  1073.  void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno);
  1074.  void lustre_msg_set_status(struct lustre_msg *msg, __u32 status);
  1075.  void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt);
  1076. -void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *sizes);
  1077.  void ptlrpc_request_set_replen(struct ptlrpc_request *req);
  1078.  void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout);
  1079.  void lustre_msg_set_service_time(struct lustre_msg *msg, __u32 service_time);
  1080. @@ -2900,8 +2862,6 @@ int ptlrpc_del_timeout_client(struct list_head *obd_list,
  1081.                   enum timeout_event event);
  1082.  struct ptlrpc_request *ptlrpc_prep_ping(struct obd_import *imp);
  1083.  int ptlrpc_obd_ping(struct obd_device *obd);
  1084. -void ping_evictor_start(void);
  1085. -void ping_evictor_stop(void);
  1086.  void ptlrpc_pinger_ir_up(void);
  1087.  void ptlrpc_pinger_ir_down(void);
  1088.  /** @} */
  1089. @@ -2912,7 +2872,6 @@ void ptlrpcd_stop(struct ptlrpcd_ctl *pc, int force);
  1090.  void ptlrpcd_free(struct ptlrpcd_ctl *pc);
  1091.  void ptlrpcd_wake(struct ptlrpc_request *req);
  1092.  void ptlrpcd_add_req(struct ptlrpc_request *req);
  1093. -void ptlrpcd_add_rqset(struct ptlrpc_request_set *set);
  1094.  int ptlrpcd_addref(void);
  1095.  void ptlrpcd_decref(void);
  1096.  
  1097. diff --git a/drivers/staging/lustre/lustre/include/lustre_param.h b/drivers/staging/lustre/lustre/include/lustre_param.h
  1098. index ed654684cb64..de49b414e912 100644
  1099. --- a/drivers/staging/lustre/lustre/include/lustre_param.h
  1100. +++ b/drivers/staging/lustre/lustre/include/lustre_param.h
  1101. @@ -56,15 +56,9 @@ struct cfg_interop_param {
  1102.  
  1103.  /* obd_config.c */
  1104.  int class_find_param(char *buf, char *key, char **valp);
  1105. -struct cfg_interop_param *class_find_old_param(const char *param,
  1106. -                          struct cfg_interop_param *ptr);
  1107. -int class_get_next_param(char **params, char *copy);
  1108.  int class_match_param(char *buf, char *key, char **valp);
  1109.  int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh);
  1110.  int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh);
  1111. -int class_parse_net(char *buf, __u32 *net, char **endh);
  1112. -int class_match_nid(char *buf, char *key, lnet_nid_t nid);
  1113. -int class_match_net(char *buf, char *key, __u32 net);
  1114.  /* obd_mount.c */
  1115.  int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
  1116.         char *s1, char *s2, char *s3, char *s4);
  1117. diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h
  1118. index c6457b27c4e7..cfcc995585c0 100644
  1119. --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h
  1120. +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h
  1121. @@ -80,8 +80,6 @@ void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req,
  1122.  void req_capsule_fini(struct req_capsule *pill);
  1123.  
  1124.  void req_capsule_set(struct req_capsule *pill, const struct req_format *fmt);
  1125. -void req_capsule_client_dump(struct req_capsule *pill);
  1126. -void req_capsule_server_dump(struct req_capsule *pill);
  1127.  void req_capsule_init_area(struct req_capsule *pill);
  1128.  int req_capsule_filled_sizes(struct req_capsule *pill, enum req_location loc);
  1129.  int  req_capsule_server_pack(struct req_capsule *pill);
  1130. @@ -105,8 +103,6 @@ void *req_capsule_server_swab_get(struct req_capsule *pill,
  1131.  void *req_capsule_server_sized_swab_get(struct req_capsule *pill,
  1132.                     const struct req_msg_field *field,
  1133.                     int len, void *swabber);
  1134. -const void *req_capsule_other_get(struct req_capsule *pill,
  1135. -                 const struct req_msg_field *field);
  1136.  
  1137.  void req_capsule_set_size(struct req_capsule *pill,
  1138.               const struct req_msg_field *field,
  1139. @@ -129,9 +125,6 @@ void req_capsule_shrink(struct req_capsule *pill,
  1140.             const struct req_msg_field *field,
  1141.             unsigned int newlen,
  1142.             enum req_location loc);
  1143. -int req_capsule_server_grow(struct req_capsule *pill,
  1144. -               const struct req_msg_field *field,
  1145. -               unsigned int newlen);
  1146.  int  req_layout_init(void);
  1147.  void req_layout_fini(void);
  1148.  
  1149. diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h
  1150. index 871185cd52b3..1d2c5724d1df 100644
  1151. --- a/drivers/staging/lustre/lustre/include/lustre_sec.h
  1152. +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
  1153. @@ -295,7 +295,6 @@ enum lustre_sec_part {
  1154.     LUSTRE_SP_ANY      = 0xFF
  1155.  };
  1156.  
  1157. -const char *sptlrpc_part2name(enum lustre_sec_part sp);
  1158.  enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd);
  1159.  
  1160.  /**
  1161. @@ -339,7 +338,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
  1162.                 enum lustre_sec_part to,
  1163.                 lnet_nid_t nid,
  1164.                 struct sptlrpc_flavor *sf);
  1165. -void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *set);
  1166.  
  1167.  int  sptlrpc_process_config(struct lustre_cfg *lcfg);
  1168.  void sptlrpc_conf_log_start(const char *logname);
  1169. @@ -347,10 +345,6 @@ void sptlrpc_conf_log_stop(const char *logname);
  1170.  void sptlrpc_conf_log_update_begin(const char *logname);
  1171.  void sptlrpc_conf_log_update_end(const char *logname);
  1172.  void sptlrpc_conf_client_adapt(struct obd_device *obd);
  1173. -void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
  1174. -                 enum lustre_sec_part from,
  1175. -                 lnet_nid_t nid,
  1176. -                 struct sptlrpc_flavor *flavor);
  1177.  
  1178.  /* The maximum length of security payload. 1024 is enough for Kerberos 5,
  1179.   * and should be enough for other future mechanisms but not sure.
  1180. @@ -1002,16 +996,12 @@ void sptlrpc_sec_put(struct ptlrpc_sec *sec);
  1181.   * internal apis which only used by policy implementation
  1182.   */
  1183.  int  sptlrpc_get_next_secid(void);
  1184. -void sptlrpc_sec_destroy(struct ptlrpc_sec *sec);
  1185.  
  1186.  /*
  1187.   * exported client context api
  1188.   */
  1189.  struct ptlrpc_cli_ctx *sptlrpc_cli_ctx_get(struct ptlrpc_cli_ctx *ctx);
  1190.  void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync);
  1191. -void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx);
  1192. -void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx);
  1193. -int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize);
  1194.  
  1195.  /*
  1196.   * exported client context wrap/buffers
  1197. @@ -1054,7 +1044,6 @@ int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule);
  1198.  /* gc */
  1199.  void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec);
  1200.  void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec);
  1201. -void sptlrpc_gc_add_ctx(struct ptlrpc_cli_ctx *ctx);
  1202.  
  1203.  /* misc */
  1204.  const char *sec2target_str(struct ptlrpc_sec *sec);
  1205. @@ -1078,25 +1067,16 @@ int  sptlrpc_svc_wrap_reply(struct ptlrpc_request *req);
  1206.  void sptlrpc_svc_free_rs(struct ptlrpc_reply_state *rs);
  1207.  void sptlrpc_svc_ctx_addref(struct ptlrpc_request *req);
  1208.  void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req);
  1209. -void sptlrpc_svc_ctx_invalidate(struct ptlrpc_request *req);
  1210.  
  1211.  int  sptlrpc_target_export_check(struct obd_export *exp,
  1212.                  struct ptlrpc_request *req);
  1213. -void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
  1214. -                     struct sptlrpc_rule_set *rset);
  1215. -
  1216.  /*
  1217.   * reverse context
  1218.   */
  1219.  int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp,
  1220.                 struct ptlrpc_svc_ctx *ctx);
  1221. -int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp,
  1222. -               struct ptlrpc_cli_ctx *ctx);
  1223.  
  1224.  /* bulk security api */
  1225. -int sptlrpc_enc_pool_add_user(void);
  1226. -int sptlrpc_enc_pool_del_user(void);
  1227. -int  sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc);
  1228.  void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc);
  1229.  
  1230.  int sptlrpc_cli_wrap_bulk(struct ptlrpc_request *req,
  1231. diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
  1232. index 57b5e1123b4f..c12edc5cd032 100644
  1233. --- a/drivers/staging/lustre/lustre/include/obd.h
  1234. +++ b/drivers/staging/lustre/lustre/include/obd.h
  1235. @@ -779,7 +779,6 @@ struct obd_device {
  1236.     struct obd_export       *obd_self_export;
  1237.     /* list of exports in LRU order, for ping evictor, with obd_dev_lock */
  1238.     struct list_head          obd_exports_timed;
  1239. -   time64_t          obd_eviction_timer; /* for ping evictor */
  1240.  
  1241.     int               obd_max_recoverable_clients;
  1242.     atomic_t             obd_connected_clients;
  1243. diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
  1244. index 7308cda6f5e6..69349eaf07ca 100644
  1245. --- a/drivers/staging/lustre/lustre/include/obd_class.h
  1246. +++ b/drivers/staging/lustre/lustre/include/obd_class.h
  1247. @@ -64,7 +64,6 @@ extern struct obd_device *obd_devs[MAX_OBD_DEVICES];
  1248.  extern rwlock_t obd_dev_lock;
  1249.  
  1250.  /* OBD Operations Declarations */
  1251. -struct obd_device *class_conn2obd(struct lustre_handle *);
  1252.  struct obd_device *class_exp2obd(struct obd_export *);
  1253.  int class_handle_ioctl(unsigned int cmd, unsigned long arg);
  1254.  int lustre_get_jobid(char *jobid);
  1255. @@ -84,15 +83,12 @@ void class_release_dev(struct obd_device *obd);
  1256.  int class_name2dev(const char *name);
  1257.  struct obd_device *class_name2obd(const char *name);
  1258.  int class_uuid2dev(struct obd_uuid *uuid);
  1259. -struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
  1260. -void class_obd_list(void);
  1261.  struct obd_device *class_find_client_obd(struct obd_uuid *tgt_uuid,
  1262.                       const char *typ_name,
  1263.                       struct obd_uuid *grp_uuid);
  1264.  struct obd_device *class_devices_in_group(struct obd_uuid *grp_uuid,
  1265.                        int *next);
  1266.  struct obd_device *class_num2obd(int num);
  1267. -int get_devices_count(void);
  1268.  
  1269.  int class_notify_sptlrpc_conf(const char *fsname, int namelen);
  1270.  
  1271. @@ -106,20 +102,12 @@ int obd_zombie_impexp_init(void);
  1272.  void obd_zombie_impexp_stop(void);
  1273.  void obd_zombie_impexp_cull(void);
  1274.  void obd_zombie_barrier(void);
  1275. -void obd_exports_barrier(struct obd_device *obd);
  1276. -int kuc_len(int payload_len);
  1277. -struct kuc_hdr *kuc_ptr(void *p);
  1278. -int kuc_ispayload(void *p);
  1279. -void *kuc_alloc(int payload_len, int transport, int type);
  1280. -void kuc_free(void *p, int payload_len);
  1281.  
  1282.  struct llog_handle;
  1283.  struct llog_rec_hdr;
  1284.  typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *,
  1285.              struct llog_rec_hdr *, void *);
  1286.  /* obd_config.c */
  1287. -struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg,
  1288. -                    const char *new_name);
  1289.  int class_process_config(struct lustre_cfg *lcfg);
  1290.  int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
  1291.                  struct lustre_cfg *lcfg, void *data);
  1292. @@ -159,9 +147,6 @@ struct config_llog_instance {
  1293.  };
  1294.  int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
  1295.                 char *name, struct config_llog_instance *cfg);
  1296. -int class_config_dump_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
  1297. -              char *name, struct config_llog_instance *cfg);
  1298. -
  1299.  enum {
  1300.     CONFIG_T_CONFIG  = 0,
  1301.     CONFIG_T_SPTLRPC = 1,
  1302. @@ -285,11 +270,8 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd,
  1303.           struct obd_uuid *cluuid);
  1304.  int class_disconnect(struct obd_export *exp);
  1305.  void class_fail_export(struct obd_export *exp);
  1306. -int class_connected_export(struct obd_export *exp);
  1307.  void class_disconnect_exports(struct obd_device *obddev);
  1308.  int class_manual_cleanup(struct obd_device *obd);
  1309. -void class_disconnect_stale_exports(struct obd_device *,
  1310. -                   int (*test_export)(struct obd_export *));
  1311.  static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
  1312.  {
  1313.     return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
  1314. @@ -301,22 +283,11 @@ static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
  1315.  struct inode;
  1316.  struct lu_attr;
  1317.  struct obdo;
  1318. -void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid);
  1319. -void la_from_obdo(struct lu_attr *la, struct obdo *dst, u32 valid);
  1320.  void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid);
  1321. -void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid);
  1322.  
  1323. -void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid);
  1324.  void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj);
  1325. -void obdo_from_iattr(struct obdo *oa, struct iattr *attr,
  1326. -            unsigned int ia_valid);
  1327.  void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid);
  1328.  void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid);
  1329. -void obdo_from_md(struct obdo *oa, struct md_op_data *op_data,
  1330. -         unsigned int valid);
  1331. -
  1332. -void obdo_cpu_to_le(struct obdo *dobdo, struct obdo *sobdo);
  1333. -void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo);
  1334.  
  1335.  #define OBT(dev)   (dev)->obd_type
  1336.  #define OBP(dev, op)    (dev)->obd_type->typ_dt_ops->o_ ## op
  1337. diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
  1338. index ac79db952da7..a78c4a4c9bd4 100644
  1339. --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
  1340. +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
  1341. @@ -71,11 +71,6 @@ struct ldlm_cb_async_args {
  1342.  
  1343.  static struct ldlm_state *ldlm_state;
  1344.  
  1345. -inline unsigned long round_timeout(unsigned long timeout)
  1346. -{
  1347. -   return cfs_time_seconds((int)cfs_duration_sec(cfs_time_sub(timeout, 0)) + 1);
  1348. -}
  1349. -
  1350.  #define ELT_STOPPED   0
  1351.  #define ELT_READY     1
  1352.  #define ELT_TERMINATE 2
  1353. diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c b/drivers/staging/lustre/lustre/obdclass/acl.c
  1354. index 933456c502d1..1dace1419530 100644
  1355. --- a/drivers/staging/lustre/lustre/obdclass/acl.c
  1356. +++ b/drivers/staging/lustre/lustre/obdclass/acl.c
  1357. @@ -287,125 +287,6 @@ again:
  1358.  }
  1359.  
  1360.  /*
  1361. - * Merge the posix ACL and the extended ACL into new posix ACL.
  1362. - */
  1363. -int lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size,
  1364. -                ext_acl_xattr_header *ext_header,
  1365. -                posix_acl_xattr_header **out)
  1366. -{
  1367. -   int posix_count, posix_size, i, j;
  1368. -   int ext_count = le32_to_cpu(ext_header->a_count), pos = 0, rc = 0;
  1369. -   posix_acl_xattr_entry pe = {ACL_MASK, 0, ACL_UNDEFINED_ID};
  1370. -   posix_acl_xattr_header *new;
  1371. -   ext_acl_xattr_entry *ee, ae;
  1372. -
  1373. -   lustre_posix_acl_cpu_to_le(&pe, &pe);
  1374. -   ee = lustre_ext_acl_xattr_search(ext_header, &pe, &pos);
  1375. -   if (ee == NULL || le32_to_cpu(ee->e_stat) == ES_DEL) {
  1376. -       /* there are only base ACL entries at most. */
  1377. -       posix_count = 3;
  1378. -       posix_size = CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr);
  1379. -       new = kzalloc(posix_size, GFP_NOFS);
  1380. -       if (unlikely(new == NULL))
  1381. -           return -ENOMEM;
  1382. -
  1383. -       new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
  1384. -       for (i = 0, j = 0; i < ext_count; i++) {
  1385. -           lustre_ext_acl_le_to_cpu(&ae,
  1386. -                        &ext_header->a_entries[i]);
  1387. -           switch (ae.e_tag) {
  1388. -           case ACL_USER_OBJ:
  1389. -           case ACL_GROUP_OBJ:
  1390. -           case ACL_OTHER:
  1391. -               if (ae.e_id != ACL_UNDEFINED_ID) {
  1392. -                   rc = -EIO;
  1393. -                   goto _out;
  1394. -               }
  1395. -
  1396. -               if (ae.e_stat != ES_DEL) {
  1397. -                   new->a_entries[j].e_tag =
  1398. -                       ext_header->a_entries[i].e_tag;
  1399. -                   new->a_entries[j].e_perm =
  1400. -                       ext_header->a_entries[i].e_perm;
  1401. -                   new->a_entries[j++].e_id =
  1402. -                       ext_header->a_entries[i].e_id;
  1403. -               }
  1404. -               break;
  1405. -           case ACL_MASK:
  1406. -           case ACL_USER:
  1407. -           case ACL_GROUP:
  1408. -               if (ae.e_stat == ES_DEL)
  1409. -                   break;
  1410. -           default:
  1411. -               rc = -EIO;
  1412. -               goto _out;
  1413. -           }
  1414. -       }
  1415. -   } else {
  1416. -       /* maybe there are valid ACL_USER or ACL_GROUP entries in the
  1417. -        * original server-side ACL, they are regarded as ES_UNC stat.*/
  1418. -       int ori_posix_count;
  1419. -
  1420. -       if (unlikely(size < 0))
  1421. -           return -EINVAL;
  1422. -       else if (!size)
  1423. -           ori_posix_count = 0;
  1424. -       else
  1425. -           ori_posix_count =
  1426. -               CFS_ACL_XATTR_COUNT(size, posix_acl_xattr);
  1427. -       posix_count = ori_posix_count + ext_count;
  1428. -       posix_size =
  1429. -           CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr);
  1430. -       new = kzalloc(posix_size, GFP_NOFS);
  1431. -       if (unlikely(new == NULL))
  1432. -           return -ENOMEM;
  1433. -
  1434. -       new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
  1435. -       /* 1. process the unchanged ACL entries
  1436. -        *    in the original server-side ACL. */
  1437. -       pos = 0;
  1438. -       for (i = 0, j = 0; i < ori_posix_count; i++) {
  1439. -           ee = lustre_ext_acl_xattr_search(ext_header,
  1440. -                   &posix_header->a_entries[i], &pos);
  1441. -           if (ee == NULL)
  1442. -               memcpy(&new->a_entries[j++],
  1443. -                      &posix_header->a_entries[i],
  1444. -                      sizeof(posix_acl_xattr_entry));
  1445. -       }
  1446. -
  1447. -       /* 2. process the non-deleted entries
  1448. -        *    from client-side extended ACL. */
  1449. -       for (i = 0; i < ext_count; i++) {
  1450. -           if (le16_to_cpu(ext_header->a_entries[i].e_stat) !=
  1451. -               ES_DEL) {
  1452. -               new->a_entries[j].e_tag =
  1453. -                       ext_header->a_entries[i].e_tag;
  1454. -               new->a_entries[j].e_perm =
  1455. -                       ext_header->a_entries[i].e_perm;
  1456. -               new->a_entries[j++].e_id =
  1457. -                       ext_header->a_entries[i].e_id;
  1458. -           }
  1459. -       }
  1460. -   }
  1461. -
  1462. -   /* free unused space. */
  1463. -   rc = lustre_posix_acl_xattr_reduce_space(&new, posix_count, j);
  1464. -   if (rc >= 0) {
  1465. -       posix_size = rc;
  1466. -       *out = new;
  1467. -       rc = 0;
  1468. -   }
  1469. -
  1470. -_out:
  1471. -   if (rc) {
  1472. -       kfree(new);
  1473. -       posix_size = rc;
  1474. -   }
  1475. -   return posix_size;
  1476. -}
  1477. -EXPORT_SYMBOL(lustre_acl_xattr_merge2posix);
  1478. -
  1479. -/*
  1480.   * Merge the posix ACL and the extended ACL into new extended ACL.
  1481.   */
  1482.  ext_acl_xattr_header *
  1483. diff --git a/drivers/staging/lustre/lustre/obdclass/capa.c b/drivers/staging/lustre/lustre/obdclass/capa.c
  1484. index 99af0176f413..1b2393a739a6 100644
  1485. --- a/drivers/staging/lustre/lustre/obdclass/capa.c
  1486. +++ b/drivers/staging/lustre/lustre/obdclass/capa.c
  1487. @@ -65,9 +65,6 @@ DEFINE_SPINLOCK(capa_lock);
  1488.  
  1489.  struct list_head capa_list[CAPA_SITE_MAX];
  1490.  
  1491. -static struct capa_hmac_alg capa_hmac_algs[] = {
  1492. -   DEF_CAPA_HMAC_ALG("sha1", SHA1, 20, 20),
  1493. -};
  1494.  /* capa count */
  1495.  int capa_count[CAPA_SITE_MAX] = { 0, };
  1496.  
  1497. @@ -76,326 +73,6 @@ EXPORT_SYMBOL(capa_list);
  1498.  EXPORT_SYMBOL(capa_lock);
  1499.  EXPORT_SYMBOL(capa_count);
  1500.  
  1501. -static inline
  1502. -unsigned int ll_crypto_tfm_alg_min_keysize(struct crypto_blkcipher *tfm)
  1503. -{
  1504. -   return crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher.min_keysize;
  1505. -}
  1506. -
  1507. -struct hlist_head *init_capa_hash(void)
  1508. -{
  1509. -   struct hlist_head *hash;
  1510. -   int nr_hash, i;
  1511. -
  1512. -   hash = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS);
  1513. -   if (!hash)
  1514. -       return NULL;
  1515. -
  1516. -   nr_hash = PAGE_CACHE_SIZE / sizeof(struct hlist_head);
  1517. -   LASSERT(nr_hash > NR_CAPAHASH);
  1518. -
  1519. -   for (i = 0; i < NR_CAPAHASH; i++)
  1520. -       INIT_HLIST_HEAD(hash + i);
  1521. -   return hash;
  1522. -}
  1523. -EXPORT_SYMBOL(init_capa_hash);
  1524. -
  1525. -static inline int capa_on_server(struct obd_capa *ocapa)
  1526. -{
  1527. -   return ocapa->c_site == CAPA_SITE_SERVER;
  1528. -}
  1529. -
  1530. -static inline void capa_delete(struct obd_capa *ocapa)
  1531. -{
  1532. -   LASSERT(capa_on_server(ocapa));
  1533. -   hlist_del_init(&ocapa->u.tgt.c_hash);
  1534. -   list_del_init(&ocapa->c_list);
  1535. -   capa_count[ocapa->c_site]--;
  1536. -   /* release the ref when alloc */
  1537. -   capa_put(ocapa);
  1538. -}
  1539. -
  1540. -void cleanup_capa_hash(struct hlist_head *hash)
  1541. -{
  1542. -   int i;
  1543. -   struct hlist_node *next;
  1544. -   struct obd_capa *oc;
  1545. -
  1546. -   spin_lock(&capa_lock);
  1547. -   for (i = 0; i < NR_CAPAHASH; i++) {
  1548. -       hlist_for_each_entry_safe(oc, next, hash + i,
  1549. -                         u.tgt.c_hash)
  1550. -           capa_delete(oc);
  1551. -   }
  1552. -   spin_unlock(&capa_lock);
  1553. -
  1554. -   kfree(hash);
  1555. -}
  1556. -EXPORT_SYMBOL(cleanup_capa_hash);
  1557. -
  1558. -static inline int capa_hashfn(struct lu_fid *fid)
  1559. -{
  1560. -   return (fid_oid(fid) ^ fid_ver(fid)) *
  1561. -          (unsigned long)(fid_seq(fid) + 1) % NR_CAPAHASH;
  1562. -}
  1563. -
  1564. -/* capa renewal time check is earlier than that on client, which is to prevent
  1565. - * client renew right after obtaining it. */
  1566. -static inline int capa_is_to_expire(struct obd_capa *oc)
  1567. -{
  1568. -   return time_before(cfs_time_sub(oc->c_expiry,
  1569. -                   cfs_time_seconds(oc->c_capa.lc_timeout)*2/3),
  1570. -              cfs_time_current());
  1571. -}
  1572. -
  1573. -static struct obd_capa *find_capa(struct lustre_capa *capa,
  1574. -                 struct hlist_head *head, int alive)
  1575. -{
  1576. -   struct obd_capa *ocapa;
  1577. -   int len = alive ? offsetof(struct lustre_capa, lc_keyid):sizeof(*capa);
  1578. -
  1579. -   hlist_for_each_entry(ocapa, head, u.tgt.c_hash) {
  1580. -       if (memcmp(&ocapa->c_capa, capa, len))
  1581. -           continue;
  1582. -       /* don't return one that will expire soon in this case */
  1583. -       if (alive && capa_is_to_expire(ocapa))
  1584. -           continue;
  1585. -
  1586. -       LASSERT(capa_on_server(ocapa));
  1587. -
  1588. -       DEBUG_CAPA(D_SEC, &ocapa->c_capa, "found");
  1589. -       return ocapa;
  1590. -   }
  1591. -
  1592. -   return NULL;
  1593. -}
  1594. -
  1595. -#define LRU_CAPA_DELETE_COUNT 12
  1596. -static inline void capa_delete_lru(struct list_head *head)
  1597. -{
  1598. -   struct obd_capa *ocapa;
  1599. -   struct list_head *node = head->next;
  1600. -   int count = 0;
  1601. -
  1602. -   /* free LRU_CAPA_DELETE_COUNT unused capa from head */
  1603. -   while (count++ < LRU_CAPA_DELETE_COUNT) {
  1604. -       ocapa = list_entry(node, struct obd_capa, c_list);
  1605. -       node = node->next;
  1606. -       if (atomic_read(&ocapa->c_refc))
  1607. -           continue;
  1608. -
  1609. -       DEBUG_CAPA(D_SEC, &ocapa->c_capa, "free lru");
  1610. -       capa_delete(ocapa);
  1611. -   }
  1612. -}
  1613. -
  1614. -/* add or update */
  1615. -struct obd_capa *capa_add(struct hlist_head *hash, struct lustre_capa *capa)
  1616. -{
  1617. -   struct hlist_head *head = hash + capa_hashfn(&capa->lc_fid);
  1618. -   struct obd_capa *ocapa, *old = NULL;
  1619. -   struct list_head *list = &capa_list[CAPA_SITE_SERVER];
  1620. -
  1621. -   ocapa = alloc_capa(CAPA_SITE_SERVER);
  1622. -   if (IS_ERR(ocapa))
  1623. -       return NULL;
  1624. -
  1625. -   spin_lock(&capa_lock);
  1626. -   old = find_capa(capa, head, 0);
  1627. -   if (!old) {
  1628. -       ocapa->c_capa = *capa;
  1629. -       set_capa_expiry(ocapa);
  1630. -       hlist_add_head(&ocapa->u.tgt.c_hash, head);
  1631. -       list_add_tail(&ocapa->c_list, list);
  1632. -       capa_get(ocapa);
  1633. -       capa_count[CAPA_SITE_SERVER]++;
  1634. -       if (capa_count[CAPA_SITE_SERVER] > CAPA_HASH_SIZE)
  1635. -           capa_delete_lru(list);
  1636. -       spin_unlock(&capa_lock);
  1637. -       return ocapa;
  1638. -   }
  1639. -   capa_get(old);
  1640. -   spin_unlock(&capa_lock);
  1641. -   capa_put(ocapa);
  1642. -   return old;
  1643. -}
  1644. -EXPORT_SYMBOL(capa_add);
  1645. -
  1646. -struct obd_capa *capa_lookup(struct hlist_head *hash, struct lustre_capa *capa,
  1647. -                int alive)
  1648. -{
  1649. -   struct obd_capa *ocapa;
  1650. -
  1651. -   spin_lock(&capa_lock);
  1652. -   ocapa = find_capa(capa, hash + capa_hashfn(&capa->lc_fid), alive);
  1653. -   if (ocapa) {
  1654. -       list_move_tail(&ocapa->c_list,
  1655. -                  &capa_list[CAPA_SITE_SERVER]);
  1656. -       capa_get(ocapa);
  1657. -   }
  1658. -   spin_unlock(&capa_lock);
  1659. -
  1660. -   return ocapa;
  1661. -}
  1662. -EXPORT_SYMBOL(capa_lookup);
  1663. -
  1664. -static inline int ll_crypto_hmac(struct crypto_hash *tfm,
  1665. -                u8 *key, unsigned int *keylen,
  1666. -                struct scatterlist *sg,
  1667. -                unsigned int size, u8 *result)
  1668. -{
  1669. -   struct hash_desc desc;
  1670. -   int       rv;
  1671. -   desc.tfm   = tfm;
  1672. -   desc.flags = 0;
  1673. -   rv = crypto_hash_setkey(desc.tfm, key, *keylen);
  1674. -   if (rv) {
  1675. -       CERROR("failed to hash setkey: %d\n", rv);
  1676. -       return rv;
  1677. -   }
  1678. -   return crypto_hash_digest(&desc, sg, size, result);
  1679. -}
  1680. -
  1681. -int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key)
  1682. -{
  1683. -   struct crypto_hash *tfm;
  1684. -   struct capa_hmac_alg  *alg;
  1685. -   int keylen;
  1686. -   struct scatterlist sl;
  1687. -
  1688. -   if (capa_alg(capa) != CAPA_HMAC_ALG_SHA1) {
  1689. -       CERROR("unknown capability hmac algorithm!\n");
  1690. -       return -EFAULT;
  1691. -   }
  1692. -
  1693. -   alg = &capa_hmac_algs[capa_alg(capa)];
  1694. -
  1695. -   tfm = crypto_alloc_hash(alg->ha_name, 0, 0);
  1696. -   if (IS_ERR(tfm)) {
  1697. -       CERROR("crypto_alloc_tfm failed, check whether your kernel has crypto support!\n");
  1698. -       return PTR_ERR(tfm);
  1699. -   }
  1700. -   keylen = alg->ha_keylen;
  1701. -
  1702. -   sg_init_table(&sl, 1);
  1703. -   sg_set_page(&sl, virt_to_page(capa),
  1704. -           offsetof(struct lustre_capa, lc_hmac),
  1705. -           (unsigned long)(capa) % PAGE_CACHE_SIZE);
  1706. -
  1707. -   ll_crypto_hmac(tfm, key, &keylen, &sl, sl.length, hmac);
  1708. -   crypto_free_hash(tfm);
  1709. -
  1710. -   return 0;
  1711. -}
  1712. -EXPORT_SYMBOL(capa_hmac);
  1713. -
  1714. -int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
  1715. -{
  1716. -   struct crypto_blkcipher *tfm;
  1717. -   struct scatterlist sd;
  1718. -   struct scatterlist ss;
  1719. -   struct blkcipher_desc desc;
  1720. -   unsigned int min;
  1721. -   int rc;
  1722. -   char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
  1723. -
  1724. -   /* passing "aes" in a variable instead of a constant string keeps gcc
  1725. -    * 4.3.2 happy */
  1726. -   tfm = crypto_alloc_blkcipher(alg, 0, 0);
  1727. -   if (IS_ERR(tfm)) {
  1728. -       CERROR("failed to load transform for aes\n");
  1729. -       return PTR_ERR(tfm);
  1730. -   }
  1731. -
  1732. -   min = ll_crypto_tfm_alg_min_keysize(tfm);
  1733. -   if (keylen < min) {
  1734. -       CERROR("keylen at least %d bits for aes\n", min * 8);
  1735. -       rc = -EINVAL;
  1736. -       goto out;
  1737. -   }
  1738. -
  1739. -   rc = crypto_blkcipher_setkey(tfm, key, min);
  1740. -   if (rc) {
  1741. -       CERROR("failed to setting key for aes\n");
  1742. -       goto out;
  1743. -   }
  1744. -
  1745. -   sg_init_table(&sd, 1);
  1746. -   sg_set_page(&sd, virt_to_page(d), 16,
  1747. -           (unsigned long)(d) % PAGE_CACHE_SIZE);
  1748. -
  1749. -   sg_init_table(&ss, 1);
  1750. -   sg_set_page(&ss, virt_to_page(s), 16,
  1751. -           (unsigned long)(s) % PAGE_CACHE_SIZE);
  1752. -   desc.tfm   = tfm;
  1753. -   desc.info  = NULL;
  1754. -   desc.flags = 0;
  1755. -   rc = crypto_blkcipher_encrypt(&desc, &sd, &ss, 16);
  1756. -   if (rc) {
  1757. -       CERROR("failed to encrypt for aes\n");
  1758. -       goto out;
  1759. -   }
  1760. -
  1761. -out:
  1762. -   crypto_free_blkcipher(tfm);
  1763. -   return rc;
  1764. -}
  1765. -EXPORT_SYMBOL(capa_encrypt_id);
  1766. -
  1767. -int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
  1768. -{
  1769. -   struct crypto_blkcipher *tfm;
  1770. -   struct scatterlist sd;
  1771. -   struct scatterlist ss;
  1772. -   struct blkcipher_desc desc;
  1773. -   unsigned int min;
  1774. -   int rc;
  1775. -   char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
  1776. -
  1777. -   /* passing "aes" in a variable instead of a constant string keeps gcc
  1778. -    * 4.3.2 happy */
  1779. -   tfm = crypto_alloc_blkcipher(alg, 0, 0);
  1780. -   if (IS_ERR(tfm)) {
  1781. -       CERROR("failed to load transform for aes\n");
  1782. -       return PTR_ERR(tfm);
  1783. -   }
  1784. -
  1785. -   min = ll_crypto_tfm_alg_min_keysize(tfm);
  1786. -   if (keylen < min) {
  1787. -       CERROR("keylen at least %d bits for aes\n", min * 8);
  1788. -       rc = -EINVAL;
  1789. -       goto out;
  1790. -   }
  1791. -
  1792. -   rc = crypto_blkcipher_setkey(tfm, key, min);
  1793. -   if (rc) {
  1794. -       CERROR("failed to setting key for aes\n");
  1795. -       goto out;
  1796. -   }
  1797. -
  1798. -   sg_init_table(&sd, 1);
  1799. -   sg_set_page(&sd, virt_to_page(d), 16,
  1800. -           (unsigned long)(d) % PAGE_CACHE_SIZE);
  1801. -
  1802. -   sg_init_table(&ss, 1);
  1803. -   sg_set_page(&ss, virt_to_page(s), 16,
  1804. -           (unsigned long)(s) % PAGE_CACHE_SIZE);
  1805. -
  1806. -   desc.tfm   = tfm;
  1807. -   desc.info  = NULL;
  1808. -   desc.flags = 0;
  1809. -   rc = crypto_blkcipher_decrypt(&desc, &sd, &ss, 16);
  1810. -   if (rc) {
  1811. -       CERROR("failed to decrypt for aes\n");
  1812. -       goto out;
  1813. -   }
  1814. -
  1815. -out:
  1816. -   crypto_free_blkcipher(tfm);
  1817. -   return rc;
  1818. -}
  1819. -EXPORT_SYMBOL(capa_decrypt_id);
  1820. -
  1821.  void capa_cpy(void *capa, struct obd_capa *ocapa)
  1822.  {
  1823.     spin_lock(&ocapa->c_lock);
  1824. diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c
  1825. index da0066a20fa0..a822a0b3464e 100644
  1826. --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c
  1827. +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c
  1828. @@ -1181,32 +1181,6 @@ void cl_page_list_fini(const struct lu_env *env, struct cl_page_list *plist)
  1829.  EXPORT_SYMBOL(cl_page_list_fini);
  1830.  
  1831.  /**
  1832. - * Owns all pages in a queue.
  1833. - */
  1834. -int cl_page_list_own(const struct lu_env *env,
  1835. -            struct cl_io *io, struct cl_page_list *plist)
  1836. -{
  1837. -   struct cl_page *page;
  1838. -   struct cl_page *temp;
  1839. -   pgoff_t index = 0;
  1840. -   int result;
  1841. -
  1842. -   LINVRNT(plist->pl_owner == current);
  1843. -
  1844. -   result = 0;
  1845. -   cl_page_list_for_each_safe(page, temp, plist) {
  1846. -       LASSERT(index <= page->cp_index);
  1847. -       index = page->cp_index;
  1848. -       if (cl_page_own(env, io, page) == 0)
  1849. -           result = result ?: page->cp_error;
  1850. -       else
  1851. -           cl_page_list_del(env, plist, page);
  1852. -   }
  1853. -   return result;
  1854. -}
  1855. -EXPORT_SYMBOL(cl_page_list_own);
  1856. -
  1857. -/**
  1858.   * Assumes all pages in a queue.
  1859.   */
  1860.  void cl_page_list_assume(const struct lu_env *env,
  1861. @@ -1236,26 +1210,6 @@ void cl_page_list_discard(const struct lu_env *env, struct cl_io *io,
  1862.  EXPORT_SYMBOL(cl_page_list_discard);
  1863.  
  1864.  /**
  1865. - * Unmaps all pages in a queue from user virtual memory.
  1866. - */
  1867. -int cl_page_list_unmap(const struct lu_env *env, struct cl_io *io,
  1868. -           struct cl_page_list *plist)
  1869. -{
  1870. -   struct cl_page *page;
  1871. -   int result;
  1872. -
  1873. -   LINVRNT(plist->pl_owner == current);
  1874. -   result = 0;
  1875. -   cl_page_list_for_each(page, plist) {
  1876. -       result = cl_page_unmap(env, io, page);
  1877. -       if (result != 0)
  1878. -           break;
  1879. -   }
  1880. -   return result;
  1881. -}
  1882. -EXPORT_SYMBOL(cl_page_list_unmap);
  1883. -
  1884. -/**
  1885.   * Initialize dual page queue.
  1886.   */
  1887.  void cl_2queue_init(struct cl_2queue *queue)
  1888. @@ -1297,17 +1251,6 @@ void cl_2queue_discard(const struct lu_env *env,
  1889.  EXPORT_SYMBOL(cl_2queue_discard);
  1890.  
  1891.  /**
  1892. - * Assume to own the pages in cl_2queue
  1893. - */
  1894. -void cl_2queue_assume(const struct lu_env *env,
  1895. -             struct cl_io *io, struct cl_2queue *queue)
  1896. -{
  1897. -   cl_page_list_assume(env, io, &queue->c2_qin);
  1898. -   cl_page_list_assume(env, io, &queue->c2_qout);
  1899. -}
  1900. -EXPORT_SYMBOL(cl_2queue_assume);
  1901. -
  1902. -/**
  1903.   * Finalize both page lists of a 2-queue.
  1904.   */
  1905.  void cl_2queue_fini(const struct lu_env *env, struct cl_2queue *queue)
  1906. @@ -1341,14 +1284,6 @@ struct cl_io *cl_io_top(struct cl_io *io)
  1907.  EXPORT_SYMBOL(cl_io_top);
  1908.  
  1909.  /**
  1910. - * Prints human readable representation of \a io to the \a f.
  1911. - */
  1912. -void cl_io_print(const struct lu_env *env, void *cookie,
  1913. -        lu_printer_t printer, const struct cl_io *io)
  1914. -{
  1915. -}
  1916. -
  1917. -/**
  1918.   * Adds request slice to the compound request.
  1919.   *
  1920.   * This is called by cl_device_operations::cdo_req_init() methods to add a
  1921. diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
  1922. index 7c6583a2e884..80cb8c928fda 100644
  1923. --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c
  1924. +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
  1925. @@ -552,6 +552,8 @@ static struct cl_lock *cl_lock_find(const struct lu_env *env,
  1926.     return lock;
  1927.  }
  1928.  
  1929. +static int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock);
  1930. +
  1931.  /**
  1932.   * Returns existing lock matching given description. This is similar to
  1933.   * cl_lock_find() except that no new lock is created, and returned lock is
  1934. @@ -920,7 +922,7 @@ EXPORT_SYMBOL(cl_lock_hold_release);
  1935.   *
  1936.   * \see cl_lock_signal()
  1937.   */
  1938. -int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock)
  1939. +static int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock)
  1940.  {
  1941.     wait_queue_t waiter;
  1942.     sigset_t blocked;
  1943. @@ -964,7 +966,6 @@ int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock)
  1944.     }
  1945.     return result;
  1946.  }
  1947. -EXPORT_SYMBOL(cl_lock_state_wait);
  1948.  
  1949.  static void cl_lock_state_signal(const struct lu_env *env, struct cl_lock *lock,
  1950.                  enum cl_lock_state state)
  1951. @@ -1276,32 +1277,6 @@ static int cl_enqueue_locked(const struct lu_env *env, struct cl_lock *lock,
  1952.  }
  1953.  
  1954.  /**
  1955. - * Enqueues a lock.
  1956. - *
  1957. - * \pre current thread or io owns a hold on lock.
  1958. - *
  1959. - * \post ergo(result == 0, lock->users increased)
  1960. - * \post ergo(result == 0, lock->cll_state == CLS_ENQUEUED ||
  1961. - *          lock->cll_state == CLS_HELD)
  1962. - */
  1963. -int cl_enqueue(const struct lu_env *env, struct cl_lock *lock,
  1964. -          struct cl_io *io, __u32 enqflags)
  1965. -{
  1966. -   int result;
  1967. -
  1968. -   cl_lock_lockdep_acquire(env, lock, enqflags);
  1969. -   cl_lock_mutex_get(env, lock);
  1970. -   result = cl_enqueue_locked(env, lock, io, enqflags);
  1971. -   cl_lock_mutex_put(env, lock);
  1972. -   if (result != 0)
  1973. -       cl_lock_lockdep_release(env, lock);
  1974. -   LASSERT(ergo(result == 0, lock->cll_state == CLS_ENQUEUED ||
  1975. -            lock->cll_state == CLS_HELD));
  1976. -   return result;
  1977. -}
  1978. -EXPORT_SYMBOL(cl_enqueue);
  1979. -
  1980. -/**
  1981.   * Tries to unlock a lock.
  1982.   *
  1983.   * This function is called to release underlying resource:
  1984. @@ -1588,6 +1563,9 @@ void cl_lock_closure_init(const struct lu_env *env,
  1985.  }
  1986.  EXPORT_SYMBOL(cl_lock_closure_init);
  1987.  
  1988. +static int cl_lock_enclosure(const struct lu_env *env, struct cl_lock *lock,
  1989. +             struct cl_lock_closure *closure);
  1990. +
  1991.  /**
  1992.   * Builds a closure of \a lock.
  1993.   *
  1994. @@ -1631,7 +1609,7 @@ EXPORT_SYMBOL(cl_lock_closure_build);
  1995.   * once). If try-lock failed, returns CLO_REPEAT, after optionally waiting
  1996.   * until next try-lock is likely to succeed.
  1997.   */
  1998. -int cl_lock_enclosure(const struct lu_env *env, struct cl_lock *lock,
  1999. +static int cl_lock_enclosure(const struct lu_env *env, struct cl_lock *lock,
  2000.               struct cl_lock_closure *closure)
  2001.  {
  2002.     int result = 0;
  2003. @@ -1669,7 +1647,6 @@ int cl_lock_enclosure(const struct lu_env *env, struct cl_lock *lock,
  2004.     }
  2005.     return result;
  2006.  }
  2007. -EXPORT_SYMBOL(cl_lock_enclosure);
  2008.  
  2009.  /** Releases mutices of enclosed locks. */
  2010.  void cl_lock_disclosure(const struct lu_env *env,
  2011. diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c
  2012. index 05e29f815b87..89ff7f1fb0fc 100644
  2013. --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
  2014. +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
  2015. @@ -98,16 +98,6 @@ int cl_object_header_init(struct cl_object_header *h)
  2016.  EXPORT_SYMBOL(cl_object_header_init);
  2017.  
  2018.  /**
  2019. - * Finalize cl_object_header.
  2020. - */
  2021. -void cl_object_header_fini(struct cl_object_header *h)
  2022. -{
  2023. -   LASSERT(list_empty(&h->coh_locks));
  2024. -   lu_object_header_fini(&h->coh_lu);
  2025. -}
  2026. -EXPORT_SYMBOL(cl_object_header_fini);
  2027. -
  2028. -/**
  2029.   * Returns a cl_object with a given \a fid.
  2030.   *
  2031.   * Returns either cached or newly created object. Additional reference on the
  2032. @@ -363,22 +353,6 @@ void cl_object_prune(const struct lu_env *env, struct cl_object *obj)
  2033.  }
  2034.  EXPORT_SYMBOL(cl_object_prune);
  2035.  
  2036. -/**
  2037. - * Check if the object has locks.
  2038. - */
  2039. -int cl_object_has_locks(struct cl_object *obj)
  2040. -{
  2041. -   struct cl_object_header *head = cl_object_header(obj);
  2042. -   int has;
  2043. -
  2044. -   spin_lock(&head->coh_lock_guard);
  2045. -   has = list_empty(&head->coh_locks);
  2046. -   spin_unlock(&head->coh_lock_guard);
  2047. -
  2048. -   return (has == 0);
  2049. -}
  2050. -EXPORT_SYMBOL(cl_object_has_locks);
  2051. -
  2052.  void cache_stats_init(struct cache_stats *cs, const char *name)
  2053.  {
  2054.     int i;
  2055. @@ -929,21 +903,6 @@ void cl_env_nested_put(struct cl_env_nest *nest, struct lu_env *env)
  2056.  EXPORT_SYMBOL(cl_env_nested_put);
  2057.  
  2058.  /**
  2059. - * Converts struct cl_attr to struct ost_lvb.
  2060. - *
  2061. - * \see cl_lvb2attr
  2062. - */
  2063. -void cl_attr2lvb(struct ost_lvb *lvb, const struct cl_attr *attr)
  2064. -{
  2065. -   lvb->lvb_size   = attr->cat_size;
  2066. -   lvb->lvb_mtime  = attr->cat_mtime;
  2067. -   lvb->lvb_atime  = attr->cat_atime;
  2068. -   lvb->lvb_ctime  = attr->cat_ctime;
  2069. -   lvb->lvb_blocks = attr->cat_blocks;
  2070. -}
  2071. -EXPORT_SYMBOL(cl_attr2lvb);
  2072. -
  2073. -/**
  2074.   * Converts struct ost_lvb to struct cl_attr.
  2075.   *
  2076.   * \see cl_attr2lvb
  2077. diff --git a/drivers/staging/lustre/lustre/obdclass/debug.c b/drivers/staging/lustre/lustre/obdclass/debug.c
  2078. index c61add46b426..43a7f7a79b35 100644
  2079. --- a/drivers/staging/lustre/lustre/obdclass/debug.c
  2080. +++ b/drivers/staging/lustre/lustre/obdclass/debug.c
  2081. @@ -46,16 +46,6 @@
  2082.  #include "../include/lustre_debug.h"
  2083.  #include "../include/lustre_net.h"
  2084.  
  2085. -void dump_lniobuf(struct niobuf_local *nb)
  2086. -{
  2087. -   CDEBUG(D_RPCTRACE,
  2088. -          "niobuf_local: file_offset=%lld, len=%d, page=%p, rc=%d\n",
  2089. -          nb->lnb_file_offset, nb->len, nb->page, nb->rc);
  2090. -   CDEBUG(D_RPCTRACE, "nb->page: index = %ld\n",
  2091. -           nb->page ? page_index(nb->page) : -1);
  2092. -}
  2093. -EXPORT_SYMBOL(dump_lniobuf);
  2094. -
  2095.  #define LPDS sizeof(__u64)
  2096.  int block_debug_setup(void *addr, int len, __u64 off, __u64 id)
  2097.  {
  2098. diff --git a/drivers/staging/lustre/lustre/obdclass/dt_object.c b/drivers/staging/lustre/lustre/obdclass/dt_object.c
  2099. index 6b645a15d7a5..a2ccf580dafc 100644
  2100. --- a/drivers/staging/lustre/lustre/obdclass/dt_object.c
  2101. +++ b/drivers/staging/lustre/lustre/obdclass/dt_object.c
  2102. @@ -49,1005 +49,4 @@
  2103.  /* fid_be_to_cpu() */
  2104.  #include "../include/lustre_fid.h"
  2105.  
  2106. -/* context key constructor/destructor: dt_global_key_init, dt_global_key_fini */
  2107. -LU_KEY_INIT(dt_global, struct dt_thread_info);
  2108. -LU_KEY_FINI(dt_global, struct dt_thread_info);
  2109.  
  2110. -struct lu_context_key dt_key = {
  2111. -   .lct_tags = LCT_MD_THREAD | LCT_DT_THREAD | LCT_MG_THREAD | LCT_LOCAL,
  2112. -   .lct_init = dt_global_key_init,
  2113. -   .lct_fini = dt_global_key_fini
  2114. -};
  2115. -EXPORT_SYMBOL(dt_key);
  2116. -
  2117. -/* no lock is necessary to protect the list, because call-backs
  2118. - * are added during system startup. Please refer to "struct dt_device".
  2119. - */
  2120. -void dt_txn_callback_add(struct dt_device *dev, struct dt_txn_callback *cb)
  2121. -{
  2122. -   list_add(&cb->dtc_linkage, &dev->dd_txn_callbacks);
  2123. -}
  2124. -EXPORT_SYMBOL(dt_txn_callback_add);
  2125. -
  2126. -void dt_txn_callback_del(struct dt_device *dev, struct dt_txn_callback *cb)
  2127. -{
  2128. -   list_del_init(&cb->dtc_linkage);
  2129. -}
  2130. -EXPORT_SYMBOL(dt_txn_callback_del);
  2131. -
  2132. -int dt_txn_hook_start(const struct lu_env *env,
  2133. -             struct dt_device *dev, struct thandle *th)
  2134. -{
  2135. -   int rc = 0;
  2136. -   struct dt_txn_callback *cb;
  2137. -
  2138. -   if (th->th_local)
  2139. -       return 0;
  2140. -
  2141. -   list_for_each_entry(cb, &dev->dd_txn_callbacks, dtc_linkage) {
  2142. -       if (cb->dtc_txn_start == NULL ||
  2143. -           !(cb->dtc_tag & env->le_ctx.lc_tags))
  2144. -           continue;
  2145. -       rc = cb->dtc_txn_start(env, th, cb->dtc_cookie);
  2146. -       if (rc < 0)
  2147. -           break;
  2148. -   }
  2149. -   return rc;
  2150. -}
  2151. -EXPORT_SYMBOL(dt_txn_hook_start);
  2152. -
  2153. -int dt_txn_hook_stop(const struct lu_env *env, struct thandle *txn)
  2154. -{
  2155. -   struct dt_device       *dev = txn->th_dev;
  2156. -   struct dt_txn_callback *cb;
  2157. -   int          rc = 0;
  2158. -
  2159. -   if (txn->th_local)
  2160. -       return 0;
  2161. -
  2162. -   list_for_each_entry(cb, &dev->dd_txn_callbacks, dtc_linkage) {
  2163. -       if (cb->dtc_txn_stop == NULL ||
  2164. -           !(cb->dtc_tag & env->le_ctx.lc_tags))
  2165. -           continue;
  2166. -       rc = cb->dtc_txn_stop(env, txn, cb->dtc_cookie);
  2167. -       if (rc < 0)
  2168. -           break;
  2169. -   }
  2170. -   return rc;
  2171. -}
  2172. -EXPORT_SYMBOL(dt_txn_hook_stop);
  2173. -
  2174. -void dt_txn_hook_commit(struct thandle *txn)
  2175. -{
  2176. -   struct dt_txn_callback *cb;
  2177. -
  2178. -   if (txn->th_local)
  2179. -       return;
  2180. -
  2181. -   list_for_each_entry(cb, &txn->th_dev->dd_txn_callbacks,
  2182. -               dtc_linkage) {
  2183. -       if (cb->dtc_txn_commit)
  2184. -           cb->dtc_txn_commit(txn, cb->dtc_cookie);
  2185. -   }
  2186. -}
  2187. -EXPORT_SYMBOL(dt_txn_hook_commit);
  2188. -
  2189. -int dt_device_init(struct dt_device *dev, struct lu_device_type *t)
  2190. -{
  2191. -
  2192. -   INIT_LIST_HEAD(&dev->dd_txn_callbacks);
  2193. -   return lu_device_init(&dev->dd_lu_dev, t);
  2194. -}
  2195. -EXPORT_SYMBOL(dt_device_init);
  2196. -
  2197. -void dt_device_fini(struct dt_device *dev)
  2198. -{
  2199. -   lu_device_fini(&dev->dd_lu_dev);
  2200. -}
  2201. -EXPORT_SYMBOL(dt_device_fini);
  2202. -
  2203. -int dt_object_init(struct dt_object *obj,
  2204. -          struct lu_object_header *h, struct lu_device *d)
  2205. -
  2206. -{
  2207. -   return lu_object_init(&obj->do_lu, h, d);
  2208. -}
  2209. -EXPORT_SYMBOL(dt_object_init);
  2210. -
  2211. -void dt_object_fini(struct dt_object *obj)
  2212. -{
  2213. -   lu_object_fini(&obj->do_lu);
  2214. -}
  2215. -EXPORT_SYMBOL(dt_object_fini);
  2216. -
  2217. -int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj)
  2218. -{
  2219. -   if (obj->do_index_ops == NULL)
  2220. -       obj->do_ops->do_index_try(env, obj, &dt_directory_features);
  2221. -   return obj->do_index_ops != NULL;
  2222. -}
  2223. -EXPORT_SYMBOL(dt_try_as_dir);
  2224. -
  2225. -enum dt_format_type dt_mode_to_dft(__u32 mode)
  2226. -{
  2227. -   enum dt_format_type result;
  2228. -
  2229. -   switch (mode & S_IFMT) {
  2230. -   case S_IFDIR:
  2231. -       result = DFT_DIR;
  2232. -       break;
  2233. -   case S_IFREG:
  2234. -       result = DFT_REGULAR;
  2235. -       break;
  2236. -   case S_IFLNK:
  2237. -       result = DFT_SYM;
  2238. -       break;
  2239. -   case S_IFCHR:
  2240. -   case S_IFBLK:
  2241. -   case S_IFIFO:
  2242. -   case S_IFSOCK:
  2243. -       result = DFT_NODE;
  2244. -       break;
  2245. -   default:
  2246. -       LBUG();
  2247. -       break;
  2248. -   }
  2249. -   return result;
  2250. -}
  2251. -EXPORT_SYMBOL(dt_mode_to_dft);
  2252. -
  2253. -/**
  2254. - * lookup fid for object named \a name in directory \a dir.
  2255. - */
  2256. -
  2257. -int dt_lookup_dir(const struct lu_env *env, struct dt_object *dir,
  2258. -         const char *name, struct lu_fid *fid)
  2259. -{
  2260. -   if (dt_try_as_dir(env, dir))
  2261. -       return dt_lookup(env, dir, (struct dt_rec *)fid,
  2262. -                (const struct dt_key *)name, BYPASS_CAPA);
  2263. -   return -ENOTDIR;
  2264. -}
  2265. -EXPORT_SYMBOL(dt_lookup_dir);
  2266. -
  2267. -/* this differs from dt_locate by top_dev as parameter
  2268. - * but not one from lu_site */
  2269. -struct dt_object *dt_locate_at(const struct lu_env *env,
  2270. -                  struct dt_device *dev, const struct lu_fid *fid,
  2271. -                  struct lu_device *top_dev)
  2272. -{
  2273. -   struct lu_object *lo, *n;
  2274. -
  2275. -   lo = lu_object_find_at(env, top_dev, fid, NULL);
  2276. -   if (IS_ERR(lo))
  2277. -       return (void *)lo;
  2278. -
  2279. -   LASSERT(lo != NULL);
  2280. -
  2281. -   list_for_each_entry(n, &lo->lo_header->loh_layers, lo_linkage) {
  2282. -       if (n->lo_dev == &dev->dd_lu_dev)
  2283. -           return container_of0(n, struct dt_object, do_lu);
  2284. -   }
  2285. -   return ERR_PTR(-ENOENT);
  2286. -}
  2287. -EXPORT_SYMBOL(dt_locate_at);
  2288. -
  2289. -/**
  2290. - * find a object named \a entry in given \a dfh->dfh_o directory.
  2291. - */
  2292. -static int dt_find_entry(const struct lu_env *env,
  2293. -            const char *entry, void *data)
  2294. -{
  2295. -   struct dt_find_hint  *dfh = data;
  2296. -   struct dt_device     *dt = dfh->dfh_dt;
  2297. -   struct lu_fid   *fid = dfh->dfh_fid;
  2298. -   struct dt_object     *obj = dfh->dfh_o;
  2299. -   int        result;
  2300. -
  2301. -   result = dt_lookup_dir(env, obj, entry, fid);
  2302. -   lu_object_put(env, &obj->do_lu);
  2303. -   if (result == 0) {
  2304. -       obj = dt_locate(env, dt, fid);
  2305. -       if (IS_ERR(obj))
  2306. -           result = PTR_ERR(obj);
  2307. -   }
  2308. -   dfh->dfh_o = obj;
  2309. -   return result;
  2310. -}
  2311. -
  2312. -/**
  2313. - * Abstract function which parses path name. This function feeds
  2314. - * path component to \a entry_func.
  2315. - */
  2316. -int dt_path_parser(const struct lu_env *env,
  2317. -          char *path, dt_entry_func_t entry_func,
  2318. -          void *data)
  2319. -{
  2320. -   char *e;
  2321. -   int rc = 0;
  2322. -
  2323. -   while (1) {
  2324. -       e = strsep(&path, "/");
  2325. -       if (e == NULL)
  2326. -           break;
  2327. -
  2328. -       if (e[0] == 0) {
  2329. -           if (!path || path[0] == '\0')
  2330. -               break;
  2331. -           continue;
  2332. -       }
  2333. -       rc = entry_func(env, e, data);
  2334. -       if (rc)
  2335. -           break;
  2336. -   }
  2337. -
  2338. -   return rc;
  2339. -}
  2340. -
  2341. -struct dt_object *
  2342. -dt_store_resolve(const struct lu_env *env, struct dt_device *dt,
  2343. -        const char *path, struct lu_fid *fid)
  2344. -{
  2345. -   struct dt_thread_info *info = dt_info(env);
  2346. -   struct dt_find_hint   *dfh = &info->dti_dfh;
  2347. -   struct dt_object      *obj;
  2348. -   char              *local = info->dti_buf;
  2349. -   int            result;
  2350. -
  2351. -
  2352. -   dfh->dfh_dt = dt;
  2353. -   dfh->dfh_fid = fid;
  2354. -
  2355. -   strncpy(local, path, DT_MAX_PATH);
  2356. -   local[DT_MAX_PATH - 1] = '\0';
  2357. -
  2358. -   result = dt->dd_ops->dt_root_get(env, dt, fid);
  2359. -   if (result == 0) {
  2360. -       obj = dt_locate(env, dt, fid);
  2361. -       if (!IS_ERR(obj)) {
  2362. -           dfh->dfh_o = obj;
  2363. -           result = dt_path_parser(env, local, dt_find_entry, dfh);
  2364. -           if (result != 0)
  2365. -               obj = ERR_PTR(result);
  2366. -           else
  2367. -               obj = dfh->dfh_o;
  2368. -       }
  2369. -   } else {
  2370. -       obj = ERR_PTR(result);
  2371. -   }
  2372. -   return obj;
  2373. -}
  2374. -EXPORT_SYMBOL(dt_store_resolve);
  2375. -
  2376. -static struct dt_object *dt_reg_open(const struct lu_env *env,
  2377. -                    struct dt_device *dt,
  2378. -                    struct dt_object *p,
  2379. -                    const char *name,
  2380. -                    struct lu_fid *fid)
  2381. -{
  2382. -   struct dt_object *o;
  2383. -   int result;
  2384. -
  2385. -   result = dt_lookup_dir(env, p, name, fid);
  2386. -   if (result == 0)
  2387. -       o = dt_locate(env, dt, fid);
  2388. -   else
  2389. -       o = ERR_PTR(result);
  2390. -
  2391. -   return o;
  2392. -}
  2393. -
  2394. -/**
  2395. - * Open dt object named \a filename from \a dirname directory.
  2396. - *      \param  dt      dt device
  2397. - *      \param  fid     on success, object fid is stored in *fid
  2398. - */
  2399. -struct dt_object *dt_store_open(const struct lu_env *env,
  2400. -               struct dt_device *dt,
  2401. -               const char *dirname,
  2402. -               const char *filename,
  2403. -               struct lu_fid *fid)
  2404. -{
  2405. -   struct dt_object *file;
  2406. -   struct dt_object *dir;
  2407. -
  2408. -   dir = dt_store_resolve(env, dt, dirname, fid);
  2409. -   if (!IS_ERR(dir)) {
  2410. -       file = dt_reg_open(env, dt, dir,
  2411. -                  filename, fid);
  2412. -       lu_object_put(env, &dir->do_lu);
  2413. -   } else {
  2414. -       file = dir;
  2415. -   }
  2416. -   return file;
  2417. -}
  2418. -EXPORT_SYMBOL(dt_store_open);
  2419. -
  2420. -struct dt_object *dt_find_or_create(const struct lu_env *env,
  2421. -                   struct dt_device *dt,
  2422. -                   const struct lu_fid *fid,
  2423. -                   struct dt_object_format *dof,
  2424. -                   struct lu_attr *at)
  2425. -{
  2426. -   struct dt_object *dto;
  2427. -   struct thandle *th;
  2428. -   int rc;
  2429. -
  2430. -   dto = dt_locate(env, dt, fid);
  2431. -   if (IS_ERR(dto))
  2432. -       return dto;
  2433. -
  2434. -   LASSERT(dto != NULL);
  2435. -   if (dt_object_exists(dto))
  2436. -       return dto;
  2437. -
  2438. -   th = dt_trans_create(env, dt);
  2439. -   if (IS_ERR(th)) {
  2440. -       rc = PTR_ERR(th);
  2441. -       goto out;
  2442. -   }
  2443. -
  2444. -   rc = dt_declare_create(env, dto, at, NULL, dof, th);
  2445. -   if (rc)
  2446. -       goto trans_stop;
  2447. -
  2448. -   rc = dt_trans_start_local(env, dt, th);
  2449. -   if (rc)
  2450. -       goto trans_stop;
  2451. -
  2452. -   dt_write_lock(env, dto, 0);
  2453. -   if (dt_object_exists(dto)) {
  2454. -       rc = 0;
  2455. -       goto unlock;
  2456. -   }
  2457. -
  2458. -   CDEBUG(D_OTHER, "create new object "DFID"\n", PFID(fid));
  2459. -
  2460. -   rc = dt_create(env, dto, at, NULL, dof, th);
  2461. -   if (rc)
  2462. -       goto unlock;
  2463. -   LASSERT(dt_object_exists(dto));
  2464. -unlock:
  2465. -   dt_write_unlock(env, dto);
  2466. -trans_stop:
  2467. -   dt_trans_stop(env, dt, th);
  2468. -out:
  2469. -   if (rc) {
  2470. -       lu_object_put(env, &dto->do_lu);
  2471. -       return ERR_PTR(rc);
  2472. -   }
  2473. -   return dto;
  2474. -}
  2475. -EXPORT_SYMBOL(dt_find_or_create);
  2476. -
  2477. -/* dt class init function. */
  2478. -int dt_global_init(void)
  2479. -{
  2480. -   LU_CONTEXT_KEY_INIT(&dt_key);
  2481. -   return lu_context_key_register(&dt_key);
  2482. -}
  2483. -
  2484. -void dt_global_fini(void)
  2485. -{
  2486. -   lu_context_key_degister(&dt_key);
  2487. -}
  2488. -
  2489. -/**
  2490. - * Generic read helper. May return an error for partial reads.
  2491. - *
  2492. - * \param env  lustre environment
  2493. - * \param dt   object to be read
  2494. - * \param buf  lu_buf to be filled, with buffer pointer and length
  2495. - * \param pos position to start reading, updated as data is read
  2496. - *
  2497. - * \retval real size of data read
  2498. - * \retval -ve errno on failure
  2499. - */
  2500. -int dt_read(const struct lu_env *env, struct dt_object *dt,
  2501. -       struct lu_buf *buf, loff_t *pos)
  2502. -{
  2503. -   LASSERTF(dt != NULL, "dt is NULL when we want to read record\n");
  2504. -   return dt->do_body_ops->dbo_read(env, dt, buf, pos, BYPASS_CAPA);
  2505. -}
  2506. -EXPORT_SYMBOL(dt_read);
  2507. -
  2508. -/**
  2509. - * Read structures of fixed size from storage.  Unlike dt_read(), using
  2510. - * dt_record_read() will return an error for partial reads.
  2511. - *
  2512. - * \param env  lustre environment
  2513. - * \param dt   object to be read
  2514. - * \param buf  lu_buf to be filled, with buffer pointer and length
  2515. - * \param pos position to start reading, updated as data is read
  2516. - *
  2517. - * \retval 0 on successfully reading full buffer
  2518. - * \retval -EFAULT on short read
  2519. - * \retval -ve errno on failure
  2520. - */
  2521. -int dt_record_read(const struct lu_env *env, struct dt_object *dt,
  2522. -          struct lu_buf *buf, loff_t *pos)
  2523. -{
  2524. -   int rc;
  2525. -
  2526. -   LASSERTF(dt != NULL, "dt is NULL when we want to read record\n");
  2527. -
  2528. -   rc = dt->do_body_ops->dbo_read(env, dt, buf, pos, BYPASS_CAPA);
  2529. -
  2530. -   if (rc == buf->lb_len)
  2531. -       rc = 0;
  2532. -   else if (rc >= 0)
  2533. -       rc = -EFAULT;
  2534. -   return rc;
  2535. -}
  2536. -EXPORT_SYMBOL(dt_record_read);
  2537. -
  2538. -int dt_record_write(const struct lu_env *env, struct dt_object *dt,
  2539. -           const struct lu_buf *buf, loff_t *pos, struct thandle *th)
  2540. -{
  2541. -   int rc;
  2542. -
  2543. -   LASSERTF(dt != NULL, "dt is NULL when we want to write record\n");
  2544. -   LASSERT(th != NULL);
  2545. -   LASSERT(dt->do_body_ops);
  2546. -   LASSERT(dt->do_body_ops->dbo_write);
  2547. -   rc = dt->do_body_ops->dbo_write(env, dt, buf, pos, th, BYPASS_CAPA, 1);
  2548. -   if (rc == buf->lb_len)
  2549. -       rc = 0;
  2550. -   else if (rc >= 0)
  2551. -       rc = -EFAULT;
  2552. -   return rc;
  2553. -}
  2554. -EXPORT_SYMBOL(dt_record_write);
  2555. -
  2556. -int dt_declare_version_set(const struct lu_env *env, struct dt_object *o,
  2557. -              struct thandle *th)
  2558. -{
  2559. -   struct lu_buf vbuf;
  2560. -   char *xname = XATTR_NAME_VERSION;
  2561. -
  2562. -   LASSERT(o);
  2563. -   vbuf.lb_buf = NULL;
  2564. -   vbuf.lb_len = sizeof(dt_obj_version_t);
  2565. -   return dt_declare_xattr_set(env, o, &vbuf, xname, 0, th);
  2566. -
  2567. -}
  2568. -EXPORT_SYMBOL(dt_declare_version_set);
  2569. -
  2570. -void dt_version_set(const struct lu_env *env, struct dt_object *o,
  2571. -           dt_obj_version_t version, struct thandle *th)
  2572. -{
  2573. -   struct lu_buf vbuf;
  2574. -   char *xname = XATTR_NAME_VERSION;
  2575. -   int rc;
  2576. -
  2577. -   LASSERT(o);
  2578. -   vbuf.lb_buf = &version;
  2579. -   vbuf.lb_len = sizeof(version);
  2580. -
  2581. -   rc = dt_xattr_set(env, o, &vbuf, xname, 0, th, BYPASS_CAPA);
  2582. -   if (rc < 0)
  2583. -       CDEBUG(D_INODE, "Can't set version, rc %d\n", rc);
  2584. -   return;
  2585. -}
  2586. -EXPORT_SYMBOL(dt_version_set);
  2587. -
  2588. -dt_obj_version_t dt_version_get(const struct lu_env *env, struct dt_object *o)
  2589. -{
  2590. -   struct lu_buf vbuf;
  2591. -   char *xname = XATTR_NAME_VERSION;
  2592. -   dt_obj_version_t version;
  2593. -   int rc;
  2594. -
  2595. -   LASSERT(o);
  2596. -   vbuf.lb_buf = &version;
  2597. -   vbuf.lb_len = sizeof(version);
  2598. -   rc = dt_xattr_get(env, o, &vbuf, xname, BYPASS_CAPA);
  2599. -   if (rc != sizeof(version)) {
  2600. -       CDEBUG(D_INODE, "Can't get version, rc %d\n", rc);
  2601. -       version = 0;
  2602. -   }
  2603. -   return version;
  2604. -}
  2605. -EXPORT_SYMBOL(dt_version_get);
  2606. -
  2607. -/* list of all supported index types */
  2608. -
  2609. -/* directories */
  2610. -const struct dt_index_features dt_directory_features;
  2611. -EXPORT_SYMBOL(dt_directory_features);
  2612. -
  2613. -/* scrub iterator */
  2614. -const struct dt_index_features dt_otable_features;
  2615. -EXPORT_SYMBOL(dt_otable_features);
  2616. -
  2617. -/* lfsck */
  2618. -const struct dt_index_features dt_lfsck_features = {
  2619. -   .dif_flags      = DT_IND_UPDATE,
  2620. -   .dif_keysize_min    = sizeof(struct lu_fid),
  2621. -   .dif_keysize_max    = sizeof(struct lu_fid),
  2622. -   .dif_recsize_min    = sizeof(__u8),
  2623. -   .dif_recsize_max    = sizeof(__u8),
  2624. -   .dif_ptrsize        = 4
  2625. -};
  2626. -EXPORT_SYMBOL(dt_lfsck_features);
  2627. -
  2628. -/* accounting indexes */
  2629. -const struct dt_index_features dt_acct_features = {
  2630. -   .dif_flags      = DT_IND_UPDATE,
  2631. -   .dif_keysize_min    = sizeof(__u64), /* 64-bit uid/gid */
  2632. -   .dif_keysize_max    = sizeof(__u64), /* 64-bit uid/gid */
  2633. -   .dif_recsize_min    = sizeof(struct lquota_acct_rec), /* 16 bytes */
  2634. -   .dif_recsize_max    = sizeof(struct lquota_acct_rec), /* 16 bytes */
  2635. -   .dif_ptrsize        = 4
  2636. -};
  2637. -EXPORT_SYMBOL(dt_acct_features);
  2638. -
  2639. -/* global quota files */
  2640. -const struct dt_index_features dt_quota_glb_features = {
  2641. -   .dif_flags      = DT_IND_UPDATE,
  2642. -   /* a different key would have to be used for per-directory quota */
  2643. -   .dif_keysize_min    = sizeof(__u64), /* 64-bit uid/gid */
  2644. -   .dif_keysize_max    = sizeof(__u64), /* 64-bit uid/gid */
  2645. -   .dif_recsize_min    = sizeof(struct lquota_glb_rec), /* 32 bytes */
  2646. -   .dif_recsize_max    = sizeof(struct lquota_glb_rec), /* 32 bytes */
  2647. -   .dif_ptrsize        = 4
  2648. -};
  2649. -EXPORT_SYMBOL(dt_quota_glb_features);
  2650. -
  2651. -/* slave quota files */
  2652. -const struct dt_index_features dt_quota_slv_features = {
  2653. -   .dif_flags      = DT_IND_UPDATE,
  2654. -   /* a different key would have to be used for per-directory quota */
  2655. -   .dif_keysize_min    = sizeof(__u64), /* 64-bit uid/gid */
  2656. -   .dif_keysize_max    = sizeof(__u64), /* 64-bit uid/gid */
  2657. -   .dif_recsize_min    = sizeof(struct lquota_slv_rec), /* 8 bytes */
  2658. -   .dif_recsize_max    = sizeof(struct lquota_slv_rec), /* 8 bytes */
  2659. -   .dif_ptrsize        = 4
  2660. -};
  2661. -EXPORT_SYMBOL(dt_quota_slv_features);
  2662. -
  2663. -/* helper function returning what dt_index_features structure should be used
  2664. - * based on the FID sequence. This is used by OBD_IDX_READ RPC */
  2665. -static inline const struct dt_index_features *dt_index_feat_select(__u64 seq,
  2666. -                                  __u32 mode)
  2667. -{
  2668. -   if (seq == FID_SEQ_QUOTA_GLB) {
  2669. -       /* global quota index */
  2670. -       if (!S_ISREG(mode))
  2671. -           /* global quota index should be a regular file */
  2672. -           return ERR_PTR(-ENOENT);
  2673. -       return &dt_quota_glb_features;
  2674. -   } else if (seq == FID_SEQ_QUOTA) {
  2675. -       /* quota slave index */
  2676. -       if (!S_ISREG(mode))
  2677. -           /* slave index should be a regular file */
  2678. -           return ERR_PTR(-ENOENT);
  2679. -       return &dt_quota_slv_features;
  2680. -   } else if (seq >= FID_SEQ_NORMAL) {
  2681. -       /* object is part of the namespace, verify that it is a
  2682. -        * directory */
  2683. -       if (!S_ISDIR(mode))
  2684. -           /* sorry, we can only deal with directory */
  2685. -           return ERR_PTR(-ENOTDIR);
  2686. -       return &dt_directory_features;
  2687. -   }
  2688. -
  2689. -   return ERR_PTR(-EOPNOTSUPP);
  2690. -}
  2691. -
  2692. -/*
  2693. - * Fill a lu_idxpage with key/record pairs read for transfer via OBD_IDX_READ
  2694. - * RPC
  2695. - *
  2696. - * \param env - is the environment passed by the caller
  2697. - * \param lp  - is a pointer to the lu_page to fill
  2698. - * \param nob - is the maximum number of bytes that should be copied
  2699. - * \param iops - is the index operation vector associated with the index object
  2700. - * \param it   - is a pointer to the current iterator
  2701. - * \param attr - is the index attribute to pass to iops->rec()
  2702. - * \param arg  - is a pointer to the idx_info structure
  2703. - */
  2704. -static int dt_index_page_build(const struct lu_env *env, union lu_page *lp,
  2705. -                  int nob, const struct dt_it_ops *iops,
  2706. -                  struct dt_it *it, __u32 attr, void *arg)
  2707. -{
  2708. -   struct idx_info     *ii = (struct idx_info *)arg;
  2709. -   struct lu_idxpage   *lip = &lp->lp_idx;
  2710. -   char            *entry;
  2711. -   int          rc, size;
  2712. -
  2713. -   /* no support for variable key & record size for now */
  2714. -   LASSERT((ii->ii_flags & II_FL_VARKEY) == 0);
  2715. -   LASSERT((ii->ii_flags & II_FL_VARREC) == 0);
  2716. -
  2717. -   /* initialize the header of the new container */
  2718. -   memset(lip, 0, LIP_HDR_SIZE);
  2719. -   lip->lip_magic = LIP_MAGIC;
  2720. -   nob    -= LIP_HDR_SIZE;
  2721. -
  2722. -   /* compute size needed to store a key/record pair */
  2723. -   size = ii->ii_recsize + ii->ii_keysize;
  2724. -   if ((ii->ii_flags & II_FL_NOHASH) == 0)
  2725. -       /* add hash if the client wants it */
  2726. -       size += sizeof(__u64);
  2727. -
  2728. -   entry = lip->lip_entries;
  2729. -   do {
  2730. -       char        *tmp_entry = entry;
  2731. -       struct dt_key   *key;
  2732. -       __u64        hash;
  2733. -
  2734. -       /* fetch 64-bit hash value */
  2735. -       hash = iops->store(env, it);
  2736. -       ii->ii_hash_end = hash;
  2737. -
  2738. -       if (OBD_FAIL_CHECK(OBD_FAIL_OBD_IDX_READ_BREAK)) {
  2739. -           if (lip->lip_nr != 0) {
  2740. -               rc = 0;
  2741. -               goto out;
  2742. -           }
  2743. -       }
  2744. -
  2745. -       if (nob < size) {
  2746. -           if (lip->lip_nr == 0)
  2747. -               rc = -EINVAL;
  2748. -           else
  2749. -               rc = 0;
  2750. -           goto out;
  2751. -       }
  2752. -
  2753. -       if ((ii->ii_flags & II_FL_NOHASH) == 0) {
  2754. -           /* client wants to the 64-bit hash value associated with
  2755. -            * each record */
  2756. -           memcpy(tmp_entry, &hash, sizeof(hash));
  2757. -           tmp_entry += sizeof(hash);
  2758. -       }
  2759. -
  2760. -       /* then the key value */
  2761. -       LASSERT(iops->key_size(env, it) == ii->ii_keysize);
  2762. -       key = iops->key(env, it);
  2763. -       memcpy(tmp_entry, key, ii->ii_keysize);
  2764. -       tmp_entry += ii->ii_keysize;
  2765. -
  2766. -       /* and finally the record */
  2767. -       rc = iops->rec(env, it, (struct dt_rec *)tmp_entry, attr);
  2768. -       if (rc != -ESTALE) {
  2769. -           if (rc != 0)
  2770. -               goto out;
  2771. -
  2772. -           /* hash/key/record successfully copied! */
  2773. -           lip->lip_nr++;
  2774. -           if (unlikely(lip->lip_nr == 1 && ii->ii_count == 0))
  2775. -               ii->ii_hash_start = hash;
  2776. -           entry = tmp_entry + ii->ii_recsize;
  2777. -           nob -= size;
  2778. -       }
  2779. -
  2780. -       /* move on to the next record */
  2781. -       do {
  2782. -           rc = iops->next(env, it);
  2783. -       } while (rc == -ESTALE);
  2784. -
  2785. -   } while (rc == 0);
  2786. -
  2787. -   goto out;
  2788. -out:
  2789. -   if (rc >= 0 && lip->lip_nr > 0)
  2790. -       /* one more container */
  2791. -       ii->ii_count++;
  2792. -   if (rc > 0)
  2793. -       /* no more entries */
  2794. -       ii->ii_hash_end = II_END_OFF;
  2795. -   return rc;
  2796. -}
  2797. -
  2798. -/*
  2799. - * Walk index and fill lu_page containers with key/record pairs
  2800. - *
  2801. - * \param env - is the environment passed by the caller
  2802. - * \param obj - is the index object to parse
  2803. - * \param rdpg - is the lu_rdpg descriptor associated with the transfer
  2804. - * \param filler - is the callback function responsible for filling a lu_page
  2805. - *      with key/record pairs in the format wanted by the caller
  2806. - * \param arg    - is an opaq argument passed to the filler function
  2807. - *
  2808. - * \retval sum (in bytes) of all filled lu_pages
  2809. - * \retval -ve errno on failure
  2810. - */
  2811. -int dt_index_walk(const struct lu_env *env, struct dt_object *obj,
  2812. -         const struct lu_rdpg *rdpg, dt_index_page_build_t filler,
  2813. -         void *arg)
  2814. -{
  2815. -   struct dt_it        *it;
  2816. -   const struct dt_it_ops  *iops;
  2817. -   unsigned int         pageidx, nob, nlupgs = 0;
  2818. -   int          rc;
  2819. -
  2820. -   LASSERT(rdpg->rp_pages != NULL);
  2821. -   LASSERT(obj->do_index_ops != NULL);
  2822. -
  2823. -   nob = rdpg->rp_count;
  2824. -   if (nob <= 0)
  2825. -       return -EFAULT;
  2826. -
  2827. -   /* Iterate through index and fill containers from @rdpg */
  2828. -   iops = &obj->do_index_ops->dio_it;
  2829. -   LASSERT(iops != NULL);
  2830. -   it = iops->init(env, obj, rdpg->rp_attrs, BYPASS_CAPA);
  2831. -   if (IS_ERR(it))
  2832. -       return PTR_ERR(it);
  2833. -
  2834. -   rc = iops->load(env, it, rdpg->rp_hash);
  2835. -   if (rc == 0)
  2836. -       /*
  2837. -        * Iterator didn't find record with exactly the key requested.
  2838. -        *
  2839. -        * It is currently either
  2840. -        *
  2841. -        *     - positioned above record with key less than
  2842. -        *     requested---skip it.
  2843. -        *     - or not positioned at all (is in IAM_IT_SKEWED
  2844. -        *     state)---position it on the next item.
  2845. -        */
  2846. -       rc = iops->next(env, it);
  2847. -   else if (rc > 0)
  2848. -       rc = 0;
  2849. -
  2850. -   /* Fill containers one after the other. There might be multiple
  2851. -    * containers per physical page.
  2852. -    *
  2853. -    * At this point and across for-loop:
  2854. -    *  rc == 0 -> ok, proceed.
  2855. -    *  rc >  0 -> end of index.
  2856. -    *  rc <  0 -> error. */
  2857. -   for (pageidx = 0; rc == 0 && nob > 0; pageidx++) {
  2858. -       union lu_page   *lp;
  2859. -       int      i;
  2860. -
  2861. -       LASSERT(pageidx < rdpg->rp_npages);
  2862. -       lp = kmap(rdpg->rp_pages[pageidx]);
  2863. -
  2864. -       /* fill lu pages */
  2865. -       for (i = 0; i < LU_PAGE_COUNT; i++, lp++, nob -= LU_PAGE_SIZE) {
  2866. -           rc = filler(env, lp, min_t(int, nob, LU_PAGE_SIZE),
  2867. -                   iops, it, rdpg->rp_attrs, arg);
  2868. -           if (rc < 0)
  2869. -               break;
  2870. -           /* one more lu_page */
  2871. -           nlupgs++;
  2872. -           if (rc > 0)
  2873. -               /* end of index */
  2874. -               break;
  2875. -       }
  2876. -       kunmap(rdpg->rp_pages[i]);
  2877. -   }
  2878. -
  2879. -   iops->put(env, it);
  2880. -   iops->fini(env, it);
  2881. -
  2882. -   if (rc >= 0)
  2883. -       rc = min_t(unsigned int, nlupgs * LU_PAGE_SIZE, rdpg->rp_count);
  2884. -
  2885. -   return rc;
  2886. -}
  2887. -EXPORT_SYMBOL(dt_index_walk);
  2888. -
  2889. -/**
  2890. - * Walk key/record pairs of an index and copy them into 4KB containers to be
  2891. - * transferred over the network. This is the common handler for OBD_IDX_READ
  2892. - * RPC processing.
  2893. - *
  2894. - * \param env - is the environment passed by the caller
  2895. - * \param dev - is the dt_device storing the index
  2896. - * \param ii  - is the idx_info structure packed by the client in the
  2897. - *       OBD_IDX_READ request
  2898. - * \param rdpg - is the lu_rdpg descriptor
  2899. - *
  2900. - * \retval on success, return sum (in bytes) of all filled containers
  2901. - * \retval appropriate error otherwise.
  2902. - */
  2903. -int dt_index_read(const struct lu_env *env, struct dt_device *dev,
  2904. -         struct idx_info *ii, const struct lu_rdpg *rdpg)
  2905. -{
  2906. -   const struct dt_index_features  *feat;
  2907. -   struct dt_object        *obj;
  2908. -   int              rc;
  2909. -
  2910. -   /* rp_count shouldn't be null and should be a multiple of the container
  2911. -    * size */
  2912. -   if (rdpg->rp_count <= 0 && (rdpg->rp_count & (LU_PAGE_SIZE - 1)) != 0)
  2913. -       return -EFAULT;
  2914. -
  2915. -   if (fid_seq(&ii->ii_fid) >= FID_SEQ_NORMAL)
  2916. -       /* we don't support directory transfer via OBD_IDX_READ for the
  2917. -        * time being */
  2918. -       return -EOPNOTSUPP;
  2919. -
  2920. -   if (!fid_is_quota(&ii->ii_fid))
  2921. -       /* block access to all local files except quota files */
  2922. -       return -EPERM;
  2923. -
  2924. -   /* lookup index object subject to the transfer */
  2925. -   obj = dt_locate(env, dev, &ii->ii_fid);
  2926. -   if (IS_ERR(obj))
  2927. -       return PTR_ERR(obj);
  2928. -   if (dt_object_exists(obj) == 0) {
  2929. -       rc = -ENOENT;
  2930. -       goto out;
  2931. -   }
  2932. -
  2933. -   /* fetch index features associated with index object */
  2934. -   feat = dt_index_feat_select(fid_seq(&ii->ii_fid),
  2935. -                   lu_object_attr(&obj->do_lu));
  2936. -   if (IS_ERR(feat)) {
  2937. -       rc = PTR_ERR(feat);
  2938. -       goto out;
  2939. -   }
  2940. -
  2941. -   /* load index feature if not done already */
  2942. -   if (obj->do_index_ops == NULL) {
  2943. -       rc = obj->do_ops->do_index_try(env, obj, feat);
  2944. -       if (rc)
  2945. -           goto out;
  2946. -   }
  2947. -
  2948. -   /* fill ii_flags with supported index features */
  2949. -   ii->ii_flags &= II_FL_NOHASH;
  2950. -
  2951. -   ii->ii_keysize = feat->dif_keysize_max;
  2952. -   if ((feat->dif_flags & DT_IND_VARKEY) != 0) {
  2953. -       /* key size is variable */
  2954. -       ii->ii_flags |= II_FL_VARKEY;
  2955. -       /* we don't support variable key size for the time being */
  2956. -       rc = -EOPNOTSUPP;
  2957. -       goto out;
  2958. -   }
  2959. -
  2960. -   ii->ii_recsize = feat->dif_recsize_max;
  2961. -   if ((feat->dif_flags & DT_IND_VARREC) != 0) {
  2962. -       /* record size is variable */
  2963. -       ii->ii_flags |= II_FL_VARREC;
  2964. -       /* we don't support variable record size for the time being */
  2965. -       rc = -EOPNOTSUPP;
  2966. -       goto out;
  2967. -   }
  2968. -
  2969. -   if ((feat->dif_flags & DT_IND_NONUNQ) != 0)
  2970. -       /* key isn't necessarily unique */
  2971. -       ii->ii_flags |= II_FL_NONUNQ;
  2972. -
  2973. -   dt_read_lock(env, obj, 0);
  2974. -   /* fetch object version before walking the index */
  2975. -   ii->ii_version = dt_version_get(env, obj);
  2976. -
  2977. -   /* walk the index and fill lu_idxpages with key/record pairs */
  2978. -   rc = dt_index_walk(env, obj, rdpg, dt_index_page_build, ii);
  2979. -   dt_read_unlock(env, obj);
  2980. -
  2981. -   if (rc == 0) {
  2982. -       /* index is empty */
  2983. -       LASSERT(ii->ii_count == 0);
  2984. -       ii->ii_hash_end = II_END_OFF;
  2985. -   }
  2986. -
  2987. -   goto out;
  2988. -out:
  2989. -   lu_object_put(env, &obj->do_lu);
  2990. -   return rc;
  2991. -}
  2992. -EXPORT_SYMBOL(dt_index_read);
  2993. -
  2994. -int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
  2995. -             int count, int *eof, void *data)
  2996. -{
  2997. -   struct dt_device *dt = data;
  2998. -   struct obd_statfs osfs;
  2999. -   int rc = dt_statfs(NULL, dt, &osfs);
  3000. -
  3001. -   if (rc == 0) {
  3002. -       *eof = 1;
  3003. -       rc = snprintf(page, count, "%u\n",
  3004. -               (unsigned) osfs.os_bsize);
  3005. -   }
  3006. -
  3007. -   return rc;
  3008. -}
  3009. -EXPORT_SYMBOL(lprocfs_dt_rd_blksize);
  3010. -
  3011. -int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off,
  3012. -                 int count, int *eof, void *data)
  3013. -{
  3014. -   struct dt_device *dt = data;
  3015. -   struct obd_statfs osfs;
  3016. -   int rc = dt_statfs(NULL, dt, &osfs);
  3017. -
  3018. -   if (rc == 0) {
  3019. -       __u32 blk_size = osfs.os_bsize >> 10;
  3020. -       __u64 result = osfs.os_blocks;
  3021. -
  3022. -       while (blk_size >>= 1)
  3023. -           result <<= 1;
  3024. -
  3025. -       *eof = 1;
  3026. -       rc = snprintf(page, count, "%llu\n", result);
  3027. -   }
  3028. -
  3029. -   return rc;
  3030. -}
  3031. -EXPORT_SYMBOL(lprocfs_dt_rd_kbytestotal);
  3032. -
  3033. -int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off,
  3034. -                int count, int *eof, void *data)
  3035. -{
  3036. -   struct dt_device *dt = data;
  3037. -   struct obd_statfs osfs;
  3038. -   int rc = dt_statfs(NULL, dt, &osfs);
  3039. -
  3040. -   if (rc == 0) {
  3041. -       __u32 blk_size = osfs.os_bsize >> 10;
  3042. -       __u64 result = osfs.os_bfree;
  3043. -
  3044. -       while (blk_size >>= 1)
  3045. -           result <<= 1;
  3046. -
  3047. -       *eof = 1;
  3048. -       rc = snprintf(page, count, "%llu\n", result);
  3049. -   }
  3050. -
  3051. -   return rc;
  3052. -}
  3053. -EXPORT_SYMBOL(lprocfs_dt_rd_kbytesfree);
  3054. -
  3055. -int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off,
  3056. -                 int count, int *eof, void *data)
  3057. -{
  3058. -   struct dt_device *dt = data;
  3059. -   struct obd_statfs osfs;
  3060. -   int rc = dt_statfs(NULL, dt, &osfs);
  3061. -
  3062. -   if (rc == 0) {
  3063. -       __u32 blk_size = osfs.os_bsize >> 10;
  3064. -       __u64 result = osfs.os_bavail;
  3065. -
  3066. -       while (blk_size >>= 1)
  3067. -           result <<= 1;
  3068. -
  3069. -       *eof = 1;
  3070. -       rc = snprintf(page, count, "%llu\n", result);
  3071. -   }
  3072. -
  3073. -   return rc;
  3074. -}
  3075. -EXPORT_SYMBOL(lprocfs_dt_rd_kbytesavail);
  3076. -
  3077. -int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off,
  3078. -                int count, int *eof, void *data)
  3079. -{
  3080. -   struct dt_device *dt = data;
  3081. -   struct obd_statfs osfs;
  3082. -   int rc = dt_statfs(NULL, dt, &osfs);
  3083. -
  3084. -   if (rc == 0) {
  3085. -       *eof = 1;
  3086. -       rc = snprintf(page, count, "%llu\n", osfs.os_files);
  3087. -   }
  3088. -
  3089. -   return rc;
  3090. -}
  3091. -EXPORT_SYMBOL(lprocfs_dt_rd_filestotal);
  3092. -
  3093. -int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
  3094. -               int count, int *eof, void *data)
  3095. -{
  3096. -   struct dt_device *dt = data;
  3097. -   struct obd_statfs osfs;
  3098. -   int rc = dt_statfs(NULL, dt, &osfs);
  3099. -
  3100. -   if (rc == 0) {
  3101. -       *eof = 1;
  3102. -       rc = snprintf(page, count, "%llu\n", osfs.os_ffree);
  3103. -   }
  3104. -
  3105. -   return rc;
  3106. -}
  3107. -EXPORT_SYMBOL(lprocfs_dt_rd_filesfree);
  3108. diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
  3109. index a27932502f2a..35a9dea529bd 100644
  3110. --- a/drivers/staging/lustre/lustre/obdclass/genops.c
  3111. +++ b/drivers/staging/lustre/lustre/obdclass/genops.c
  3112. @@ -439,16 +439,6 @@ int class_uuid2dev(struct obd_uuid *uuid)
  3113.  }
  3114.  EXPORT_SYMBOL(class_uuid2dev);
  3115.  
  3116. -struct obd_device *class_uuid2obd(struct obd_uuid *uuid)
  3117. -{
  3118. -   int dev = class_uuid2dev(uuid);
  3119. -
  3120. -   if (dev < 0)
  3121. -       return NULL;
  3122. -   return class_num2obd(dev);
  3123. -}
  3124. -EXPORT_SYMBOL(class_uuid2obd);
  3125. -
  3126.  /**
  3127.   * Get obd device from ::obd_devs[]
  3128.   *
  3129. @@ -478,55 +468,6 @@ struct obd_device *class_num2obd(int num)
  3130.  }
  3131.  EXPORT_SYMBOL(class_num2obd);
  3132.  
  3133. -/**
  3134. - * Get obd devices count. Device in any
  3135. - *    state are counted
  3136. - * \retval obd device count
  3137. - */
  3138. -int get_devices_count(void)
  3139. -{
  3140. -   int index, max_index = class_devno_max(), dev_count = 0;
  3141. -
  3142. -   read_lock(&obd_dev_lock);
  3143. -   for (index = 0; index <= max_index; index++) {
  3144. -       struct obd_device *obd = class_num2obd(index);
  3145. -
  3146. -       if (obd != NULL)
  3147. -           dev_count++;
  3148. -   }
  3149. -   read_unlock(&obd_dev_lock);
  3150. -
  3151. -   return dev_count;
  3152. -}
  3153. -EXPORT_SYMBOL(get_devices_count);
  3154. -
  3155. -void class_obd_list(void)
  3156. -{
  3157. -   char *status;
  3158. -   int i;
  3159. -
  3160. -   read_lock(&obd_dev_lock);
  3161. -   for (i = 0; i < class_devno_max(); i++) {
  3162. -       struct obd_device *obd = class_num2obd(i);
  3163. -
  3164. -       if (!obd)
  3165. -           continue;
  3166. -       if (obd->obd_stopping)
  3167. -           status = "ST";
  3168. -       else if (obd->obd_set_up)
  3169. -           status = "UP";
  3170. -       else if (obd->obd_attached)
  3171. -           status = "AT";
  3172. -       else
  3173. -           status = "--";
  3174. -       LCONSOLE(D_CONFIG, "%3d %s %s %s %s %d\n",
  3175. -            i, status, obd->obd_type->typ_name,
  3176. -            obd->obd_name, obd->obd_uuid.uuid,
  3177. -            atomic_read(&obd->obd_refcount));
  3178. -   }
  3179. -   read_unlock(&obd_dev_lock);
  3180. -}
  3181. -
  3182.  /* Search for a client OBD connected to tgt_uuid.  If grp_uuid is
  3183.     specified, then only the client with that uuid is returned,
  3184.     otherwise any client connected to the tgt is returned. */
  3185. @@ -713,21 +654,6 @@ struct obd_device *class_exp2obd(struct obd_export *exp)
  3186.  }
  3187.  EXPORT_SYMBOL(class_exp2obd);
  3188.  
  3189. -struct obd_device *class_conn2obd(struct lustre_handle *conn)
  3190. -{
  3191. -   struct obd_export *export;
  3192. -
  3193. -   export = class_conn2export(conn);
  3194. -   if (export) {
  3195. -       struct obd_device *obd = export->exp_obd;
  3196. -
  3197. -       class_export_put(export);
  3198. -       return obd;
  3199. -   }
  3200. -   return NULL;
  3201. -}
  3202. -EXPORT_SYMBOL(class_conn2obd);
  3203. -
  3204.  struct obd_import *class_exp2cliimp(struct obd_export *exp)
  3205.  {
  3206.     struct obd_device *obd = exp->exp_obd;
  3207. @@ -738,16 +664,6 @@ struct obd_import *class_exp2cliimp(struct obd_export *exp)
  3208.  }
  3209.  EXPORT_SYMBOL(class_exp2cliimp);
  3210.  
  3211. -struct obd_import *class_conn2cliimp(struct lustre_handle *conn)
  3212. -{
  3213. -   struct obd_device *obd = class_conn2obd(conn);
  3214. -
  3215. -   if (!obd)
  3216. -       return NULL;
  3217. -   return obd->u.cli.cl_import;
  3218. -}
  3219. -EXPORT_SYMBOL(class_conn2cliimp);
  3220. -
  3221.  /* Export management functions */
  3222.  static void class_export_destroy(struct obd_export *exp)
  3223.  {
  3224. @@ -1220,21 +1136,6 @@ no_disconn:
  3225.  }
  3226.  EXPORT_SYMBOL(class_disconnect);
  3227.  
  3228. -/* Return non-zero for a fully connected export */
  3229. -int class_connected_export(struct obd_export *exp)
  3230. -{
  3231. -   if (exp) {
  3232. -       int connected;
  3233. -
  3234. -       spin_lock(&exp->exp_lock);
  3235. -       connected = exp->exp_conn_cnt > 0;
  3236. -       spin_unlock(&exp->exp_lock);
  3237. -       return connected;
  3238. -   }
  3239. -   return 0;
  3240. -}
  3241. -EXPORT_SYMBOL(class_connected_export);
  3242. -
  3243.  static void class_disconnect_export_list(struct list_head *list,
  3244.                      enum obd_option flags)
  3245.  {
  3246. @@ -1300,56 +1201,6 @@ void class_disconnect_exports(struct obd_device *obd)
  3247.  }
  3248.  EXPORT_SYMBOL(class_disconnect_exports);
  3249.  
  3250. -/* Remove exports that have not completed recovery.
  3251. - */
  3252. -void class_disconnect_stale_exports(struct obd_device *obd,
  3253. -                   int (*test_export)(struct obd_export *))
  3254. -{
  3255. -   struct list_head work_list;
  3256. -   struct obd_export *exp, *n;
  3257. -   int evicted = 0;
  3258. -
  3259. -   INIT_LIST_HEAD(&work_list);
  3260. -   spin_lock(&obd->obd_dev_lock);
  3261. -   list_for_each_entry_safe(exp, n, &obd->obd_exports,
  3262. -                    exp_obd_chain) {
  3263. -       /* don't count self-export as client */
  3264. -       if (obd_uuid_equals(&exp->exp_client_uuid,
  3265. -                   &exp->exp_obd->obd_uuid))
  3266. -           continue;
  3267. -
  3268. -       /* don't evict clients which have no slot in last_rcvd
  3269. -        * (e.g. lightweight connection) */
  3270. -       if (exp->exp_target_data.ted_lr_idx == -1)
  3271. -           continue;
  3272. -
  3273. -       spin_lock(&exp->exp_lock);
  3274. -       if (exp->exp_failed || test_export(exp)) {
  3275. -           spin_unlock(&exp->exp_lock);
  3276. -           continue;
  3277. -       }
  3278. -       exp->exp_failed = 1;
  3279. -       spin_unlock(&exp->exp_lock);
  3280. -
  3281. -       list_move(&exp->exp_obd_chain, &work_list);
  3282. -       evicted++;
  3283. -       CDEBUG(D_HA, "%s: disconnect stale client %s@%s\n",
  3284. -              obd->obd_name, exp->exp_client_uuid.uuid,
  3285. -              !exp->exp_connection ? "<unknown>" :
  3286. -              libcfs_nid2str(exp->exp_connection->c_peer.nid));
  3287. -       print_export_data(exp, "EVICTING", 0);
  3288. -   }
  3289. -   spin_unlock(&obd->obd_dev_lock);
  3290. -
  3291. -   if (evicted)
  3292. -       LCONSOLE_WARN("%s: disconnecting %d stale clients\n",
  3293. -                 obd->obd_name, evicted);
  3294. -
  3295. -   class_disconnect_export_list(&work_list, exp_flags_from_obd(obd) |
  3296. -                        OBD_OPT_ABORT_RECOV);
  3297. -}
  3298. -EXPORT_SYMBOL(class_disconnect_stale_exports);
  3299. -
  3300.  void class_fail_export(struct obd_export *exp)
  3301.  {
  3302.     int rc, already_failed;
  3303. @@ -1542,29 +1393,6 @@ void dump_exports(struct obd_device *obd, int locks)
  3304.  }
  3305.  EXPORT_SYMBOL(dump_exports);
  3306.  
  3307. -void obd_exports_barrier(struct obd_device *obd)
  3308. -{
  3309. -   int waited = 2;
  3310. -
  3311. -   LASSERT(list_empty(&obd->obd_exports));
  3312. -   spin_lock(&obd->obd_dev_lock);
  3313. -   while (!list_empty(&obd->obd_unlinked_exports)) {
  3314. -       spin_unlock(&obd->obd_dev_lock);
  3315. -       set_current_state(TASK_UNINTERRUPTIBLE);
  3316. -       schedule_timeout(cfs_time_seconds(waited));
  3317. -       if (waited > 5 && IS_PO2(waited)) {
  3318. -           LCONSOLE_WARN("%s is waiting for obd_unlinked_exports more than %d seconds. The obd refcount = %d. Is it stuck?\n",
  3319. -                     obd->obd_name, waited,
  3320. -                     atomic_read(&obd->obd_refcount));
  3321. -           dump_exports(obd, 1);
  3322. -       }
  3323. -       waited *= 2;
  3324. -       spin_lock(&obd->obd_dev_lock);
  3325. -   }
  3326. -   spin_unlock(&obd->obd_dev_lock);
  3327. -}
  3328. -EXPORT_SYMBOL(obd_exports_barrier);
  3329. -
  3330.  /* Total amount of zombies to be destroyed */
  3331.  static int zombies_count;
  3332.  
  3333. @@ -1775,70 +1603,3 @@ void obd_zombie_impexp_stop(void)
  3334.     obd_zombie_impexp_notify();
  3335.     wait_for_completion(&obd_zombie_stop);
  3336.  }
  3337. -
  3338. -/***** Kernel-userspace comm helpers *******/
  3339. -
  3340. -/* Get length of entire message, including header */
  3341. -int kuc_len(int payload_len)
  3342. -{
  3343. -   return sizeof(struct kuc_hdr) + payload_len;
  3344. -}
  3345. -EXPORT_SYMBOL(kuc_len);
  3346. -
  3347. -/* Get a pointer to kuc header, given a ptr to the payload
  3348. - * @param p Pointer to payload area
  3349. - * @returns Pointer to kuc header
  3350. - */
  3351. -struct kuc_hdr *kuc_ptr(void *p)
  3352. -{
  3353. -   struct kuc_hdr *lh = ((struct kuc_hdr *)p) - 1;
  3354. -
  3355. -   LASSERT(lh->kuc_magic == KUC_MAGIC);
  3356. -   return lh;
  3357. -}
  3358. -EXPORT_SYMBOL(kuc_ptr);
  3359. -
  3360. -/* Test if payload is part of kuc message
  3361. - * @param p Pointer to payload area
  3362. - * @returns boolean
  3363. - */
  3364. -int kuc_ispayload(void *p)
  3365. -{
  3366. -   struct kuc_hdr *kh = ((struct kuc_hdr *)p) - 1;
  3367. -
  3368. -   if (kh->kuc_magic == KUC_MAGIC)
  3369. -       return 1;
  3370. -   else
  3371. -       return 0;
  3372. -}
  3373. -EXPORT_SYMBOL(kuc_ispayload);
  3374. -
  3375. -/* Alloc space for a message, and fill in header
  3376. - * @return Pointer to payload area
  3377. - */
  3378. -void *kuc_alloc(int payload_len, int transport, int type)
  3379. -{
  3380. -   struct kuc_hdr *lh;
  3381. -   int len = kuc_len(payload_len);
  3382. -
  3383. -   lh = kzalloc(len, GFP_NOFS);
  3384. -   if (!lh)
  3385. -       return ERR_PTR(-ENOMEM);
  3386. -
  3387. -   lh->kuc_magic = KUC_MAGIC;
  3388. -   lh->kuc_transport = transport;
  3389. -   lh->kuc_msgtype = type;
  3390. -   lh->kuc_msglen = len;
  3391. -
  3392. -   return (void *)(lh + 1);
  3393. -}
  3394. -EXPORT_SYMBOL(kuc_alloc);
  3395. -
  3396. -/* Takes pointer to payload area */
  3397. -inline void kuc_free(void *p, int payload_len)
  3398. -{
  3399. -   struct kuc_hdr *lh = kuc_ptr(p);
  3400. -
  3401. -   kfree(lh);
  3402. -}
  3403. -EXPORT_SYMBOL(kuc_free);
  3404. diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
  3405. index 62ed706b136d..9496c09b2b69 100644
  3406. --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
  3407. +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
  3408. @@ -49,102 +49,6 @@
  3409.  #include <linux/fs.h>
  3410.  #include <linux/pagemap.h> /* for PAGE_CACHE_SIZE */
  3411.  
  3412. -/*FIXME: Just copy from obdo_from_inode*/
  3413. -void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid)
  3414. -{
  3415. -   u32 newvalid = 0;
  3416. -
  3417. -   if (valid & LA_ATIME) {
  3418. -       dst->o_atime = la->la_atime;
  3419. -       newvalid |= OBD_MD_FLATIME;
  3420. -   }
  3421. -   if (valid & LA_MTIME) {
  3422. -       dst->o_mtime = la->la_mtime;
  3423. -       newvalid |= OBD_MD_FLMTIME;
  3424. -   }
  3425. -   if (valid & LA_CTIME) {
  3426. -       dst->o_ctime = la->la_ctime;
  3427. -       newvalid |= OBD_MD_FLCTIME;
  3428. -   }
  3429. -   if (valid & LA_SIZE) {
  3430. -       dst->o_size = la->la_size;
  3431. -       newvalid |= OBD_MD_FLSIZE;
  3432. -   }
  3433. -   if (valid & LA_BLOCKS) {  /* allocation of space (x512 bytes) */
  3434. -       dst->o_blocks = la->la_blocks;
  3435. -       newvalid |= OBD_MD_FLBLOCKS;
  3436. -   }
  3437. -   if (valid & LA_TYPE) {
  3438. -       dst->o_mode = (dst->o_mode & S_IALLUGO) |
  3439. -                 (la->la_mode & S_IFMT);
  3440. -       newvalid |= OBD_MD_FLTYPE;
  3441. -   }
  3442. -   if (valid & LA_MODE) {
  3443. -       dst->o_mode = (dst->o_mode & S_IFMT) |
  3444. -                 (la->la_mode & S_IALLUGO);
  3445. -       newvalid |= OBD_MD_FLMODE;
  3446. -   }
  3447. -   if (valid & LA_UID) {
  3448. -       dst->o_uid = la->la_uid;
  3449. -       newvalid |= OBD_MD_FLUID;
  3450. -   }
  3451. -   if (valid & LA_GID) {
  3452. -       dst->o_gid = la->la_gid;
  3453. -       newvalid |= OBD_MD_FLGID;
  3454. -   }
  3455. -   dst->o_valid |= newvalid;
  3456. -}
  3457. -EXPORT_SYMBOL(obdo_from_la);
  3458. -
  3459. -/*FIXME: Just copy from obdo_from_inode*/
  3460. -void la_from_obdo(struct lu_attr *dst, struct obdo *obdo, u32 valid)
  3461. -{
  3462. -   __u64 newvalid = 0;
  3463. -
  3464. -   valid &= obdo->o_valid;
  3465. -
  3466. -   if (valid & OBD_MD_FLATIME) {
  3467. -       dst->la_atime = obdo->o_atime;
  3468. -       newvalid |= LA_ATIME;
  3469. -   }
  3470. -   if (valid & OBD_MD_FLMTIME) {
  3471. -       dst->la_mtime = obdo->o_mtime;
  3472. -       newvalid |= LA_MTIME;
  3473. -   }
  3474. -   if (valid & OBD_MD_FLCTIME) {
  3475. -       dst->la_ctime = obdo->o_ctime;
  3476. -       newvalid |= LA_CTIME;
  3477. -   }
  3478. -   if (valid & OBD_MD_FLSIZE) {
  3479. -       dst->la_size = obdo->o_size;
  3480. -       newvalid |= LA_SIZE;
  3481. -   }
  3482. -   if (valid & OBD_MD_FLBLOCKS) {
  3483. -       dst->la_blocks = obdo->o_blocks;
  3484. -       newvalid |= LA_BLOCKS;
  3485. -   }
  3486. -   if (valid & OBD_MD_FLTYPE) {
  3487. -       dst->la_mode = (dst->la_mode & S_IALLUGO) |
  3488. -                  (obdo->o_mode & S_IFMT);
  3489. -       newvalid |= LA_TYPE;
  3490. -   }
  3491. -   if (valid & OBD_MD_FLMODE) {
  3492. -       dst->la_mode = (dst->la_mode & S_IFMT) |
  3493. -                  (obdo->o_mode & S_IALLUGO);
  3494. -       newvalid |= LA_MODE;
  3495. -   }
  3496. -   if (valid & OBD_MD_FLUID) {
  3497. -       dst->la_uid = obdo->o_uid;
  3498. -       newvalid |= LA_UID;
  3499. -   }
  3500. -   if (valid & OBD_MD_FLGID) {
  3501. -       dst->la_gid = obdo->o_gid;
  3502. -       newvalid |= LA_GID;
  3503. -   }
  3504. -   dst->la_valid = newvalid;
  3505. -}
  3506. -EXPORT_SYMBOL(la_from_obdo);
  3507. -
  3508.  void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
  3509.  {
  3510.     valid &= src->o_valid;
  3511. @@ -179,44 +83,3 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
  3512.         dst->i_blocks = src->o_blocks;
  3513.  }
  3514.  EXPORT_SYMBOL(obdo_refresh_inode);
  3515. -
  3516. -void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid)
  3517. -{
  3518. -   valid &= src->o_valid;
  3519. -
  3520. -   LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID |
  3521. -               OBD_MD_FLID | OBD_MD_FLGROUP)),
  3522. -        "object "DOSTID", valid %x\n", POSTID(&src->o_oi), valid);
  3523. -
  3524. -   if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
  3525. -       CDEBUG(D_INODE,
  3526. -              "valid %#llx, cur time %lu/%lu, new %llu/%llu\n",
  3527. -              src->o_valid, LTIME_S(dst->i_mtime),
  3528. -              LTIME_S(dst->i_ctime), src->o_mtime, src->o_ctime);
  3529. -
  3530. -   if (valid & OBD_MD_FLATIME)
  3531. -       LTIME_S(dst->i_atime) = src->o_atime;
  3532. -   if (valid & OBD_MD_FLMTIME)
  3533. -       LTIME_S(dst->i_mtime) = src->o_mtime;
  3534. -   if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(dst->i_ctime))
  3535. -       LTIME_S(dst->i_ctime) = src->o_ctime;
  3536. -   if (valid & OBD_MD_FLSIZE)
  3537. -       i_size_write(dst, src->o_size);
  3538. -   if (valid & OBD_MD_FLBLOCKS) { /* allocation of space */
  3539. -       dst->i_blocks = src->o_blocks;
  3540. -       if (dst->i_blocks < src->o_blocks) /* overflow */
  3541. -           dst->i_blocks = -1;
  3542. -
  3543. -   }
  3544. -   if (valid & OBD_MD_FLBLKSZ)
  3545. -       dst->i_blkbits = ffs(src->o_blksize)-1;
  3546. -   if (valid & OBD_MD_FLMODE)
  3547. -       dst->i_mode = (dst->i_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
  3548. -   if (valid & OBD_MD_FLUID)
  3549. -       dst->i_uid = make_kuid(&init_user_ns, src->o_uid);
  3550. -   if (valid & OBD_MD_FLGID)
  3551. -       dst->i_gid = make_kgid(&init_user_ns, src->o_gid);
  3552. -   if (valid & OBD_MD_FLFLAGS)
  3553. -       dst->i_flags = src->o_flags;
  3554. -}
  3555. -EXPORT_SYMBOL(obdo_to_inode);
  3556. diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
  3557. index 1515163a81a5..518288df4d53 100644
  3558. --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
  3559. +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
  3560. @@ -162,7 +162,3 @@ int obd_sysctl_init(void)
  3561.  {
  3562.     return sysfs_create_group(lustre_kobj, &lustre_attr_group);
  3563.  }
  3564. -
  3565. -void obd_sysctl_clean(void)
  3566. -{
  3567. -}
  3568. diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c
  3569. index 8cad47080456..b93ee4ca4239 100644
  3570. --- a/drivers/staging/lustre/lustre/obdclass/llog.c
  3571. +++ b/drivers/staging/lustre/lustre/obdclass/llog.c
  3572. @@ -50,6 +50,7 @@
  3573.  
  3574.  #include "../include/obd_class.h"
  3575.  #include "../include/lustre_log.h"
  3576. +#include "../include/dt_object.h"
  3577.  #include "llog_internal.h"
  3578.  
  3579.  /*
  3580. @@ -475,173 +476,6 @@ int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
  3581.  }
  3582.  EXPORT_SYMBOL(llog_process);
  3583.  
  3584. -int llog_reverse_process(const struct lu_env *env,
  3585. -            struct llog_handle *loghandle, llog_cb_t cb,
  3586. -            void *data, void *catdata)
  3587. -{
  3588. -   struct llog_log_hdr *llh = loghandle->lgh_hdr;
  3589. -   struct llog_process_cat_data *cd = catdata;
  3590. -   void *buf;
  3591. -   int rc = 0, first_index = 1, index, idx;
  3592. -
  3593. -   buf = kzalloc(LLOG_CHUNK_SIZE, GFP_NOFS);
  3594. -   if (!buf)
  3595. -       return -ENOMEM;
  3596. -
  3597. -   if (cd != NULL)
  3598. -       first_index = cd->lpcd_first_idx + 1;
  3599. -   if (cd != NULL && cd->lpcd_last_idx)
  3600. -       index = cd->lpcd_last_idx;
  3601. -   else
  3602. -       index = LLOG_BITMAP_BYTES * 8 - 1;
  3603. -
  3604. -   while (rc == 0) {
  3605. -       struct llog_rec_hdr *rec;
  3606. -       struct llog_rec_tail *tail;
  3607. -
  3608. -       /* skip records not set in bitmap */
  3609. -       while (index >= first_index &&
  3610. -              !ext2_test_bit(index, llh->llh_bitmap))
  3611. -           --index;
  3612. -
  3613. -       LASSERT(index >= first_index - 1);
  3614. -       if (index == first_index - 1)
  3615. -           break;
  3616. -
  3617. -       /* get the buf with our target record; avoid old garbage */
  3618. -       memset(buf, 0, LLOG_CHUNK_SIZE);
  3619. -       rc = llog_prev_block(env, loghandle, index, buf,
  3620. -                    LLOG_CHUNK_SIZE);
  3621. -       if (rc)
  3622. -           goto out;
  3623. -
  3624. -       rec = buf;
  3625. -       idx = rec->lrh_index;
  3626. -       CDEBUG(D_RPCTRACE, "index %u : idx %u\n", index, idx);
  3627. -       while (idx < index) {
  3628. -           rec = (void *)rec + rec->lrh_len;
  3629. -           if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
  3630. -               lustre_swab_llog_rec(rec);
  3631. -           idx++;
  3632. -       }
  3633. -       LASSERT(idx == index);
  3634. -       tail = (void *)rec + rec->lrh_len - sizeof(*tail);
  3635. -
  3636. -       /* process records in buffer, starting where we found one */
  3637. -       while ((void *)tail > buf) {
  3638. -           if (tail->lrt_index == 0) {
  3639. -               /* no more records */
  3640. -               rc = 0;
  3641. -               goto out;
  3642. -           }
  3643. -
  3644. -           /* if set, process the callback on this record */
  3645. -           if (ext2_test_bit(index, llh->llh_bitmap)) {
  3646. -               rec = (void *)tail - tail->lrt_len +
  3647. -                     sizeof(*tail);
  3648. -
  3649. -               rc = cb(env, loghandle, rec, data);
  3650. -               if (rc == LLOG_PROC_BREAK) {
  3651. -                   goto out;
  3652. -               } else if (rc == LLOG_DEL_RECORD) {
  3653. -                   llog_cancel_rec(env, loghandle,
  3654. -                           tail->lrt_index);
  3655. -                   rc = 0;
  3656. -               }
  3657. -               if (rc)
  3658. -                   goto out;
  3659. -           }
  3660. -
  3661. -           /* previous record, still in buffer? */
  3662. -           --index;
  3663. -           if (index < first_index) {
  3664. -               rc = 0;
  3665. -               goto out;
  3666. -           }
  3667. -           tail = (void *)tail - tail->lrt_len;
  3668. -       }
  3669. -   }
  3670. -
  3671. -out:
  3672. -   kfree(buf);
  3673. -   return rc;
  3674. -}
  3675. -EXPORT_SYMBOL(llog_reverse_process);
  3676. -
  3677. -/**
  3678. - * new llog API
  3679. - *
  3680. - * API functions:
  3681. - *      llog_open - open llog, may not exist
  3682. - *      llog_exist - check if llog exists
  3683. - *      llog_close - close opened llog, pair for open, frees llog_handle
  3684. - *      llog_declare_create - declare llog creation
  3685. - *      llog_create - create new llog on disk, need transaction handle
  3686. - *      llog_declare_write_rec - declaration of llog write
  3687. - *      llog_write_rec - write llog record on disk, need transaction handle
  3688. - *      llog_declare_add - declare llog catalog record addition
  3689. - *      llog_add - add llog record in catalog, need transaction handle
  3690. - */
  3691. -int llog_exist(struct llog_handle *loghandle)
  3692. -{
  3693. -   struct llog_operations  *lop;
  3694. -   int          rc;
  3695. -
  3696. -   rc = llog_handle2ops(loghandle, &lop);
  3697. -   if (rc)
  3698. -       return rc;
  3699. -   if (lop->lop_exist == NULL)
  3700. -       return -EOPNOTSUPP;
  3701. -
  3702. -   rc = lop->lop_exist(loghandle);
  3703. -   return rc;
  3704. -}
  3705. -EXPORT_SYMBOL(llog_exist);
  3706. -
  3707. -int llog_declare_create(const struct lu_env *env,
  3708. -           struct llog_handle *loghandle, struct thandle *th)
  3709. -{
  3710. -   struct llog_operations  *lop;
  3711. -   int          raised, rc;
  3712. -
  3713. -   rc = llog_handle2ops(loghandle, &lop);
  3714. -   if (rc)
  3715. -       return rc;
  3716. -   if (lop->lop_declare_create == NULL)
  3717. -       return -EOPNOTSUPP;
  3718. -
  3719. -   raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
  3720. -   if (!raised)
  3721. -       cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
  3722. -   rc = lop->lop_declare_create(env, loghandle, th);
  3723. -   if (!raised)
  3724. -       cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
  3725. -   return rc;
  3726. -}
  3727. -EXPORT_SYMBOL(llog_declare_create);
  3728. -
  3729. -int llog_create(const struct lu_env *env, struct llog_handle *handle,
  3730. -       struct thandle *th)
  3731. -{
  3732. -   struct llog_operations  *lop;
  3733. -   int          raised, rc;
  3734. -
  3735. -   rc = llog_handle2ops(handle, &lop);
  3736. -   if (rc)
  3737. -       return rc;
  3738. -   if (lop->lop_create == NULL)
  3739. -       return -EOPNOTSUPP;
  3740. -
  3741. -   raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
  3742. -   if (!raised)
  3743. -       cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
  3744. -   rc = lop->lop_create(env, handle, th);
  3745. -   if (!raised)
  3746. -       cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
  3747. -   return rc;
  3748. -}
  3749. -EXPORT_SYMBOL(llog_create);
  3750. -
  3751.  int llog_declare_write_rec(const struct lu_env *env,
  3752.                struct llog_handle *handle,
  3753.                struct llog_rec_hdr *rec, int idx,
  3754. @@ -700,114 +534,6 @@ int llog_write_rec(const struct lu_env *env, struct llog_handle *handle,
  3755.  }
  3756.  EXPORT_SYMBOL(llog_write_rec);
  3757.  
  3758. -int llog_add(const struct lu_env *env, struct llog_handle *lgh,
  3759. -        struct llog_rec_hdr *rec, struct llog_cookie *logcookies,
  3760. -        void *buf, struct thandle *th)
  3761. -{
  3762. -   int raised, rc;
  3763. -
  3764. -   if (lgh->lgh_logops->lop_add == NULL)
  3765. -       return -EOPNOTSUPP;
  3766. -
  3767. -   raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
  3768. -   if (!raised)
  3769. -       cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
  3770. -   rc = lgh->lgh_logops->lop_add(env, lgh, rec, logcookies, buf, th);
  3771. -   if (!raised)
  3772. -       cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
  3773. -   return rc;
  3774. -}
  3775. -EXPORT_SYMBOL(llog_add);
  3776. -
  3777. -int llog_declare_add(const struct lu_env *env, struct llog_handle *lgh,
  3778. -            struct llog_rec_hdr *rec, struct thandle *th)
  3779. -{
  3780. -   int raised, rc;
  3781. -
  3782. -   if (lgh->lgh_logops->lop_declare_add == NULL)
  3783. -       return -EOPNOTSUPP;
  3784. -
  3785. -   raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
  3786. -   if (!raised)
  3787. -       cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
  3788. -   rc = lgh->lgh_logops->lop_declare_add(env, lgh, rec, th);
  3789. -   if (!raised)
  3790. -       cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
  3791. -   return rc;
  3792. -}
  3793. -EXPORT_SYMBOL(llog_declare_add);
  3794. -
  3795. -/**
  3796. - * Helper function to open llog or create it if doesn't exist.
  3797. - * It hides all transaction handling from caller.
  3798. - */
  3799. -int llog_open_create(const struct lu_env *env, struct llog_ctxt *ctxt,
  3800. -            struct llog_handle **res, struct llog_logid *logid,
  3801. -            char *name)
  3802. -{
  3803. -   struct dt_device    *d;
  3804. -   struct thandle      *th;
  3805. -   int          rc;
  3806. -
  3807. -   rc = llog_open(env, ctxt, res, logid, name, LLOG_OPEN_NEW);
  3808. -   if (rc)
  3809. -       return rc;
  3810. -
  3811. -   if (llog_exist(*res))
  3812. -       return 0;
  3813. -
  3814. -   LASSERT((*res)->lgh_obj != NULL);
  3815. -
  3816. -   d = lu2dt_dev((*res)->lgh_obj->do_lu.lo_dev);
  3817. -
  3818. -   th = dt_trans_create(env, d);
  3819. -   if (IS_ERR(th)) {
  3820. -       rc = PTR_ERR(th);
  3821. -       goto out;
  3822. -   }
  3823. -
  3824. -   rc = llog_declare_create(env, *res, th);
  3825. -   if (rc == 0) {
  3826. -       rc = dt_trans_start_local(env, d, th);
  3827. -       if (rc == 0)
  3828. -           rc = llog_create(env, *res, th);
  3829. -   }
  3830. -   dt_trans_stop(env, d, th);
  3831. -out:
  3832. -   if (rc)
  3833. -       llog_close(env, *res);
  3834. -   return rc;
  3835. -}
  3836. -EXPORT_SYMBOL(llog_open_create);
  3837. -
  3838. -/**
  3839. - * Helper function to delete existent llog.
  3840. - */
  3841. -int llog_erase(const struct lu_env *env, struct llog_ctxt *ctxt,
  3842. -          struct llog_logid *logid, char *name)
  3843. -{
  3844. -   struct llog_handle  *handle;
  3845. -   int          rc = 0, rc2;
  3846. -
  3847. -   /* nothing to erase */
  3848. -   if (name == NULL && logid == NULL)
  3849. -       return 0;
  3850. -
  3851. -   rc = llog_open(env, ctxt, &handle, logid, name, LLOG_OPEN_EXISTS);
  3852. -   if (rc < 0)
  3853. -       return rc;
  3854. -
  3855. -   rc = llog_init_handle(env, handle, LLOG_F_IS_PLAIN, NULL);
  3856. -   if (rc == 0)
  3857. -       rc = llog_destroy(env, handle);
  3858. -
  3859. -   rc2 = llog_close(env, handle);
  3860. -   if (rc == 0)
  3861. -       rc = rc2;
  3862. -   return rc;
  3863. -}
  3864. -EXPORT_SYMBOL(llog_erase);
  3865. -
  3866.  /*
  3867.   * Helper function for write record in llog.
  3868.   * It hides all transaction handling from caller.
  3869. @@ -902,105 +628,3 @@ out:
  3870.     return rc;
  3871.  }
  3872.  EXPORT_SYMBOL(llog_close);
  3873. -
  3874. -int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt,
  3875. -         char *name)
  3876. -{
  3877. -   struct llog_handle  *llh;
  3878. -   int          rc;
  3879. -
  3880. -   rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
  3881. -   if (rc < 0) {
  3882. -       if (likely(rc == -ENOENT))
  3883. -           rc = 0;
  3884. -       goto out;
  3885. -   }
  3886. -
  3887. -   rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
  3888. -   if (rc)
  3889. -       goto out_close;
  3890. -   rc = llog_get_size(llh);
  3891. -
  3892. -out_close:
  3893. -   llog_close(env, llh);
  3894. -out:
  3895. -   /* header is record 1 */
  3896. -   return rc <= 1;
  3897. -}
  3898. -EXPORT_SYMBOL(llog_is_empty);
  3899. -
  3900. -int llog_copy_handler(const struct lu_env *env, struct llog_handle *llh,
  3901. -             struct llog_rec_hdr *rec, void *data)
  3902. -{
  3903. -   struct llog_handle  *copy_llh = data;
  3904. -
  3905. -   /* Append all records */
  3906. -   return llog_write(env, copy_llh, rec, NULL, 0, NULL, -1);
  3907. -}
  3908. -EXPORT_SYMBOL(llog_copy_handler);
  3909. -
  3910. -/* backup plain llog */
  3911. -int llog_backup(const struct lu_env *env, struct obd_device *obd,
  3912. -       struct llog_ctxt *ctxt, struct llog_ctxt *bctxt,
  3913. -       char *name, char *backup)
  3914. -{
  3915. -   struct llog_handle  *llh, *bllh;
  3916. -   int          rc;
  3917. -
  3918. -
  3919. -
  3920. -   /* open original log */
  3921. -   rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
  3922. -   if (rc < 0) {
  3923. -       /* the -ENOENT case is also reported to the caller
  3924. -        * but silently so it should handle that if needed.
  3925. -        */
  3926. -       if (rc != -ENOENT)
  3927. -           CERROR("%s: failed to open log %s: rc = %d\n",
  3928. -                  obd->obd_name, name, rc);
  3929. -       return rc;
  3930. -   }
  3931. -
  3932. -   rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
  3933. -   if (rc)
  3934. -       goto out_close;
  3935. -
  3936. -   /* Make sure there's no old backup log */
  3937. -   rc = llog_erase(env, bctxt, NULL, backup);
  3938. -   if (rc < 0 && rc != -ENOENT)
  3939. -       goto out_close;
  3940. -
  3941. -   /* open backup log */
  3942. -   rc = llog_open_create(env, bctxt, &bllh, NULL, backup);
  3943. -   if (rc) {
  3944. -       CERROR("%s: failed to open backup logfile %s: rc = %d\n",
  3945. -              obd->obd_name, backup, rc);
  3946. -       goto out_close;
  3947. -   }
  3948. -
  3949. -   /* check that backup llog is not the same object as original one */
  3950. -   if (llh->lgh_obj == bllh->lgh_obj) {
  3951. -       CERROR("%s: backup llog %s to itself (%s), objects %p/%p\n",
  3952. -              obd->obd_name, name, backup, llh->lgh_obj,
  3953. -              bllh->lgh_obj);
  3954. -       rc = -EEXIST;
  3955. -       goto out_backup;
  3956. -   }
  3957. -
  3958. -   rc = llog_init_handle(env, bllh, LLOG_F_IS_PLAIN, NULL);
  3959. -   if (rc)
  3960. -       goto out_backup;
  3961. -
  3962. -   /* Copy log record by record */
  3963. -   rc = llog_process_or_fork(env, llh, llog_copy_handler, (void *)bllh,
  3964. -                 NULL, false);
  3965. -   if (rc)
  3966. -       CERROR("%s: failed to backup log %s: rc = %d\n",
  3967. -              obd->obd_name, name, rc);
  3968. -out_backup:
  3969. -   llog_close(env, bllh);
  3970. -out_close:
  3971. -   llog_close(env, llh);
  3972. -   return rc;
  3973. -}
  3974. -EXPORT_SYMBOL(llog_backup);
  3975. diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
  3976. index 48dbbcf97702..412481eb4b81 100644
  3977. --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c
  3978. +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
  3979. @@ -53,93 +53,6 @@
  3980.  
  3981.  #include "llog_internal.h"
  3982.  
  3983. -/* Create a new log handle and add it to the open list.
  3984. - * This log handle will be closed when all of the records in it are removed.
  3985. - *
  3986. - * Assumes caller has already pushed us into the kernel context and is locking.
  3987. - */
  3988. -static int llog_cat_new_log(const struct lu_env *env,
  3989. -               struct llog_handle *cathandle,
  3990. -               struct llog_handle *loghandle,
  3991. -               struct thandle *th)
  3992. -{
  3993. -
  3994. -   struct llog_log_hdr *llh;
  3995. -   struct llog_logid_rec rec = { { 0 }, };
  3996. -   int rc, index, bitmap_size;
  3997. -
  3998. -   llh = cathandle->lgh_hdr;
  3999. -   bitmap_size = LLOG_BITMAP_SIZE(llh);
  4000. -
  4001. -   index = (cathandle->lgh_last_idx + 1) % bitmap_size;
  4002. -
  4003. -   /* maximum number of available slots in catlog is bitmap_size - 2 */
  4004. -   if (llh->llh_cat_idx == index) {
  4005. -       CERROR("no free catalog slots for log...\n");
  4006. -       return -ENOSPC;
  4007. -   }
  4008. -
  4009. -   if (OBD_FAIL_CHECK(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
  4010. -       return -ENOSPC;
  4011. -
  4012. -   rc = llog_create(env, loghandle, th);
  4013. -   /* if llog is already created, no need to initialize it */
  4014. -   if (rc == -EEXIST) {
  4015. -       return 0;
  4016. -   } else if (rc != 0) {
  4017. -       CERROR("%s: can't create new plain llog in catalog: rc = %d\n",
  4018. -              loghandle->lgh_ctxt->loc_obd->obd_name, rc);
  4019. -       return rc;
  4020. -   }
  4021. -
  4022. -   rc = llog_init_handle(env, loghandle,
  4023. -                 LLOG_F_IS_PLAIN | LLOG_F_ZAP_WHEN_EMPTY,
  4024. -                 &cathandle->lgh_hdr->llh_tgtuuid);
  4025. -   if (rc)
  4026. -       goto out_destroy;
  4027. -
  4028. -   if (index == 0)
  4029. -       index = 1;
  4030. -
  4031. -   spin_lock(&loghandle->lgh_hdr_lock);
  4032. -   llh->llh_count++;
  4033. -   if (ext2_set_bit(index, llh->llh_bitmap)) {
  4034. -       CERROR("argh, index %u already set in log bitmap?\n",
  4035. -              index);
  4036. -       spin_unlock(&loghandle->lgh_hdr_lock);
  4037. -       LBUG(); /* should never happen */
  4038. -   }
  4039. -   spin_unlock(&loghandle->lgh_hdr_lock);
  4040. -
  4041. -   cathandle->lgh_last_idx = index;
  4042. -   llh->llh_tail.lrt_index = index;
  4043. -
  4044. -   CDEBUG(D_RPCTRACE,
  4045. -          "new recovery log "DOSTID":%x for index %u of catalog"
  4046. -          DOSTID"\n", POSTID(&loghandle->lgh_id.lgl_oi),
  4047. -          loghandle->lgh_id.lgl_ogen, index,
  4048. -          POSTID(&cathandle->lgh_id.lgl_oi));
  4049. -   /* build the record for this log in the catalog */
  4050. -   rec.lid_hdr.lrh_len = sizeof(rec);
  4051. -   rec.lid_hdr.lrh_index = index;
  4052. -   rec.lid_hdr.lrh_type = LLOG_LOGID_MAGIC;
  4053. -   rec.lid_id = loghandle->lgh_id;
  4054. -   rec.lid_tail.lrt_len = sizeof(rec);
  4055. -   rec.lid_tail.lrt_index = index;
  4056. -
  4057. -   /* update the catalog: header and record */
  4058. -   rc = llog_write_rec(env, cathandle, &rec.lid_hdr,
  4059. -               &loghandle->u.phd.phd_cookie, 1, NULL, index, th);
  4060. -   if (rc < 0)
  4061. -       goto out_destroy;
  4062. -
  4063. -   loghandle->lgh_hdr->llh_cat_idx = index;
  4064. -   return 0;
  4065. -out_destroy:
  4066. -   llog_destroy(env, loghandle);
  4067. -   return rc;
  4068. -}
  4069. -
  4070.  /* Open an existent log handle and add it to the open list.
  4071.   * This log handle will be closed when all of the records in it are removed.
  4072.   *
  4073. @@ -245,285 +158,6 @@ int llog_cat_close(const struct lu_env *env, struct llog_handle *cathandle)
  4074.  }
  4075.  EXPORT_SYMBOL(llog_cat_close);
  4076.  
  4077. -/**
  4078. - * lockdep markers for nested struct llog_handle::lgh_lock locking.
  4079. - */
  4080. -enum {
  4081. -   LLOGH_CAT,
  4082. -   LLOGH_LOG
  4083. -};
  4084. -
  4085. -/** Return the currently active log handle.  If the current log handle doesn't
  4086. - * have enough space left for the current record, start a new one.
  4087. - *
  4088. - * If reclen is 0, we only want to know what the currently active log is,
  4089. - * otherwise we get a lock on this log so nobody can steal our space.
  4090. - *
  4091. - * Assumes caller has already pushed us into the kernel context and is locking.
  4092. - *
  4093. - * NOTE: loghandle is write-locked upon successful return
  4094. - */
  4095. -static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle,
  4096. -                       struct thandle *th)
  4097. -{
  4098. -   struct llog_handle *loghandle = NULL;
  4099. -
  4100. -   down_read_nested(&cathandle->lgh_lock, LLOGH_CAT);
  4101. -   loghandle = cathandle->u.chd.chd_current_log;
  4102. -   if (loghandle) {
  4103. -       struct llog_log_hdr *llh;
  4104. -
  4105. -       down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
  4106. -       llh = loghandle->lgh_hdr;
  4107. -       if (llh == NULL ||
  4108. -           loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
  4109. -           up_read(&cathandle->lgh_lock);
  4110. -           return loghandle;
  4111. -       }
  4112. -       up_write(&loghandle->lgh_lock);
  4113. -   }
  4114. -   up_read(&cathandle->lgh_lock);
  4115. -
  4116. -   /* time to use next log */
  4117. -
  4118. -   /* first, we have to make sure the state hasn't changed */
  4119. -   down_write_nested(&cathandle->lgh_lock, LLOGH_CAT);
  4120. -   loghandle = cathandle->u.chd.chd_current_log;
  4121. -   if (loghandle) {
  4122. -       struct llog_log_hdr *llh;
  4123. -
  4124. -       down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
  4125. -       llh = loghandle->lgh_hdr;
  4126. -       LASSERT(llh);
  4127. -       if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
  4128. -           up_write(&cathandle->lgh_lock);
  4129. -           return loghandle;
  4130. -       }
  4131. -       up_write(&loghandle->lgh_lock);
  4132. -   }
  4133. -
  4134. -   CDEBUG(D_INODE, "use next log\n");
  4135. -
  4136. -   loghandle = cathandle->u.chd.chd_next_log;
  4137. -   cathandle->u.chd.chd_current_log = loghandle;
  4138. -   cathandle->u.chd.chd_next_log = NULL;
  4139. -   down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
  4140. -   up_write(&cathandle->lgh_lock);
  4141. -   LASSERT(loghandle);
  4142. -   return loghandle;
  4143. -}
  4144. -
  4145. -/* Add a single record to the recovery log(s) using a catalog
  4146. - * Returns as llog_write_record
  4147. - *
  4148. - * Assumes caller has already pushed us into the kernel context.
  4149. - */
  4150. -int llog_cat_add_rec(const struct lu_env *env, struct llog_handle *cathandle,
  4151. -            struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
  4152. -            void *buf, struct thandle *th)
  4153. -{
  4154. -   struct llog_handle *loghandle;
  4155. -   int rc;
  4156. -
  4157. -   LASSERT(rec->lrh_len <= LLOG_CHUNK_SIZE);
  4158. -   loghandle = llog_cat_current_log(cathandle, th);
  4159. -   LASSERT(!IS_ERR(loghandle));
  4160. -
  4161. -   /* loghandle is already locked by llog_cat_current_log() for us */
  4162. -   if (!llog_exist(loghandle)) {
  4163. -       rc = llog_cat_new_log(env, cathandle, loghandle, th);
  4164. -       if (rc < 0) {
  4165. -           up_write(&loghandle->lgh_lock);
  4166. -           return rc;
  4167. -       }
  4168. -   }
  4169. -   /* now let's try to add the record */
  4170. -   rc = llog_write_rec(env, loghandle, rec, reccookie, 1, buf, -1, th);
  4171. -   if (rc < 0)
  4172. -       CDEBUG_LIMIT(rc == -ENOSPC ? D_HA : D_ERROR,
  4173. -                "llog_write_rec %d: lh=%p\n", rc, loghandle);
  4174. -   up_write(&loghandle->lgh_lock);
  4175. -   if (rc == -ENOSPC) {
  4176. -       /* try to use next log */
  4177. -       loghandle = llog_cat_current_log(cathandle, th);
  4178. -       LASSERT(!IS_ERR(loghandle));
  4179. -       /* new llog can be created concurrently */
  4180. -       if (!llog_exist(loghandle)) {
  4181. -           rc = llog_cat_new_log(env, cathandle, loghandle, th);
  4182. -           if (rc < 0) {
  4183. -               up_write(&loghandle->lgh_lock);
  4184. -               return rc;
  4185. -           }
  4186. -       }
  4187. -       /* now let's try to add the record */
  4188. -       rc = llog_write_rec(env, loghandle, rec, reccookie, 1, buf,
  4189. -                   -1, th);
  4190. -       if (rc < 0)
  4191. -           CERROR("llog_write_rec %d: lh=%p\n", rc, loghandle);
  4192. -       up_write(&loghandle->lgh_lock);
  4193. -   }
  4194. -
  4195. -   return rc;
  4196. -}
  4197. -EXPORT_SYMBOL(llog_cat_add_rec);
  4198. -
  4199. -int llog_cat_declare_add_rec(const struct lu_env *env,
  4200. -                struct llog_handle *cathandle,
  4201. -                struct llog_rec_hdr *rec, struct thandle *th)
  4202. -{
  4203. -   struct llog_handle  *loghandle, *next;
  4204. -   int          rc = 0;
  4205. -
  4206. -   if (cathandle->u.chd.chd_current_log == NULL) {
  4207. -       /* declare new plain llog */
  4208. -       down_write(&cathandle->lgh_lock);
  4209. -       if (cathandle->u.chd.chd_current_log == NULL) {
  4210. -           rc = llog_open(env, cathandle->lgh_ctxt, &loghandle,
  4211. -                      NULL, NULL, LLOG_OPEN_NEW);
  4212. -           if (rc == 0) {
  4213. -               cathandle->u.chd.chd_current_log = loghandle;
  4214. -               list_add_tail(&loghandle->u.phd.phd_entry,
  4215. -                         &cathandle->u.chd.chd_head);
  4216. -           }
  4217. -       }
  4218. -       up_write(&cathandle->lgh_lock);
  4219. -   } else if (cathandle->u.chd.chd_next_log == NULL) {
  4220. -       /* declare next plain llog */
  4221. -       down_write(&cathandle->lgh_lock);
  4222. -       if (cathandle->u.chd.chd_next_log == NULL) {
  4223. -           rc = llog_open(env, cathandle->lgh_ctxt, &loghandle,
  4224. -                      NULL, NULL, LLOG_OPEN_NEW);
  4225. -           if (rc == 0) {
  4226. -               cathandle->u.chd.chd_next_log = loghandle;
  4227. -               list_add_tail(&loghandle->u.phd.phd_entry,
  4228. -                         &cathandle->u.chd.chd_head);
  4229. -           }
  4230. -       }
  4231. -       up_write(&cathandle->lgh_lock);
  4232. -   }
  4233. -   if (rc)
  4234. -       goto out;
  4235. -
  4236. -   if (!llog_exist(cathandle->u.chd.chd_current_log)) {
  4237. -       rc = llog_declare_create(env, cathandle->u.chd.chd_current_log,
  4238. -                    th);
  4239. -       if (rc)
  4240. -           goto out;
  4241. -       llog_declare_write_rec(env, cathandle, NULL, -1, th);
  4242. -   }
  4243. -   /* declare records in the llogs */
  4244. -   rc = llog_declare_write_rec(env, cathandle->u.chd.chd_current_log,
  4245. -                   rec, -1, th);
  4246. -   if (rc)
  4247. -       goto out;
  4248. -
  4249. -   next = cathandle->u.chd.chd_next_log;
  4250. -   if (next) {
  4251. -       if (!llog_exist(next)) {
  4252. -           rc = llog_declare_create(env, next, th);
  4253. -           llog_declare_write_rec(env, cathandle, NULL, -1, th);
  4254. -       }
  4255. -       llog_declare_write_rec(env, next, rec, -1, th);
  4256. -   }
  4257. -out:
  4258. -   return rc;
  4259. -}
  4260. -EXPORT_SYMBOL(llog_cat_declare_add_rec);
  4261. -
  4262. -int llog_cat_add(const struct lu_env *env, struct llog_handle *cathandle,
  4263. -        struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
  4264. -        void *buf)
  4265. -{
  4266. -   struct llog_ctxt    *ctxt;
  4267. -   struct dt_device    *dt;
  4268. -   struct thandle      *th = NULL;
  4269. -   int          rc;
  4270. -
  4271. -   ctxt = cathandle->lgh_ctxt;
  4272. -   LASSERT(ctxt);
  4273. -   LASSERT(ctxt->loc_exp);
  4274. -
  4275. -   if (cathandle->lgh_obj != NULL) {
  4276. -       dt = ctxt->loc_exp->exp_obd->obd_lvfs_ctxt.dt;
  4277. -       LASSERT(dt);
  4278. -
  4279. -       th = dt_trans_create(env, dt);
  4280. -       if (IS_ERR(th))
  4281. -           return PTR_ERR(th);
  4282. -
  4283. -       rc = llog_cat_declare_add_rec(env, cathandle, rec, th);
  4284. -       if (rc)
  4285. -           goto out_trans;
  4286. -
  4287. -       rc = dt_trans_start_local(env, dt, th);
  4288. -       if (rc)
  4289. -           goto out_trans;
  4290. -       rc = llog_cat_add_rec(env, cathandle, rec, reccookie, buf, th);
  4291. -out_trans:
  4292. -       dt_trans_stop(env, dt, th);
  4293. -   } else { /* lvfs compat code */
  4294. -       LASSERT(cathandle->lgh_file != NULL);
  4295. -       rc = llog_cat_declare_add_rec(env, cathandle, rec, th);
  4296. -       if (rc == 0)
  4297. -           rc = llog_cat_add_rec(env, cathandle, rec, reccookie,
  4298. -                         buf, th);
  4299. -   }
  4300. -   return rc;
  4301. -}
  4302. -EXPORT_SYMBOL(llog_cat_add);
  4303. -
  4304. -/* For each cookie in the cookie array, we clear the log in-use bit and either:
  4305. - * - the log is empty, so mark it free in the catalog header and delete it
  4306. - * - the log is not empty, just write out the log header
  4307. - *
  4308. - * The cookies may be in different log files, so we need to get new logs
  4309. - * each time.
  4310. - *
  4311. - * Assumes caller has already pushed us into the kernel context.
  4312. - */
  4313. -int llog_cat_cancel_records(const struct lu_env *env,
  4314. -               struct llog_handle *cathandle, int count,
  4315. -               struct llog_cookie *cookies)
  4316. -{
  4317. -   int i, index, rc = 0, failed = 0;
  4318. -
  4319. -   for (i = 0; i < count; i++, cookies++) {
  4320. -       struct llog_handle  *loghandle;
  4321. -       struct llog_logid   *lgl = &cookies->lgc_lgl;
  4322. -       int          lrc;
  4323. -
  4324. -       rc = llog_cat_id2handle(env, cathandle, &loghandle, lgl);
  4325. -       if (rc) {
  4326. -           CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
  4327. -                  cathandle->lgh_ctxt->loc_obd->obd_name,
  4328. -                  POSTID(&lgl->lgl_oi), rc);
  4329. -           failed++;
  4330. -           continue;
  4331. -       }
  4332. -
  4333. -       lrc = llog_cancel_rec(env, loghandle, cookies->lgc_index);
  4334. -       if (lrc == 1) {   /* log has been destroyed */
  4335. -           index = loghandle->u.phd.phd_cookie.lgc_index;
  4336. -           rc = llog_cat_cleanup(env, cathandle, loghandle,
  4337. -                         index);
  4338. -       } else if (lrc == -ENOENT) {
  4339. -           if (rc == 0) /* ENOENT shouldn't rewrite any error */
  4340. -               rc = lrc;
  4341. -       } else if (lrc < 0) {
  4342. -           failed++;
  4343. -           rc = lrc;
  4344. -       }
  4345. -       llog_handle_put(loghandle);
  4346. -   }
  4347. -   if (rc)
  4348. -       CERROR("%s: fail to cancel %d of %d llog-records: rc = %d\n",
  4349. -              cathandle->lgh_ctxt->loc_obd->obd_name, failed, count,
  4350. -              rc);
  4351. -
  4352. -   return rc;
  4353. -}
  4354. -EXPORT_SYMBOL(llog_cat_cancel_records);
  4355. -
  4356.  static int llog_cat_process_cb(const struct lu_env *env,
  4357.                    struct llog_handle *cat_llh,
  4358.                    struct llog_rec_hdr *rec, void *data)
  4359. @@ -620,76 +254,6 @@ int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
  4360.  }
  4361.  EXPORT_SYMBOL(llog_cat_process);
  4362.  
  4363. -static int llog_cat_reverse_process_cb(const struct lu_env *env,
  4364. -                      struct llog_handle *cat_llh,
  4365. -                      struct llog_rec_hdr *rec, void *data)
  4366. -{
  4367. -   struct llog_process_data *d = data;
  4368. -   struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
  4369. -   struct llog_handle *llh;
  4370. -   int rc;
  4371. -
  4372. -   if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) {
  4373. -       CERROR("invalid record in catalog\n");
  4374. -       return -EINVAL;
  4375. -   }
  4376. -   CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
  4377. -          DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
  4378. -          le32_to_cpu(rec->lrh_index), POSTID(&cat_llh->lgh_id.lgl_oi));
  4379. -
  4380. -   rc = llog_cat_id2handle(env, cat_llh, &llh, &lir->lid_id);
  4381. -   if (rc) {
  4382. -       CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
  4383. -              cat_llh->lgh_ctxt->loc_obd->obd_name,
  4384. -              POSTID(&lir->lid_id.lgl_oi), rc);
  4385. -       return rc;
  4386. -   }
  4387. -
  4388. -   rc = llog_reverse_process(env, llh, d->lpd_cb, d->lpd_data, NULL);
  4389. -   llog_handle_put(llh);
  4390. -   return rc;
  4391. -}
  4392. -
  4393. -int llog_cat_reverse_process(const struct lu_env *env,
  4394. -                struct llog_handle *cat_llh,
  4395. -                llog_cb_t cb, void *data)
  4396. -{
  4397. -   struct llog_process_data d;
  4398. -   struct llog_process_cat_data cd;
  4399. -   struct llog_log_hdr *llh = cat_llh->lgh_hdr;
  4400. -   int rc;
  4401. -
  4402. -   LASSERT(llh->llh_flags & LLOG_F_IS_CAT);
  4403. -   d.lpd_data = data;
  4404. -   d.lpd_cb = cb;
  4405. -
  4406. -   if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {
  4407. -       CWARN("catalog "DOSTID" crosses index zero\n",
  4408. -             POSTID(&cat_llh->lgh_id.lgl_oi));
  4409. -
  4410. -       cd.lpcd_first_idx = 0;
  4411. -       cd.lpcd_last_idx = cat_llh->lgh_last_idx;
  4412. -       rc = llog_reverse_process(env, cat_llh,
  4413. -                     llog_cat_reverse_process_cb,
  4414. -                     &d, &cd);
  4415. -       if (rc != 0)
  4416. -           return rc;
  4417. -
  4418. -       cd.lpcd_first_idx = le32_to_cpu(llh->llh_cat_idx);
  4419. -       cd.lpcd_last_idx = 0;
  4420. -       rc = llog_reverse_process(env, cat_llh,
  4421. -                     llog_cat_reverse_process_cb,
  4422. -                     &d, &cd);
  4423. -   } else {
  4424. -       rc = llog_reverse_process(env, cat_llh,
  4425. -                     llog_cat_reverse_process_cb,
  4426. -                     &d, NULL);
  4427. -   }
  4428. -
  4429. -   return rc;
  4430. -}
  4431. -EXPORT_SYMBOL(llog_cat_reverse_process);
  4432. -
  4433.  static int llog_cat_set_first_idx(struct llog_handle *cathandle, int index)
  4434.  {
  4435.     struct llog_log_hdr *llh = cathandle->lgh_hdr;
  4436. @@ -748,66 +312,3 @@ int llog_cat_cleanup(const struct lu_env *env, struct llog_handle *cathandle,
  4437.                index, POSTID(&cathandle->lgh_id.lgl_oi));
  4438.     return rc;
  4439.  }
  4440. -
  4441. -static int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle,
  4442. -         struct llog_rec_hdr *rec, void *data)
  4443. -{
  4444. -   struct llog_logid_rec   *lir = (struct llog_logid_rec *)rec;
  4445. -   struct llog_handle  *loghandle;
  4446. -   struct llog_log_hdr *llh;
  4447. -   int          rc;
  4448. -
  4449. -   if (rec->lrh_type != LLOG_LOGID_MAGIC) {
  4450. -       CERROR("invalid record in catalog\n");
  4451. -       return -EINVAL;
  4452. -   }
  4453. -
  4454. -   CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
  4455. -          DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
  4456. -          rec->lrh_index, POSTID(&cathandle->lgh_id.lgl_oi));
  4457. -
  4458. -   rc = llog_cat_id2handle(env, cathandle, &loghandle, &lir->lid_id);
  4459. -   if (rc) {
  4460. -       CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
  4461. -              cathandle->lgh_ctxt->loc_obd->obd_name,
  4462. -              POSTID(&lir->lid_id.lgl_oi), rc);
  4463. -       if (rc == -ENOENT || rc == -ESTALE) {
  4464. -           /* remove index from catalog */
  4465. -           llog_cat_cleanup(env, cathandle, NULL, rec->lrh_index);
  4466. -       }
  4467. -       return rc;
  4468. -   }
  4469. -
  4470. -   llh = loghandle->lgh_hdr;
  4471. -   if ((llh->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) &&
  4472. -       (llh->llh_count == 1)) {
  4473. -       rc = llog_destroy(env, loghandle);
  4474. -       if (rc)
  4475. -           CERROR("%s: fail to destroy empty log: rc = %d\n",
  4476. -                  loghandle->lgh_ctxt->loc_obd->obd_name, rc);
  4477. -
  4478. -       llog_cat_cleanup(env, cathandle, loghandle,
  4479. -                loghandle->u.phd.phd_cookie.lgc_index);
  4480. -   }
  4481. -   llog_handle_put(loghandle);
  4482. -
  4483. -   return rc;
  4484. -}
  4485. -
  4486. -/* helper to initialize catalog llog and process it to cancel */
  4487. -int llog_cat_init_and_process(const struct lu_env *env,
  4488. -                 struct llog_handle *llh)
  4489. -{
  4490. -   int rc;
  4491. -
  4492. -   rc = llog_init_handle(env, llh, LLOG_F_IS_CAT, NULL);
  4493. -   if (rc)
  4494. -       return rc;
  4495. -
  4496. -   rc = llog_process_or_fork(env, llh, cat_cancel_cb, NULL, NULL, false);
  4497. -   if (rc)
  4498. -       CERROR("%s: llog_process() with cat_cancel_cb failed: rc = %d\n",
  4499. -              llh->lgh_ctxt->loc_obd->obd_name, rc);
  4500. -   return 0;
  4501. -}
  4502. -EXPORT_SYMBOL(llog_cat_init_and_process);
  4503. diff --git a/drivers/staging/lustre/lustre/obdclass/llog_internal.h b/drivers/staging/lustre/lustre/obdclass/llog_internal.h
  4504. index c99e658e5657..533998688fb4 100644
  4505. --- a/drivers/staging/lustre/lustre/obdclass/llog_internal.h
  4506. +++ b/drivers/staging/lustre/lustre/obdclass/llog_internal.h
  4507. @@ -53,7 +53,6 @@ struct llog_process_info {
  4508.  struct llog_thread_info {
  4509.     struct lu_attr           lgi_attr;
  4510.     struct lu_fid            lgi_fid;
  4511. -   struct dt_object_format      lgi_dof;
  4512.     struct lu_buf            lgi_buf;
  4513.     loff_t               lgi_off;
  4514.     struct llog_rec_hdr      lgi_lrh;
  4515. @@ -62,15 +61,6 @@ struct llog_thread_info {
  4516.  
  4517.  extern struct lu_context_key llog_thread_key;
  4518.  
  4519. -static inline struct llog_thread_info *llog_info(const struct lu_env *env)
  4520. -{
  4521. -   struct llog_thread_info *lgi;
  4522. -
  4523. -   lgi = lu_context_key_get(&env->le_ctx, &llog_thread_key);
  4524. -   LASSERT(lgi);
  4525. -   return lgi;
  4526. -}
  4527. -
  4528.  int llog_info_init(void);
  4529.  void llog_info_fini(void);
  4530.  
  4531. diff --git a/drivers/staging/lustre/lustre/obdclass/llog_obd.c b/drivers/staging/lustre/lustre/obdclass/llog_obd.c
  4532. index 81ab27e7376f..2b4a70b6c8d4 100644
  4533. --- a/drivers/staging/lustre/lustre/obdclass/llog_obd.c
  4534. +++ b/drivers/staging/lustre/lustre/obdclass/llog_obd.c
  4535. @@ -212,36 +212,6 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
  4536.  }
  4537.  EXPORT_SYMBOL(llog_setup);
  4538.  
  4539. -int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags)
  4540. -{
  4541. -   int rc = 0;
  4542. -
  4543. -   if (!ctxt)
  4544. -       return 0;
  4545. -
  4546. -   if (CTXTP(ctxt, sync))
  4547. -       rc = CTXTP(ctxt, sync)(ctxt, exp, flags);
  4548. -
  4549. -   return rc;
  4550. -}
  4551. -EXPORT_SYMBOL(llog_sync);
  4552. -
  4553. -int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
  4554. -       struct llog_cookie *cookies, int flags)
  4555. -{
  4556. -   int rc;
  4557. -
  4558. -   if (!ctxt) {
  4559. -       CERROR("No ctxt\n");
  4560. -       return -ENODEV;
  4561. -   }
  4562. -
  4563. -   CTXT_CHECK_OP(ctxt, cancel, -EOPNOTSUPP);
  4564. -   rc = CTXTP(ctxt, cancel)(env, ctxt, cookies, flags);
  4565. -   return rc;
  4566. -}
  4567. -EXPORT_SYMBOL(llog_cancel);
  4568. -
  4569.  /* context key constructor/destructor: llog_key_init, llog_key_fini */
  4570.  LU_KEY_INIT_FINI(llog, struct llog_thread_info);
  4571.  /* context key: llog_thread_key */
  4572. diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
  4573. index 7cc0f54f9cd4..762100f41327 100644
  4574. --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
  4575. +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
  4576. @@ -264,36 +264,6 @@ struct dentry *ldebugfs_add_simple(struct dentry *root,
  4577.  }
  4578.  EXPORT_SYMBOL(ldebugfs_add_simple);
  4579.  
  4580. -struct dentry *ldebugfs_add_symlink(const char *name, struct dentry *parent,
  4581. -                   const char *format, ...)
  4582. -{
  4583. -   struct dentry *entry;
  4584. -   char *dest;
  4585. -   va_list ap;
  4586. -
  4587. -   if (parent == NULL || format == NULL)
  4588. -       return NULL;
  4589. -
  4590. -   dest = kzalloc(MAX_STRING_SIZE + 1, GFP_KERNEL);
  4591. -   if (!dest)
  4592. -       return NULL;
  4593. -
  4594. -   va_start(ap, format);
  4595. -   vsnprintf(dest, MAX_STRING_SIZE, format, ap);
  4596. -   va_end(ap);
  4597. -
  4598. -   entry = debugfs_create_symlink(name, parent, dest);
  4599. -   if (IS_ERR_OR_NULL(entry)) {
  4600. -       CERROR("LdebugFS: Could not create symbolic link from %s to %s",
  4601. -           name, dest);
  4602. -       entry = NULL;
  4603. -   }
  4604. -
  4605. -   kfree(dest);
  4606. -   return entry;
  4607. -}
  4608. -EXPORT_SYMBOL(ldebugfs_add_symlink);
  4609. -
  4610.  static struct file_operations lprocfs_generic_fops = { };
  4611.  
  4612.  int ldebugfs_add_vars(struct dentry *parent,
  4613. @@ -388,41 +358,6 @@ int lprocfs_wr_uint(struct file *file, const char __user *buffer,
  4614.  }
  4615.  EXPORT_SYMBOL(lprocfs_wr_uint);
  4616.  
  4617. -int lprocfs_rd_u64(struct seq_file *m, void *data)
  4618. -{
  4619. -   seq_printf(m, "%llu\n", *(__u64 *)data);
  4620. -   return 0;
  4621. -}
  4622. -EXPORT_SYMBOL(lprocfs_rd_u64);
  4623. -
  4624. -int lprocfs_rd_atomic(struct seq_file *m, void *data)
  4625. -{
  4626. -   atomic_t *atom = data;
  4627. -   LASSERT(atom != NULL);
  4628. -   seq_printf(m, "%d\n", atomic_read(atom));
  4629. -   return 0;
  4630. -}
  4631. -EXPORT_SYMBOL(lprocfs_rd_atomic);
  4632. -
  4633. -int lprocfs_wr_atomic(struct file *file, const char __user *buffer,
  4634. -             unsigned long count, void *data)
  4635. -{
  4636. -   atomic_t *atm = data;
  4637. -   int val = 0;
  4638. -   int rc;
  4639. -
  4640. -   rc = lprocfs_write_helper(buffer, count, &val);
  4641. -   if (rc < 0)
  4642. -       return rc;
  4643. -
  4644. -   if (val <= 0)
  4645. -       return -ERANGE;
  4646. -
  4647. -   atomic_set(atm, val);
  4648. -   return count;
  4649. -}
  4650. -EXPORT_SYMBOL(lprocfs_wr_atomic);
  4651. -
  4652.  static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr,
  4653.              char *buf)
  4654.  {
  4655. @@ -433,16 +368,6 @@ static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr,
  4656.  }
  4657.  LUSTRE_RO_ATTR(uuid);
  4658.  
  4659. -int lprocfs_rd_name(struct seq_file *m, void *data)
  4660. -{
  4661. -   struct obd_device *dev = data;
  4662. -
  4663. -   LASSERT(dev != NULL);
  4664. -   seq_printf(m, "%s\n", dev->obd_name);
  4665. -   return 0;
  4666. -}
  4667. -EXPORT_SYMBOL(lprocfs_rd_name);
  4668. -
  4669.  static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
  4670.                   char *buf)
  4671.  {
  4672. @@ -1299,227 +1224,6 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
  4673.  }
  4674.  EXPORT_SYMBOL(lprocfs_counter_init);
  4675.  
  4676. -#define LPROCFS_OBD_OP_INIT(base, stats, op)                  \
  4677. -do {                                      \
  4678. -   unsigned int coffset = base + OBD_COUNTER_OFFSET(op);         \
  4679. -   LASSERT(coffset < stats->ls_num);                 \
  4680. -   lprocfs_counter_init(stats, coffset, 0, #op, "reqs");         \
  4681. -} while (0)
  4682. -
  4683. -void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
  4684. -{
  4685. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, iocontrol);
  4686. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_info);
  4687. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, set_info_async);
  4688. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, attach);
  4689. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, detach);
  4690. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, setup);
  4691. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, precleanup);
  4692. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, cleanup);
  4693. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, process_config);
  4694. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, postrecov);
  4695. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, add_conn);
  4696. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, del_conn);
  4697. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, connect);
  4698. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, reconnect);
  4699. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, disconnect);
  4700. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_init);
  4701. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_fini);
  4702. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_alloc);
  4703. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs);
  4704. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs_async);
  4705. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, packmd);
  4706. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpackmd);
  4707. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, preallocate);
  4708. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, create);
  4709. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy);
  4710. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr);
  4711. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr_async);
  4712. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr);
  4713. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr_async);
  4714. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, adjust_kms);
  4715. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, preprw);
  4716. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, commitrw);
  4717. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, find_cbdata);
  4718. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export);
  4719. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy_export);
  4720. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
  4721. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
  4722. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, health_check);
  4723. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_uuid);
  4724. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotacheck);
  4725. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
  4726. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
  4727. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
  4728. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_add);
  4729. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_del);
  4730. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, getref);
  4731. -   LPROCFS_OBD_OP_INIT(num_private_stats, stats, putref);
  4732. -}
  4733. -EXPORT_SYMBOL(lprocfs_init_ops_stats);
  4734. -
  4735. -int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats)
  4736. -{
  4737. -   struct lprocfs_stats *stats;
  4738. -   unsigned int num_stats;
  4739. -   int rc, i;
  4740. -
  4741. -   LASSERT(obd->obd_stats == NULL);
  4742. -   LASSERT(obd->obd_debugfs_entry != NULL);
  4743. -   LASSERT(obd->obd_cntr_base == 0);
  4744. -
  4745. -   num_stats = ((int)sizeof(*obd->obd_type->typ_dt_ops) / sizeof(void *)) +
  4746. -       num_private_stats - 1 /* o_owner */;
  4747. -   stats = lprocfs_alloc_stats(num_stats, 0);
  4748. -   if (stats == NULL)
  4749. -       return -ENOMEM;
  4750. -
  4751. -   lprocfs_init_ops_stats(num_private_stats, stats);
  4752. -
  4753. -   for (i = num_private_stats; i < num_stats; i++) {
  4754. -       /* If this LBUGs, it is likely that an obd
  4755. -        * operation was added to struct obd_ops in
  4756. -        * <obd.h>, and that the corresponding line item
  4757. -        * LPROCFS_OBD_OP_INIT(.., .., opname)
  4758. -        * is missing from the list above. */
  4759. -       LASSERTF(stats->ls_cnt_header[i].lc_name != NULL,
  4760. -            "Missing obd_stat initializer obd_op operation at offset %d.\n",
  4761. -            i - num_private_stats);
  4762. -   }
  4763. -   rc = ldebugfs_register_stats(obd->obd_debugfs_entry, "stats", stats);
  4764. -   if (rc < 0) {
  4765. -       lprocfs_free_stats(&stats);
  4766. -   } else {
  4767. -       obd->obd_stats  = stats;
  4768. -       obd->obd_cntr_base = num_private_stats;
  4769. -   }
  4770. -   return rc;
  4771. -}
  4772. -EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
  4773. -
  4774. -void lprocfs_free_obd_stats(struct obd_device *obd)
  4775. -{
  4776. -   if (obd->obd_stats)
  4777. -       lprocfs_free_stats(&obd->obd_stats);
  4778. -}
  4779. -EXPORT_SYMBOL(lprocfs_free_obd_stats);
  4780. -
  4781. -#define LPROCFS_MD_OP_INIT(base, stats, op)                 \
  4782. -do {                                   \
  4783. -   unsigned int coffset = base + MD_COUNTER_OFFSET(op);        \
  4784. -   LASSERT(coffset < stats->ls_num);                  \
  4785. -   lprocfs_counter_init(stats, coffset, 0, #op, "reqs");      \
  4786. -} while (0)
  4787. -
  4788. -void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats)
  4789. -{
  4790. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, getstatus);
  4791. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, null_inode);
  4792. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, find_cbdata);
  4793. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, close);
  4794. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, create);
  4795. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, done_writing);
  4796. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, enqueue);
  4797. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, getattr);
  4798. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, getattr_name);
  4799. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, intent_lock);
  4800. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, link);
  4801. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, rename);
  4802. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, is_subdir);
  4803. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, setattr);
  4804. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, sync);
  4805. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, readpage);
  4806. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, unlink);
  4807. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, setxattr);
  4808. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, getxattr);
  4809. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, init_ea_size);
  4810. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, get_lustre_md);
  4811. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, free_lustre_md);
  4812. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, set_open_replay_data);
  4813. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, clear_open_replay_data);
  4814. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, set_lock_data);
  4815. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, lock_match);
  4816. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, cancel_unused);
  4817. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, renew_capa);
  4818. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, unpack_capa);
  4819. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, get_remote_perm);
  4820. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, intent_getattr_async);
  4821. -   LPROCFS_MD_OP_INIT(num_private_stats, stats, revalidate_lock);
  4822. -}
  4823. -EXPORT_SYMBOL(lprocfs_init_mps_stats);
  4824. -
  4825. -int lprocfs_alloc_md_stats(struct obd_device *obd,
  4826. -              unsigned num_private_stats)
  4827. -{
  4828. -   struct lprocfs_stats *stats;
  4829. -   unsigned int num_stats;
  4830. -   int rc, i;
  4831. -
  4832. -   LASSERT(obd->md_stats == NULL);
  4833. -   LASSERT(obd->obd_debugfs_entry != NULL);
  4834. -   LASSERT(obd->md_cntr_base == 0);
  4835. -
  4836. -   num_stats = 1 + MD_COUNTER_OFFSET(revalidate_lock) +
  4837. -           num_private_stats;
  4838. -   stats = lprocfs_alloc_stats(num_stats, 0);
  4839. -   if (stats == NULL)
  4840. -       return -ENOMEM;
  4841. -
  4842. -   lprocfs_init_mps_stats(num_private_stats, stats);
  4843. -
  4844. -   for (i = num_private_stats; i < num_stats; i++) {
  4845. -       if (stats->ls_cnt_header[i].lc_name == NULL) {
  4846. -           CERROR("Missing md_stat initializer md_op operation at offset %d. Aborting.\n",
  4847. -                  i - num_private_stats);
  4848. -           LBUG();
  4849. -       }
  4850. -   }
  4851. -   rc = ldebugfs_register_stats(obd->obd_debugfs_entry, "md_stats", stats);
  4852. -   if (rc < 0) {
  4853. -       lprocfs_free_stats(&stats);
  4854. -   } else {
  4855. -       obd->md_stats  = stats;
  4856. -       obd->md_cntr_base = num_private_stats;
  4857. -   }
  4858. -   return rc;
  4859. -}
  4860. -EXPORT_SYMBOL(lprocfs_alloc_md_stats);
  4861. -
  4862. -void lprocfs_free_md_stats(struct obd_device *obd)
  4863. -{
  4864. -   struct lprocfs_stats *stats = obd->md_stats;
  4865. -
  4866. -   if (stats != NULL) {
  4867. -       obd->md_stats = NULL;
  4868. -       obd->md_cntr_base = 0;
  4869. -       lprocfs_free_stats(&stats);
  4870. -   }
  4871. -}
  4872. -EXPORT_SYMBOL(lprocfs_free_md_stats);
  4873. -
  4874. -void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
  4875. -{
  4876. -   lprocfs_counter_init(ldlm_stats,
  4877. -                LDLM_ENQUEUE - LDLM_FIRST_OPC,
  4878. -                0, "ldlm_enqueue", "reqs");
  4879. -   lprocfs_counter_init(ldlm_stats,
  4880. -                LDLM_CONVERT - LDLM_FIRST_OPC,
  4881. -                0, "ldlm_convert", "reqs");
  4882. -   lprocfs_counter_init(ldlm_stats,
  4883. -                LDLM_CANCEL - LDLM_FIRST_OPC,
  4884. -                0, "ldlm_cancel", "reqs");
  4885. -   lprocfs_counter_init(ldlm_stats,
  4886. -                LDLM_BL_CALLBACK - LDLM_FIRST_OPC,
  4887. -                0, "ldlm_bl_callback", "reqs");
  4888. -   lprocfs_counter_init(ldlm_stats,
  4889. -                LDLM_CP_CALLBACK - LDLM_FIRST_OPC,
  4890. -                0, "ldlm_cp_callback", "reqs");
  4891. -   lprocfs_counter_init(ldlm_stats,
  4892. -                LDLM_GL_CALLBACK - LDLM_FIRST_OPC,
  4893. -                0, "ldlm_gl_callback", "reqs");
  4894. -}
  4895. -EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
  4896. -
  4897.  int lprocfs_exp_cleanup(struct obd_export *exp)
  4898.  {
  4899.     return 0;
  4900. @@ -1575,31 +1279,6 @@ int lprocfs_write_helper(const char __user *buffer, unsigned long count,
  4901.  }
  4902.  EXPORT_SYMBOL(lprocfs_write_helper);
  4903.  
  4904. -int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult)
  4905. -{
  4906. -   long decimal_val, frac_val;
  4907. -
  4908. -   decimal_val = val / mult;
  4909. -   seq_printf(m, "%ld", decimal_val);
  4910. -   frac_val = val % mult;
  4911. -
  4912. -   if (frac_val > 0) {
  4913. -       frac_val *= 100;
  4914. -       frac_val /= mult;
  4915. -   }
  4916. -   if (frac_val > 0) {
  4917. -       /* Three cases: x0, xx, 0x */
  4918. -       if ((frac_val % 10) != 0)
  4919. -           seq_printf(m, ".%ld", frac_val);
  4920. -       else
  4921. -           seq_printf(m, ".%ld", frac_val / 10);
  4922. -   }
  4923. -
  4924. -   seq_printf(m, "\n");
  4925. -   return 0;
  4926. -}
  4927. -EXPORT_SYMBOL(lprocfs_seq_read_frac_helper);
  4928. -
  4929.  int lprocfs_write_u64_helper(const char __user *buffer, unsigned long count,
  4930.                  __u64 *val)
  4931.  {
  4932. @@ -1787,19 +1466,6 @@ void lprocfs_oh_clear(struct obd_histogram *oh)
  4933.  }
  4934.  EXPORT_SYMBOL(lprocfs_oh_clear);
  4935.  
  4936. -int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data)
  4937. -{
  4938. -   struct obd_device *dev = data;
  4939. -   struct client_obd *cli = &dev->u.cli;
  4940. -
  4941. -   client_obd_list_lock(&cli->cl_loi_list_lock);
  4942. -   seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
  4943. -   client_obd_list_unlock(&cli->cl_loi_list_lock);
  4944. -
  4945. -   return 0;
  4946. -}
  4947. -EXPORT_SYMBOL(lprocfs_obd_rd_max_pages_per_rpc);
  4948. -
  4949.  ssize_t lustre_attr_show(struct kobject *kobj,
  4950.              struct attribute *attr, char *buf)
  4951.  {
  4952. diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c
  4953. index c892e8239e8d..01d70f029dc7 100644
  4954. --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
  4955. +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
  4956. @@ -157,17 +157,6 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o)
  4957.  EXPORT_SYMBOL(lu_object_put);
  4958.  
  4959.  /**
  4960. - * Put object and don't keep in cache. This is temporary solution for
  4961. - * multi-site objects when its layering is not constant.
  4962. - */
  4963. -void lu_object_put_nocache(const struct lu_env *env, struct lu_object *o)
  4964. -{
  4965. -   set_bit(LU_OBJECT_HEARD_BANSHEE, &o->lo_header->loh_flags);
  4966. -   return lu_object_put(env, o);
  4967. -}
  4968. -EXPORT_SYMBOL(lu_object_put_nocache);
  4969. -
  4970. -/**
  4971.   * Kill the object and take it out of LRU cache.
  4972.   * Currently used by client code for layout change.
  4973.   */
  4974. @@ -529,23 +518,6 @@ void lu_object_print(const struct lu_env *env, void *cookie,
  4975.  }
  4976.  EXPORT_SYMBOL(lu_object_print);
  4977.  
  4978. -/**
  4979. - * Check object consistency.
  4980. - */
  4981. -int lu_object_invariant(const struct lu_object *o)
  4982. -{
  4983. -   struct lu_object_header *top;
  4984. -
  4985. -   top = o->lo_header;
  4986. -   list_for_each_entry(o, &top->loh_layers, lo_linkage) {
  4987. -       if (o->lo_ops->loo_object_invariant != NULL &&
  4988. -           !o->lo_ops->loo_object_invariant(o))
  4989. -           return 0;
  4990. -   }
  4991. -   return 1;
  4992. -}
  4993. -EXPORT_SYMBOL(lu_object_invariant);
  4994. -
  4995.  static struct lu_object *htable_lookup(struct lu_site *s,
  4996.                        struct cfs_hash_bd *bd,
  4997.                        const struct lu_fid *f,
  4998. @@ -962,14 +934,6 @@ void lu_dev_add_linkage(struct lu_site *s, struct lu_device *d)
  4999.  }
  5000.  EXPORT_SYMBOL(lu_dev_add_linkage);
  5001.  
  5002. -void lu_dev_del_linkage(struct lu_site *s, struct lu_device *d)
  5003. -{
  5004. -   spin_lock(&s->ls_ld_lock);
  5005. -   list_del_init(&d->ld_linkage);
  5006. -   spin_unlock(&s->ls_ld_lock);
  5007. -}
  5008. -EXPORT_SYMBOL(lu_dev_del_linkage);
  5009. -
  5010.  /**
  5011.   * Initialize site \a s, with \a d as the top level device.
  5012.   */
  5013. @@ -1701,42 +1665,6 @@ EXPORT_SYMBOL(lu_context_refill);
  5014.  __u32 lu_context_tags_default;
  5015.  __u32 lu_session_tags_default;
  5016.  
  5017. -void lu_context_tags_update(__u32 tags)
  5018. -{
  5019. -   spin_lock(&lu_keys_guard);
  5020. -   lu_context_tags_default |= tags;
  5021. -   key_set_version++;
  5022. -   spin_unlock(&lu_keys_guard);
  5023. -}
  5024. -EXPORT_SYMBOL(lu_context_tags_update);
  5025. -
  5026. -void lu_context_tags_clear(__u32 tags)
  5027. -{
  5028. -   spin_lock(&lu_keys_guard);
  5029. -   lu_context_tags_default &= ~tags;
  5030. -   key_set_version++;
  5031. -   spin_unlock(&lu_keys_guard);
  5032. -}
  5033. -EXPORT_SYMBOL(lu_context_tags_clear);
  5034. -
  5035. -void lu_session_tags_update(__u32 tags)
  5036. -{
  5037. -   spin_lock(&lu_keys_guard);
  5038. -   lu_session_tags_default |= tags;
  5039. -   key_set_version++;
  5040. -   spin_unlock(&lu_keys_guard);
  5041. -}
  5042. -EXPORT_SYMBOL(lu_session_tags_update);
  5043. -
  5044. -void lu_session_tags_clear(__u32 tags)
  5045. -{
  5046. -   spin_lock(&lu_keys_guard);
  5047. -   lu_session_tags_default &= ~tags;
  5048. -   key_set_version++;
  5049. -   spin_unlock(&lu_keys_guard);
  5050. -}
  5051. -EXPORT_SYMBOL(lu_session_tags_clear);
  5052. -
  5053.  int lu_env_init(struct lu_env *env, __u32 tags)
  5054.  {
  5055.     int result;
  5056. @@ -1768,31 +1696,6 @@ int lu_env_refill(struct lu_env *env)
  5057.  }
  5058.  EXPORT_SYMBOL(lu_env_refill);
  5059.  
  5060. -/**
  5061. - * Currently, this API will only be used by echo client.
  5062. - * Because echo client and normal lustre client will share
  5063. - * same cl_env cache. So echo client needs to refresh
  5064. - * the env context after it get one from the cache, especially
  5065. - * when normal client and echo client co-exist in the same client.
  5066. - */
  5067. -int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags,
  5068. -             __u32 stags)
  5069. -{
  5070. -   if ((env->le_ctx.lc_tags & ctags) != ctags) {
  5071. -       env->le_ctx.lc_version = 0;
  5072. -       env->le_ctx.lc_tags |= ctags;
  5073. -   }
  5074. -
  5075. -   if (env->le_ses && (env->le_ses->lc_tags & stags) != stags) {
  5076. -       env->le_ses->lc_version = 0;
  5077. -       env->le_ses->lc_tags |= stags;
  5078. -   }
  5079. -
  5080. -   return lu_env_refill(env);
  5081. -}
  5082. -EXPORT_SYMBOL(lu_env_refill_by_tags);
  5083. -
  5084. -
  5085.  struct lu_site_stats {
  5086.     unsigned    lss_populated;
  5087.     unsigned    lss_max_search;
  5088. @@ -1904,29 +1807,9 @@ static unsigned long lu_cache_shrink_scan(struct shrinker *sk,
  5089.     return sc->nr_to_scan - remain;
  5090.  }
  5091.  
  5092. -/*
  5093. - * Debugging stuff.
  5094. - */
  5095. -
  5096. -/**
  5097. - * Environment to be used in debugger, contains all tags.
  5098. - */
  5099. -struct lu_env lu_debugging_env;
  5100. -
  5101.  /**
  5102.   * Debugging printer function using printk().
  5103.   */
  5104. -int lu_printk_printer(const struct lu_env *env,
  5105. -             void *unused, const char *format, ...)
  5106. -{
  5107. -   va_list args;
  5108. -
  5109. -   va_start(args, format);
  5110. -   vprintk(format, args);
  5111. -   va_end(args);
  5112. -   return 0;
  5113. -}
  5114. -
  5115.  static struct shrinker lu_site_shrinker = {
  5116.     .count_objects  = lu_cache_shrink_count,
  5117.     .scan_objects   = lu_cache_shrink_scan,
  5118. @@ -2069,127 +1952,3 @@ void lu_kmem_fini(struct lu_kmem_descr *caches)
  5119.     }
  5120.  }
  5121.  EXPORT_SYMBOL(lu_kmem_fini);
  5122. -
  5123. -/**
  5124. - * Temporary solution to be able to assign fid in ->do_create()
  5125. - * till we have fully-functional OST fids
  5126. - */
  5127. -void lu_object_assign_fid(const struct lu_env *env, struct lu_object *o,
  5128. -             const struct lu_fid *fid)
  5129. -{
  5130. -   struct lu_site      *s = o->lo_dev->ld_site;
  5131. -   struct lu_fid       *old = &o->lo_header->loh_fid;
  5132. -   struct lu_object    *shadow;
  5133. -   wait_queue_t         waiter;
  5134. -   struct cfs_hash     *hs;
  5135. -   struct cfs_hash_bd   bd;
  5136. -   __u64            version = 0;
  5137. -
  5138. -   LASSERT(fid_is_zero(old));
  5139. -
  5140. -   hs = s->ls_obj_hash;
  5141. -   cfs_hash_bd_get_and_lock(hs, (void *)fid, &bd, 1);
  5142. -   shadow = htable_lookup(s, &bd, fid, &waiter, &version);
  5143. -   /* supposed to be unique */
  5144. -   LASSERT(IS_ERR(shadow) && PTR_ERR(shadow) == -ENOENT);
  5145. -   *old = *fid;
  5146. -   cfs_hash_bd_add_locked(hs, &bd, &o->lo_header->loh_hash);
  5147. -   cfs_hash_bd_unlock(hs, &bd, 1);
  5148. -}
  5149. -EXPORT_SYMBOL(lu_object_assign_fid);
  5150. -
  5151. -/**
  5152. - * allocates object with 0 (non-assigned) fid
  5153. - * XXX: temporary solution to be able to assign fid in ->do_create()
  5154. - *      till we have fully-functional OST fids
  5155. - */
  5156. -struct lu_object *lu_object_anon(const struct lu_env *env,
  5157. -                struct lu_device *dev,
  5158. -                const struct lu_object_conf *conf)
  5159. -{
  5160. -   struct lu_fid     fid;
  5161. -   struct lu_object *o;
  5162. -
  5163. -   fid_zero(&fid);
  5164. -   o = lu_object_alloc(env, dev, &fid, conf);
  5165. -
  5166. -   return o;
  5167. -}
  5168. -EXPORT_SYMBOL(lu_object_anon);
  5169. -
  5170. -struct lu_buf LU_BUF_NULL = {
  5171. -   .lb_buf = NULL,
  5172. -   .lb_len = 0
  5173. -};
  5174. -EXPORT_SYMBOL(LU_BUF_NULL);
  5175. -
  5176. -void lu_buf_free(struct lu_buf *buf)
  5177. -{
  5178. -   LASSERT(buf);
  5179. -   if (buf->lb_buf) {
  5180. -       LASSERT(buf->lb_len > 0);
  5181. -       kvfree(buf->lb_buf);
  5182. -       buf->lb_buf = NULL;
  5183. -       buf->lb_len = 0;
  5184. -   }
  5185. -}
  5186. -EXPORT_SYMBOL(lu_buf_free);
  5187. -
  5188. -void lu_buf_alloc(struct lu_buf *buf, int size)
  5189. -{
  5190. -   LASSERT(buf);
  5191. -   LASSERT(buf->lb_buf == NULL);
  5192. -   LASSERT(buf->lb_len == 0);
  5193. -   buf->lb_buf = libcfs_kvzalloc(size, GFP_NOFS);
  5194. -   if (likely(buf->lb_buf))
  5195. -       buf->lb_len = size;
  5196. -}
  5197. -EXPORT_SYMBOL(lu_buf_alloc);
  5198. -
  5199. -void lu_buf_realloc(struct lu_buf *buf, int size)
  5200. -{
  5201. -   lu_buf_free(buf);
  5202. -   lu_buf_alloc(buf, size);
  5203. -}
  5204. -EXPORT_SYMBOL(lu_buf_realloc);
  5205. -
  5206. -struct lu_buf *lu_buf_check_and_alloc(struct lu_buf *buf, int len)
  5207. -{
  5208. -   if (buf->lb_buf == NULL && buf->lb_len == 0)
  5209. -       lu_buf_alloc(buf, len);
  5210. -
  5211. -   if ((len > buf->lb_len) && (buf->lb_buf != NULL))
  5212. -       lu_buf_realloc(buf, len);
  5213. -
  5214. -   return buf;
  5215. -}
  5216. -EXPORT_SYMBOL(lu_buf_check_and_alloc);
  5217. -
  5218. -/**
  5219. - * Increase the size of the \a buf.
  5220. - * preserves old data in buffer
  5221. - * old buffer remains unchanged on error
  5222. - * \retval 0 or -ENOMEM
  5223. - */
  5224. -int lu_buf_check_and_grow(struct lu_buf *buf, int len)
  5225. -{
  5226. -   char *ptr;
  5227. -
  5228. -   if (len <= buf->lb_len)
  5229. -       return 0;
  5230. -
  5231. -   ptr = libcfs_kvzalloc(len, GFP_NOFS);
  5232. -   if (ptr == NULL)
  5233. -       return -ENOMEM;
  5234. -
  5235. -   /* Free the old buf */
  5236. -   if (buf->lb_buf != NULL) {
  5237. -       memcpy(ptr, buf->lb_buf, buf->lb_len);
  5238. -       kvfree(buf->lb_buf);
  5239. -   }
  5240. -
  5241. -   buf->lb_buf = ptr;
  5242. -   buf->lb_len = len;
  5243. -   return 0;
  5244. -}
  5245. -EXPORT_SYMBOL(lu_buf_check_and_grow);
  5246. diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
  5247. index 97d79dab2835..d19ec15cb463 100644
  5248. --- a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
  5249. +++ b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c
  5250. @@ -134,19 +134,6 @@ void class_handle_unhash(struct portals_handle *h)
  5251.  }
  5252.  EXPORT_SYMBOL(class_handle_unhash);
  5253.  
  5254. -void class_handle_hash_back(struct portals_handle *h)
  5255. -{
  5256. -   struct handle_bucket *bucket;
  5257. -
  5258. -   bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK);
  5259. -
  5260. -   spin_lock(&bucket->lock);
  5261. -   list_add_rcu(&h->h_link, &bucket->head);
  5262. -   h->h_in = 1;
  5263. -   spin_unlock(&bucket->lock);
  5264. -}
  5265. -EXPORT_SYMBOL(class_handle_hash_back);
  5266. -
  5267.  void *class_handle2object(__u64 cookie)
  5268.  {
  5269.     struct handle_bucket *bucket;
  5270. diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c
  5271. index 3bbc80623b3a..4078a2d4b485 100644
  5272. --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
  5273. +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
  5274. @@ -71,114 +71,6 @@ int class_find_param(char *buf, char *key, char **valp)
  5275.  }
  5276.  EXPORT_SYMBOL(class_find_param);
  5277.  
  5278. -/**
  5279. - * Check whether the proc parameter \a param is an old parameter or not from
  5280. - * the array \a ptr which contains the mapping from old parameters to new ones.
  5281. - * If it's an old one, then return the pointer to the cfg_interop_param struc-
  5282. - * ture which contains both the old and new parameters.
  5283. - *
  5284. - * \param param            proc parameter
  5285. - * \param ptr          an array which contains the mapping from
  5286. - *             old parameters to new ones
  5287. - *
  5288. - * \retval valid-pointer   pointer to the cfg_interop_param structure
  5289. - *             which contains the old and new parameters
  5290. - * \retval NULL            \a param or \a ptr is NULL,
  5291. - *             or \a param is not an old parameter
  5292. - */
  5293. -struct cfg_interop_param *class_find_old_param(const char *param,
  5294. -                          struct cfg_interop_param *ptr)
  5295. -{
  5296. -   char *value = NULL;
  5297. -   int   name_len = 0;
  5298. -
  5299. -   if (!param || !ptr)
  5300. -       return NULL;
  5301. -
  5302. -   value = strchr(param, '=');
  5303. -   if (!value)
  5304. -       name_len = strlen(param);
  5305. -   else
  5306. -       name_len = value - param;
  5307. -
  5308. -   while (ptr->old_param != NULL) {
  5309. -       if (strncmp(param, ptr->old_param, name_len) == 0 &&
  5310. -           name_len == strlen(ptr->old_param))
  5311. -           return ptr;
  5312. -       ptr++;
  5313. -   }
  5314. -
  5315. -   return NULL;
  5316. -}
  5317. -EXPORT_SYMBOL(class_find_old_param);
  5318. -
  5319. -/**
  5320. - * Finds a parameter in \a params and copies it to \a copy.
  5321. - *
  5322. - * Leading spaces are skipped. Next space or end of string is the
  5323. - * parameter terminator with the exception that spaces inside single or double
  5324. - * quotes get included into a parameter. The parameter is copied into \a copy
  5325. - * which has to be allocated big enough by a caller, quotes are stripped in
  5326. - * the copy and the copy is terminated by 0.
  5327. - *
  5328. - * On return \a params is set to next parameter or to NULL if last
  5329. - * parameter is returned.
  5330. - *
  5331. - * \retval 0 if parameter is returned in \a copy
  5332. - * \retval 1 otherwise
  5333. - * \retval -EINVAL if unbalanced quota is found
  5334. - */
  5335. -int class_get_next_param(char **params, char *copy)
  5336. -{
  5337. -   char *q1, *q2, *str;
  5338. -   int len;
  5339. -
  5340. -   str = *params;
  5341. -   while (*str == ' ')
  5342. -       str++;
  5343. -
  5344. -   if (*str == '\0') {
  5345. -       *params = NULL;
  5346. -       return 1;
  5347. -   }
  5348. -
  5349. -   while (1) {
  5350. -       q1 = strpbrk(str, " '\"");
  5351. -       if (!q1) {
  5352. -           len = strlen(str);
  5353. -           memcpy(copy, str, len);
  5354. -           copy[len] = '\0';
  5355. -           *params = NULL;
  5356. -           return 0;
  5357. -       }
  5358. -       len = q1 - str;
  5359. -       if (*q1 == ' ') {
  5360. -           memcpy(copy, str, len);
  5361. -           copy[len] = '\0';
  5362. -           *params = str + len;
  5363. -           return 0;
  5364. -       }
  5365. -
  5366. -       memcpy(copy, str, len);
  5367. -       copy += len;
  5368. -
  5369. -       /* search for the matching closing quote */
  5370. -       str = q1 + 1;
  5371. -       q2 = strchr(str, *q1);
  5372. -       if (!q2) {
  5373. -           CERROR("Unbalanced quota in parameters: \"%s\"\n",
  5374. -                  *params);
  5375. -           return -EINVAL;
  5376. -       }
  5377. -       len = q2 - str;
  5378. -       memcpy(copy, str, len);
  5379. -       copy += len;
  5380. -       str = q2 + 1;
  5381. -   }
  5382. -   return 1;
  5383. -}
  5384. -EXPORT_SYMBOL(class_get_next_param);
  5385. -
  5386.  /* returns 0 if this is the first key in the buffer, else 1.
  5387.     valp points to first char after key. */
  5388.  int class_match_param(char *buf, char *key, char **valp)
  5389. @@ -278,52 +170,6 @@ int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh)
  5390.  }
  5391.  EXPORT_SYMBOL(class_parse_nid_quiet);
  5392.  
  5393. -int class_parse_net(char *buf, __u32 *net, char **endh)
  5394. -{
  5395. -   return class_parse_value(buf, CLASS_PARSE_NET, (void *)net, endh, 0);
  5396. -}
  5397. -EXPORT_SYMBOL(class_parse_net);
  5398. -
  5399. -/* 1 param contains key and match
  5400. - * 0 param contains key and not match
  5401. - * -1 param does not contain key
  5402. - */
  5403. -int class_match_nid(char *buf, char *key, lnet_nid_t nid)
  5404. -{
  5405. -   lnet_nid_t tmp;
  5406. -   int   rc = -1;
  5407. -
  5408. -   while (class_find_param(buf, key, &buf) == 0) {
  5409. -       /* please restrict to the nids pertaining to
  5410. -        * the specified nids */
  5411. -       while (class_parse_nid(buf, &tmp, &buf) == 0) {
  5412. -           if (tmp == nid)
  5413. -               return 1;
  5414. -       }
  5415. -       rc = 0;
  5416. -   }
  5417. -   return rc;
  5418. -}
  5419. -EXPORT_SYMBOL(class_match_nid);
  5420. -
  5421. -int class_match_net(char *buf, char *key, __u32 net)
  5422. -{
  5423. -   __u32 tmp;
  5424. -   int   rc = -1;
  5425. -
  5426. -   while (class_find_param(buf, key, &buf) == 0) {
  5427. -       /* please restrict to the nids pertaining to
  5428. -        * the specified networks */
  5429. -       while (class_parse_net(buf, &tmp, &buf) == 0) {
  5430. -           if (tmp == net)
  5431. -               return 1;
  5432. -       }
  5433. -       rc = 0;
  5434. -   }
  5435. -   return rc;
  5436. -}
  5437. -EXPORT_SYMBOL(class_match_net);
  5438. -
  5439.  /********************** class fns **********************/
  5440.  
  5441.  /**
  5442. @@ -939,78 +785,6 @@ void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg))
  5443.  }
  5444.  EXPORT_SYMBOL(lustre_register_client_process_config);
  5445.  
  5446. -/**
  5447. - * Rename the proc parameter in \a cfg with a new name \a new_name.
  5448. - *
  5449. - * \param cfg     config structure which contains the proc parameter
  5450. - * \param new_name new name of the proc parameter
  5451. - *
  5452. - * \retval valid-pointer    pointer to the newly-allocated config structure
  5453. - *             which contains the renamed proc parameter
  5454. - * \retval ERR_PTR(-EINVAL) if \a cfg or \a new_name is NULL, or \a cfg does
  5455. - *             not contain a proc parameter
  5456. - * \retval ERR_PTR(-ENOMEM) if memory allocation failure occurs
  5457. - */
  5458. -struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg,
  5459. -                    const char *new_name)
  5460. -{
  5461. -   struct lustre_cfg_bufs  *bufs = NULL;
  5462. -   struct lustre_cfg   *new_cfg = NULL;
  5463. -   char            *param = NULL;
  5464. -   char            *new_param = NULL;
  5465. -   char            *value = NULL;
  5466. -   int          name_len = 0;
  5467. -   int          new_len = 0;
  5468. -
  5469. -   if (!cfg || !new_name)
  5470. -       return ERR_PTR(-EINVAL);
  5471. -
  5472. -   param = lustre_cfg_string(cfg, 1);
  5473. -   if (!param)
  5474. -       return ERR_PTR(-EINVAL);
  5475. -
  5476. -   value = strchr(param, '=');
  5477. -   if (!value)
  5478. -       name_len = strlen(param);
  5479. -   else
  5480. -       name_len = value - param;
  5481. -
  5482. -   new_len = LUSTRE_CFG_BUFLEN(cfg, 1) + strlen(new_name) - name_len;
  5483. -
  5484. -   new_param = kzalloc(new_len, GFP_NOFS);
  5485. -   if (!new_param)
  5486. -       return ERR_PTR(-ENOMEM);
  5487. -
  5488. -   strcpy(new_param, new_name);
  5489. -   if (value != NULL)
  5490. -       strcat(new_param, value);
  5491. -
  5492. -   bufs = kzalloc(sizeof(*bufs), GFP_NOFS);
  5493. -   if (!bufs) {
  5494. -       kfree(new_param);
  5495. -       return ERR_PTR(-ENOMEM);
  5496. -   }
  5497. -
  5498. -   lustre_cfg_bufs_reset(bufs, NULL);
  5499. -   lustre_cfg_bufs_init(bufs, cfg);
  5500. -   lustre_cfg_bufs_set_string(bufs, 1, new_param);
  5501. -
  5502. -   new_cfg = lustre_cfg_new(cfg->lcfg_command, bufs);
  5503. -
  5504. -   kfree(new_param);
  5505. -   kfree(bufs);
  5506. -   if (!new_cfg)
  5507. -       return ERR_PTR(-ENOMEM);
  5508. -
  5509. -   new_cfg->lcfg_num = cfg->lcfg_num;
  5510. -   new_cfg->lcfg_flags = cfg->lcfg_flags;
  5511. -   new_cfg->lcfg_nid = cfg->lcfg_nid;
  5512. -   new_cfg->lcfg_nal = cfg->lcfg_nal;
  5513. -
  5514. -   return new_cfg;
  5515. -}
  5516. -EXPORT_SYMBOL(lustre_cfg_rename);
  5517. -
  5518.  static int process_param2_config(struct lustre_cfg *lcfg)
  5519.  {
  5520.     char *param = lustre_cfg_string(lcfg, 1);
  5521. @@ -1051,12 +825,6 @@ static int process_param2_config(struct lustre_cfg *lcfg)
  5522.     return rc;
  5523.  }
  5524.  
  5525. -void lustre_register_quota_process_config(int (*qpc)(struct lustre_cfg *lcfg))
  5526. -{
  5527. -   quota_process_config = qpc;
  5528. -}
  5529. -EXPORT_SYMBOL(lustre_register_quota_process_config);
  5530. -
  5531.  /** Process configuration commands given in lustre_cfg form.
  5532.   * These may come from direct calls (e.g. class_manual_cleanup)
  5533.   * or processing the config llog, or ioctl from lctl.
  5534. @@ -1647,31 +1415,6 @@ int class_config_dump_handler(const struct lu_env *env,
  5535.     return rc;
  5536.  }
  5537.  
  5538. -int class_config_dump_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
  5539. -              char *name, struct config_llog_instance *cfg)
  5540. -{
  5541. -   struct llog_handle  *llh;
  5542. -   int          rc;
  5543. -
  5544. -   LCONSOLE_INFO("Dumping config log %s\n", name);
  5545. -
  5546. -   rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
  5547. -   if (rc)
  5548. -       return rc;
  5549. -
  5550. -   rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
  5551. -   if (rc)
  5552. -       goto parse_out;
  5553. -
  5554. -   rc = llog_process(env, llh, class_config_dump_handler, cfg, NULL);
  5555. -parse_out:
  5556. -   llog_close(env, llh);
  5557. -
  5558. -   LCONSOLE_INFO("End config log %s\n", name);
  5559. -   return rc;
  5560. -}
  5561. -EXPORT_SYMBOL(class_config_dump_llog);
  5562. -
  5563.  /** Call class_cleanup and class_detach.
  5564.   * "Manual" only in the sense that we're faking lcfg commands.
  5565.   */
  5566. diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
  5567. index 16009a6867c9..bc15e1546844 100644
  5568. --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
  5569. +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
  5570. @@ -599,33 +599,6 @@ int server_name2fsname(const char *svname, char *fsname, const char **endptr)
  5571.  }
  5572.  EXPORT_SYMBOL(server_name2fsname);
  5573.  
  5574. -/**
  5575. - * Get service name (svname) from string
  5576. - * rc < 0 on error
  5577. - * if endptr isn't NULL it is set to end of fsname *
  5578. - */
  5579. -int server_name2svname(const char *label, char *svname, const char **endptr,
  5580. -              size_t svsize)
  5581. -{
  5582. -   int rc;
  5583. -   const char *dash;
  5584. -
  5585. -   /* We use server_name2fsname() just for parsing */
  5586. -   rc = server_name2fsname(label, NULL, &dash);
  5587. -   if (rc != 0)
  5588. -       return rc;
  5589. -
  5590. -   if (endptr != NULL)
  5591. -       *endptr = dash;
  5592. -
  5593. -   if (strlcpy(svname, dash + 1, svsize) >= svsize)
  5594. -       return -E2BIG;
  5595. -
  5596. -   return 0;
  5597. -}
  5598. -EXPORT_SYMBOL(server_name2svname);
  5599. -
  5600. -
  5601.  /* Get the index from the obd name.
  5602.     rc = server type, or
  5603.     rc < 0  on error
  5604. diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
  5605. index 307ffe347186..1a950fb8e769 100644
  5606. --- a/drivers/staging/lustre/lustre/obdclass/obdo.c
  5607. +++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
  5608. @@ -115,90 +115,6 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
  5609.  }
  5610.  EXPORT_SYMBOL(obdo_from_inode);
  5611.  
  5612. -void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid)
  5613. -{
  5614. -   CDEBUG(D_INODE, "src obdo "DOSTID" valid %#llx, dst obdo "DOSTID"\n",
  5615. -          POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi));
  5616. -   if (valid & OBD_MD_FLATIME)
  5617. -       dst->o_atime = src->o_atime;
  5618. -   if (valid & OBD_MD_FLMTIME)
  5619. -       dst->o_mtime = src->o_mtime;
  5620. -   if (valid & OBD_MD_FLCTIME)
  5621. -       dst->o_ctime = src->o_ctime;
  5622. -   if (valid & OBD_MD_FLSIZE)
  5623. -       dst->o_size = src->o_size;
  5624. -   if (valid & OBD_MD_FLBLOCKS) /* allocation of space */
  5625. -       dst->o_blocks = src->o_blocks;
  5626. -   if (valid & OBD_MD_FLBLKSZ)
  5627. -       dst->o_blksize = src->o_blksize;
  5628. -   if (valid & OBD_MD_FLTYPE)
  5629. -       dst->o_mode = (dst->o_mode & ~S_IFMT) | (src->o_mode & S_IFMT);
  5630. -   if (valid & OBD_MD_FLMODE)
  5631. -       dst->o_mode = (dst->o_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
  5632. -   if (valid & OBD_MD_FLUID)
  5633. -       dst->o_uid = src->o_uid;
  5634. -   if (valid & OBD_MD_FLGID)
  5635. -       dst->o_gid = src->o_gid;
  5636. -   if (valid & OBD_MD_FLFLAGS)
  5637. -       dst->o_flags = src->o_flags;
  5638. -   if (valid & OBD_MD_FLFID) {
  5639. -       dst->o_parent_seq = src->o_parent_seq;
  5640. -       dst->o_parent_ver = src->o_parent_ver;
  5641. -   }
  5642. -   if (valid & OBD_MD_FLGENER)
  5643. -       dst->o_parent_oid = src->o_parent_oid;
  5644. -   if (valid & OBD_MD_FLHANDLE)
  5645. -       dst->o_handle = src->o_handle;
  5646. -   if (valid & OBD_MD_FLCOOKIE)
  5647. -       dst->o_lcookie = src->o_lcookie;
  5648. -
  5649. -   dst->o_valid |= valid;
  5650. -}
  5651. -EXPORT_SYMBOL(obdo_cpy_md);
  5652. -
  5653. -/* returns FALSE if comparison (by flags) is same, TRUE if changed */
  5654. -int obdo_cmp_md(struct obdo *dst, struct obdo *src, u32 compare)
  5655. -{
  5656. -   int res = 0;
  5657. -
  5658. -   if (compare & OBD_MD_FLATIME)
  5659. -       res |= dst->o_atime != src->o_atime;
  5660. -   if (compare & OBD_MD_FLMTIME)
  5661. -       res |= dst->o_mtime != src->o_mtime;
  5662. -   if (compare & OBD_MD_FLCTIME)
  5663. -       res |= dst->o_ctime != src->o_ctime;
  5664. -   if (compare & OBD_MD_FLSIZE)
  5665. -       res |= dst->o_size != src->o_size;
  5666. -   if (compare & OBD_MD_FLBLOCKS) /* allocation of space */
  5667. -       res |= dst->o_blocks != src->o_blocks;
  5668. -   if (compare & OBD_MD_FLBLKSZ)
  5669. -       res |= dst->o_blksize != src->o_blksize;
  5670. -   if (compare & OBD_MD_FLTYPE)
  5671. -       res |= ((dst->o_mode ^ src->o_mode) & S_IFMT) != 0;
  5672. -   if (compare & OBD_MD_FLMODE)
  5673. -       res |= ((dst->o_mode ^ src->o_mode) & ~S_IFMT) != 0;
  5674. -   if (compare & OBD_MD_FLUID)
  5675. -       res |= dst->o_uid != src->o_uid;
  5676. -   if (compare & OBD_MD_FLGID)
  5677. -       res |= dst->o_gid != src->o_gid;
  5678. -   if (compare & OBD_MD_FLFLAGS)
  5679. -       res |= dst->o_flags != src->o_flags;
  5680. -   if (compare & OBD_MD_FLNLINK)
  5681. -       res |= dst->o_nlink != src->o_nlink;
  5682. -   if (compare & OBD_MD_FLFID) {
  5683. -       res |= dst->o_parent_seq != src->o_parent_seq;
  5684. -       res |= dst->o_parent_ver != src->o_parent_ver;
  5685. -   }
  5686. -   if (compare & OBD_MD_FLGENER)
  5687. -       res |= dst->o_parent_oid != src->o_parent_oid;
  5688. -   /* XXX Don't know if these should be included here - wasn't previously
  5689. -   if ( compare & OBD_MD_FLINLINE )
  5690. -       res |= memcmp(dst->o_inline, src->o_inline);
  5691. -   */
  5692. -   return res;
  5693. -}
  5694. -EXPORT_SYMBOL(obdo_cmp_md);
  5695. -
  5696.  void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj)
  5697.  {
  5698.     ioobj->ioo_oid = oa->o_oi;
  5699. @@ -211,42 +127,6 @@ void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj)
  5700.  }
  5701.  EXPORT_SYMBOL(obdo_to_ioobj);
  5702.  
  5703. -void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned int ia_valid)
  5704. -{
  5705. -   if (ia_valid & ATTR_ATIME) {
  5706. -       oa->o_atime = LTIME_S(attr->ia_atime);
  5707. -       oa->o_valid |= OBD_MD_FLATIME;
  5708. -   }
  5709. -   if (ia_valid & ATTR_MTIME) {
  5710. -       oa->o_mtime = LTIME_S(attr->ia_mtime);
  5711. -       oa->o_valid |= OBD_MD_FLMTIME;
  5712. -   }
  5713. -   if (ia_valid & ATTR_CTIME) {
  5714. -       oa->o_ctime = LTIME_S(attr->ia_ctime);
  5715. -       oa->o_valid |= OBD_MD_FLCTIME;
  5716. -   }
  5717. -   if (ia_valid & ATTR_SIZE) {
  5718. -       oa->o_size = attr->ia_size;
  5719. -       oa->o_valid |= OBD_MD_FLSIZE;
  5720. -   }
  5721. -   if (ia_valid & ATTR_MODE) {
  5722. -       oa->o_mode = attr->ia_mode;
  5723. -       oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
  5724. -       if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
  5725. -           !capable(CFS_CAP_FSETID))
  5726. -           oa->o_mode &= ~S_ISGID;
  5727. -   }
  5728. -   if (ia_valid & ATTR_UID) {
  5729. -       oa->o_uid = from_kuid(&init_user_ns, attr->ia_uid);
  5730. -       oa->o_valid |= OBD_MD_FLUID;
  5731. -   }
  5732. -   if (ia_valid & ATTR_GID) {
  5733. -       oa->o_gid = from_kgid(&init_user_ns, attr->ia_gid);
  5734. -       oa->o_valid |= OBD_MD_FLGID;
  5735. -   }
  5736. -}
  5737. -EXPORT_SYMBOL(obdo_from_iattr);
  5738. -
  5739.  void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid)
  5740.  {
  5741.     valid &= oa->o_valid;
  5742. @@ -310,53 +190,3 @@ void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid)
  5743.     }
  5744.  }
  5745.  EXPORT_SYMBOL(md_from_obdo);
  5746. -
  5747. -void obdo_from_md(struct obdo *oa, struct md_op_data *op_data,
  5748. -         unsigned int valid)
  5749. -{
  5750. -   obdo_from_iattr(oa, &op_data->op_attr, valid);
  5751. -   if (valid & ATTR_BLOCKS) {
  5752. -       oa->o_blocks = op_data->op_attr_blocks;
  5753. -       oa->o_valid |= OBD_MD_FLBLOCKS;
  5754. -   }
  5755. -   if (valid & ATTR_ATTR_FLAG) {
  5756. -       oa->o_flags =
  5757. -           ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
  5758. -       oa->o_valid |= OBD_MD_FLFLAGS;
  5759. -   }
  5760. -}
  5761. -EXPORT_SYMBOL(obdo_from_md);
  5762. -
  5763. -void obdo_cpu_to_le(struct obdo *dobdo, struct obdo *sobdo)
  5764. -{
  5765. -   dobdo->o_size = cpu_to_le64(sobdo->o_size);
  5766. -   dobdo->o_mtime = cpu_to_le64(sobdo->o_mtime);
  5767. -   dobdo->o_atime = cpu_to_le64(sobdo->o_atime);
  5768. -   dobdo->o_ctime = cpu_to_le64(sobdo->o_ctime);
  5769. -   dobdo->o_blocks = cpu_to_le64(sobdo->o_blocks);
  5770. -   dobdo->o_mode = cpu_to_le32(sobdo->o_mode);
  5771. -   dobdo->o_uid = cpu_to_le32(sobdo->o_uid);
  5772. -   dobdo->o_gid = cpu_to_le32(sobdo->o_gid);
  5773. -   dobdo->o_flags = cpu_to_le32(sobdo->o_flags);
  5774. -   dobdo->o_nlink = cpu_to_le32(sobdo->o_nlink);
  5775. -   dobdo->o_blksize = cpu_to_le32(sobdo->o_blksize);
  5776. -   dobdo->o_valid = cpu_to_le64(sobdo->o_valid);
  5777. -}
  5778. -EXPORT_SYMBOL(obdo_cpu_to_le);
  5779. -
  5780. -void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo)
  5781. -{
  5782. -   dobdo->o_size = le64_to_cpu(sobdo->o_size);
  5783. -   dobdo->o_mtime = le64_to_cpu(sobdo->o_mtime);
  5784. -   dobdo->o_atime = le64_to_cpu(sobdo->o_atime);
  5785. -   dobdo->o_ctime = le64_to_cpu(sobdo->o_ctime);
  5786. -   dobdo->o_blocks = le64_to_cpu(sobdo->o_blocks);
  5787. -   dobdo->o_mode = le32_to_cpu(sobdo->o_mode);
  5788. -   dobdo->o_uid = le32_to_cpu(sobdo->o_uid);
  5789. -   dobdo->o_gid = le32_to_cpu(sobdo->o_gid);
  5790. -   dobdo->o_flags = le32_to_cpu(sobdo->o_flags);
  5791. -   dobdo->o_nlink = le32_to_cpu(sobdo->o_nlink);
  5792. -   dobdo->o_blksize = le32_to_cpu(sobdo->o_blksize);
  5793. -   dobdo->o_valid = le64_to_cpu(sobdo->o_valid);
  5794. -}
  5795. -EXPORT_SYMBOL(obdo_le_to_cpu);
  5796. diff --git a/drivers/staging/lustre/lustre/obdclass/statfs_pack.c b/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
  5797. index cc785ab3f29a..fb4e3ae845e0 100644
  5798. --- a/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
  5799. +++ b/drivers/staging/lustre/lustre/obdclass/statfs_pack.c
  5800. @@ -46,20 +46,6 @@
  5801.  #include "../include/obd_support.h"
  5802.  #include "../include/obd_class.h"
  5803.  
  5804. -void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs)
  5805. -{
  5806. -   memset(osfs, 0, sizeof(*osfs));
  5807. -   osfs->os_type = sfs->f_type;
  5808. -   osfs->os_blocks = sfs->f_blocks;
  5809. -   osfs->os_bfree = sfs->f_bfree;
  5810. -   osfs->os_bavail = sfs->f_bavail;
  5811. -   osfs->os_files = sfs->f_files;
  5812. -   osfs->os_ffree = sfs->f_ffree;
  5813. -   osfs->os_bsize = sfs->f_bsize;
  5814. -   osfs->os_namelen = sfs->f_namelen;
  5815. -}
  5816. -EXPORT_SYMBOL(statfs_pack);
  5817. -
  5818.  void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs)
  5819.  {
  5820.     memset(sfs, 0, sizeof(*sfs));
  5821. diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
  5822. index d013d4b512ce..6aaa5dd55a92 100644
  5823. --- a/drivers/staging/lustre/lustre/ptlrpc/client.c
  5824. +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
  5825. @@ -802,48 +802,6 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp,
  5826.  EXPORT_SYMBOL(ptlrpc_request_alloc_pack);
  5827.  
  5828.  /**
  5829. - * Prepare request (fetched from pool \a pool if not NULL) on import \a imp
  5830. - * for operation \a opcode. Request would contain \a count buffers.
  5831. - * Sizes of buffers are described in array \a lengths and buffers themselves
  5832. - * are provided by a pointer \a bufs.
  5833. - * Returns prepared request structure pointer or NULL on error.
  5834. - */
  5835. -struct ptlrpc_request *
  5836. -ptlrpc_prep_req_pool(struct obd_import *imp,
  5837. -            __u32 version, int opcode,
  5838. -            int count, __u32 *lengths, char **bufs,
  5839. -            struct ptlrpc_request_pool *pool)
  5840. -{
  5841. -   struct ptlrpc_request *request;
  5842. -   int rc;
  5843. -
  5844. -   request = __ptlrpc_request_alloc(imp, pool);
  5845. -   if (!request)
  5846. -       return NULL;
  5847. -
  5848. -   rc = __ptlrpc_request_bufs_pack(request, version, opcode, count,
  5849. -                   lengths, bufs, NULL);
  5850. -   if (rc) {
  5851. -       ptlrpc_request_free(request);
  5852. -       request = NULL;
  5853. -   }
  5854. -   return request;
  5855. -}
  5856. -EXPORT_SYMBOL(ptlrpc_prep_req_pool);
  5857. -
  5858. -/**
  5859. - * Same as ptlrpc_prep_req_pool, but without pool
  5860. - */
  5861. -struct ptlrpc_request *
  5862. -ptlrpc_prep_req(struct obd_import *imp, __u32 version, int opcode, int count,
  5863. -       __u32 *lengths, char **bufs)
  5864. -{
  5865. -   return ptlrpc_prep_req_pool(imp, version, opcode, count, lengths, bufs,
  5866. -                   NULL);
  5867. -}
  5868. -EXPORT_SYMBOL(ptlrpc_prep_req);
  5869. -
  5870. -/**
  5871.   * Allocate and initialize new request set structure on the current CPT.
  5872.   * Returns a pointer to the newly allocated set structure or NULL on error.
  5873.   */
  5874. @@ -959,28 +917,6 @@ void ptlrpc_set_destroy(struct ptlrpc_request_set *set)
  5875.  EXPORT_SYMBOL(ptlrpc_set_destroy);
  5876.  
  5877.  /**
  5878. - * Add a callback function \a fn to the set.
  5879. - * This function would be called when all requests on this set are completed.
  5880. - * The function will be passed \a data argument.
  5881. - */
  5882. -int ptlrpc_set_add_cb(struct ptlrpc_request_set *set,
  5883. -             set_interpreter_func fn, void *data)
  5884. -{
  5885. -   struct ptlrpc_set_cbdata *cbdata;
  5886. -
  5887. -   cbdata = kzalloc(sizeof(*cbdata), GFP_NOFS);
  5888. -   if (!cbdata)
  5889. -       return -ENOMEM;
  5890. -
  5891. -   cbdata->psc_interpret = fn;
  5892. -   cbdata->psc_data = data;
  5893. -   list_add_tail(&cbdata->psc_item, &set->set_cblist);
  5894. -
  5895. -   return 0;
  5896. -}
  5897. -EXPORT_SYMBOL(ptlrpc_set_add_cb);
  5898. -
  5899. -/**
  5900.   * Add a new request to the general purpose request set.
  5901.   * Assumes request reference from the caller.
  5902.   */
  5903. @@ -2282,18 +2218,6 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)
  5904.         ptlrpc_request_cache_free(request);
  5905.  }
  5906.  
  5907. -static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked);
  5908. -/**
  5909. - * Drop one request reference. Must be called with import imp_lock held.
  5910. - * When reference count drops to zero, request is freed.
  5911. - */
  5912. -void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request)
  5913. -{
  5914. -   assert_spin_locked(&request->rq_import->imp_lock);
  5915. -   (void)__ptlrpc_req_finished(request, 1);
  5916. -}
  5917. -EXPORT_SYMBOL(ptlrpc_req_finished_with_imp_lock);
  5918. -
  5919.  /**
  5920.   * Helper function
  5921.   * Drops one reference count for request \a request.
  5922. @@ -2535,11 +2459,6 @@ free_req:
  5923.     }
  5924.  }
  5925.  
  5926. -void ptlrpc_cleanup_client(struct obd_import *imp)
  5927. -{
  5928. -}
  5929. -EXPORT_SYMBOL(ptlrpc_cleanup_client);
  5930. -
  5931.  /**
  5932.   * Schedule previously sent request for resend.
  5933.   * For bulk requests we assign new xid (to avoid problems with
  5934. @@ -2578,20 +2497,6 @@ void ptlrpc_resend_req(struct ptlrpc_request *req)
  5935.  }
  5936.  EXPORT_SYMBOL(ptlrpc_resend_req);
  5937.  
  5938. -/* XXX: this function and rq_status are currently unused */
  5939. -void ptlrpc_restart_req(struct ptlrpc_request *req)
  5940. -{
  5941. -   DEBUG_REQ(D_HA, req, "restarting (possibly-)completed request");
  5942. -   req->rq_status = -ERESTARTSYS;
  5943. -
  5944. -   spin_lock(&req->rq_lock);
  5945. -   req->rq_restart = 1;
  5946. -   req->rq_timedout = 0;
  5947. -   ptlrpc_client_wake_req(req);
  5948. -   spin_unlock(&req->rq_lock);
  5949. -}
  5950. -EXPORT_SYMBOL(ptlrpc_restart_req);
  5951. -
  5952.  /**
  5953.   * Grab additional reference on a request \a req
  5954.   */
  5955. diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c
  5956. index 9ff1a22b1b67..1ac265dfce2f 100644
  5957. --- a/drivers/staging/lustre/lustre/ptlrpc/import.c
  5958. +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c
  5959. @@ -142,7 +142,6 @@ void deuuidify(char *uuid, const char *prefix, char **uuid_start, int *uuid_len)
  5960.             UUID_STR, strlen(UUID_STR)))
  5961.         *uuid_len -= strlen(UUID_STR);
  5962.  }
  5963. -EXPORT_SYMBOL(deuuidify);
  5964.  
  5965.  /**
  5966.   * Returns true if import was FULL, false if import was already not
  5967. @@ -1503,16 +1502,6 @@ out:
  5968.  }
  5969.  EXPORT_SYMBOL(ptlrpc_disconnect_import);
  5970.  
  5971. -void ptlrpc_cleanup_imp(struct obd_import *imp)
  5972. -{
  5973. -   spin_lock(&imp->imp_lock);
  5974. -   IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_CLOSED);
  5975. -   imp->imp_generation++;
  5976. -   spin_unlock(&imp->imp_lock);
  5977. -   ptlrpc_abort_inflight(imp);
  5978. -}
  5979. -EXPORT_SYMBOL(ptlrpc_cleanup_imp);
  5980. -
  5981.  /* Adaptive Timeout utils */
  5982.  extern unsigned int at_min, at_max, at_history;
  5983.  
  5984. diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c
  5985. index 5d19cfcfe7e9..991fb74c8d08 100644
  5986. --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c
  5987. +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c
  5988. @@ -1996,55 +1996,6 @@ static void *__req_capsule_get(struct req_capsule *pill,
  5989.  }
  5990.  
  5991.  /**
  5992. - * Dump a request and/or reply
  5993. - */
  5994. -static void __req_capsule_dump(struct req_capsule *pill, enum req_location loc)
  5995. -{
  5996. -   const struct req_format *fmt;
  5997. -   const struct req_msg_field *field;
  5998. -   int len;
  5999. -   int i;
  6000. -
  6001. -   fmt = pill->rc_fmt;
  6002. -
  6003. -   DEBUG_REQ(D_RPCTRACE, pill->rc_req, "BEGIN REQ CAPSULE DUMP\n");
  6004. -   for (i = 0; i < fmt->rf_fields[loc].nr; ++i) {
  6005. -       field = FMT_FIELD(fmt, loc, i);
  6006. -       if (field->rmf_dumper == NULL) {
  6007. -           /*
  6008. -            * FIXME Add a default hex dumper for fields that don't
  6009. -            * have a specific dumper
  6010. -            */
  6011. -           len = req_capsule_get_size(pill, field, loc);
  6012. -           CDEBUG(D_RPCTRACE, "Field %s has no dumper function; field size is %d\n",
  6013. -                  field->rmf_name, len);
  6014. -       } else {
  6015. -           /* It's the dumping side-effect that we're interested in */
  6016. -           (void) __req_capsule_get(pill, field, loc, NULL, 1);
  6017. -       }
  6018. -   }
  6019. -   CDEBUG(D_RPCTRACE, "END REQ CAPSULE DUMP\n");
  6020. -}
  6021. -
  6022. -/**
  6023. - * Dump a request.
  6024. - */
  6025. -void req_capsule_client_dump(struct req_capsule *pill)
  6026. -{
  6027. -   __req_capsule_dump(pill, RCL_CLIENT);
  6028. -}
  6029. -EXPORT_SYMBOL(req_capsule_client_dump);
  6030. -
  6031. -/**
  6032. - * Dump a reply
  6033. - */
  6034. -void req_capsule_server_dump(struct req_capsule *pill)
  6035. -{
  6036. -   __req_capsule_dump(pill, RCL_SERVER);
  6037. -}
  6038. -EXPORT_SYMBOL(req_capsule_server_dump);
  6039. -
  6040. -/**
  6041.   * Trivial wrapper around __req_capsule_get(), that returns the PTLRPC request
  6042.   * buffer corresponding to the given RMF (\a field) of a \a pill.
  6043.   */
  6044. @@ -2136,21 +2087,6 @@ void *req_capsule_server_sized_swab_get(struct req_capsule *pill,
  6045.  EXPORT_SYMBOL(req_capsule_server_sized_swab_get);
  6046.  
  6047.  /**
  6048. - * Returns the buffer of a \a pill corresponding to the given \a field from the
  6049. - * request (if the caller is executing on the server-side) or reply (if the
  6050. - * caller is executing on the client-side).
  6051. - *
  6052. - * This function convenient for use is code that could be executed on the
  6053. - * client and server alike.
  6054. - */
  6055. -const void *req_capsule_other_get(struct req_capsule *pill,
  6056. -                 const struct req_msg_field *field)
  6057. -{
  6058. -   return __req_capsule_get(pill, field, pill->rc_loc ^ 1, NULL, 0);
  6059. -}
  6060. -EXPORT_SYMBOL(req_capsule_other_get);
  6061. -
  6062. -/**
  6063.   * Set the size of the PTLRPC request/reply (\a loc) buffer for the given \a
  6064.   * field of the given \a pill.
  6065.   *
  6066. @@ -2376,67 +2312,5 @@ void req_capsule_shrink(struct req_capsule *pill,
  6067.  }
  6068.  EXPORT_SYMBOL(req_capsule_shrink);
  6069.  
  6070. -int req_capsule_server_grow(struct req_capsule *pill,
  6071. -               const struct req_msg_field *field,
  6072. -               unsigned int newlen)
  6073. -{
  6074. -   struct ptlrpc_reply_state *rs = pill->rc_req->rq_reply_state, *nrs;
  6075. -   char *from, *to;
  6076. -   int offset, len, rc;
  6077. -
  6078. -   LASSERT(pill->rc_fmt != NULL);
  6079. -   LASSERT(__req_format_is_sane(pill->rc_fmt));
  6080. -   LASSERT(req_capsule_has_field(pill, field, RCL_SERVER));
  6081. -   LASSERT(req_capsule_field_present(pill, field, RCL_SERVER));
  6082. -
  6083. -   len = req_capsule_get_size(pill, field, RCL_SERVER);
  6084. -   offset = __req_capsule_offset(pill, field, RCL_SERVER);
  6085. -   if (pill->rc_req->rq_repbuf_len >=
  6086. -       lustre_packed_msg_size(pill->rc_req->rq_repmsg) - len + newlen)
  6087. -       CERROR("Inplace repack might be done\n");
  6088. -
  6089. -   pill->rc_req->rq_reply_state = NULL;
  6090. -   req_capsule_set_size(pill, field, RCL_SERVER, newlen);
  6091. -   rc = req_capsule_server_pack(pill);
  6092. -   if (rc) {
  6093. -       /* put old rs back, the caller will decide what to do */
  6094. -       pill->rc_req->rq_reply_state = rs;
  6095. -       return rc;
  6096. -   }
  6097. -   nrs = pill->rc_req->rq_reply_state;
  6098. -   /* Now we need only buffers, copy first chunk */
  6099. -   to = lustre_msg_buf(nrs->rs_msg, 0, 0);
  6100. -   from = lustre_msg_buf(rs->rs_msg, 0, 0);
  6101. -   len = (char *)lustre_msg_buf(rs->rs_msg, offset, 0) - from;
  6102. -   memcpy(to, from, len);
  6103. -   /* check if we have tail and copy it too */
  6104. -   if (rs->rs_msg->lm_bufcount > offset + 1) {
  6105. -       to = lustre_msg_buf(nrs->rs_msg, offset + 1, 0);
  6106. -       from = lustre_msg_buf(rs->rs_msg, offset + 1, 0);
  6107. -       offset = rs->rs_msg->lm_bufcount - 1;
  6108. -       len = (char *)lustre_msg_buf(rs->rs_msg, offset, 0) +
  6109. -             cfs_size_round(rs->rs_msg->lm_buflens[offset]) - from;
  6110. -       memcpy(to, from, len);
  6111. -   }
  6112. -   /* drop old reply if everything is fine */
  6113. -   if (rs->rs_difficult) {
  6114. -       /* copy rs data */
  6115. -       int i;
  6116. -
  6117. -       nrs->rs_difficult = 1;
  6118. -       nrs->rs_no_ack = rs->rs_no_ack;
  6119. -       for (i = 0; i < rs->rs_nlocks; i++) {
  6120. -           nrs->rs_locks[i] = rs->rs_locks[i];
  6121. -           nrs->rs_modes[i] = rs->rs_modes[i];
  6122. -           nrs->rs_nlocks++;
  6123. -       }
  6124. -       rs->rs_nlocks = 0;
  6125. -       rs->rs_difficult = 0;
  6126. -       rs->rs_no_ack = 0;
  6127. -   }
  6128. -   ptlrpc_rs_decref(rs);
  6129. -   return 0;
  6130. -}
  6131. -EXPORT_SYMBOL(req_capsule_server_grow);
  6132.  /* __REQ_LAYOUT_USER__ */
  6133.  #endif
  6134. diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
  6135. index 500687d9071f..b507c82ab0a3 100644
  6136. --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
  6137. +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
  6138. @@ -891,36 +891,6 @@ ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s,
  6139.     return NULL;
  6140.  }
  6141.  
  6142. -/* common ost/mdt so_req_printer */
  6143. -void target_print_req(void *seq_file, struct ptlrpc_request *req)
  6144. -{
  6145. -   /* Called holding srv_lock with irqs disabled.
  6146. -    * Print specific req contents and a newline.
  6147. -    * CAVEAT EMPTOR: check request message length before printing!!!
  6148. -    * You might have received any old crap so you must be just as
  6149. -    * careful here as the service's request parser!!! */
  6150. -   struct seq_file *sf = seq_file;
  6151. -
  6152. -   switch (req->rq_phase) {
  6153. -   case RQ_PHASE_NEW:
  6154. -       /* still awaiting a service thread's attention, or rejected
  6155. -        * because the generic request message didn't unpack */
  6156. -       seq_printf(sf, "<not swabbed>\n");
  6157. -       break;
  6158. -   case RQ_PHASE_INTERPRET:
  6159. -       /* being handled, so basic msg swabbed, and opc is valid
  6160. -        * but racing with mds_handle() */
  6161. -   case RQ_PHASE_COMPLETE:
  6162. -       /* been handled by mds_handle() reply state possibly still
  6163. -        * volatile */
  6164. -       seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg));
  6165. -       break;
  6166. -   default:
  6167. -       DEBUG_REQ(D_ERROR, req, "bad phase %d", req->rq_phase);
  6168. -   }
  6169. -}
  6170. -EXPORT_SYMBOL(target_print_req);
  6171. -
  6172.  static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
  6173.  {
  6174.     struct ptlrpc_service *svc = s->private;
  6175. diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
  6176. index d37cdd5ac580..61c9ac3c9da2 100644
  6177. --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c
  6178. +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
  6179. @@ -478,7 +478,6 @@ static void nrs_resource_get_safe(struct ptlrpc_nrs *nrs,
  6180.   *
  6181.   * \param resp the resource hierarchy that is being released
  6182.   *
  6183. - * \see ptlrpc_nrs_req_hp_move()
  6184.   * \see ptlrpc_nrs_req_finalize()
  6185.   */
  6186.  static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp)
  6187. @@ -1252,70 +1251,6 @@ fail:
  6188.  EXPORT_SYMBOL(ptlrpc_nrs_policy_register);
  6189.  
  6190.  /**
  6191. - * Unregisters a previously registered policy with NRS core. All instances of
  6192. - * the policy on all NRS heads of all supported services are removed.
  6193. - *
  6194. - * N.B. This function should only be called from a module's exit() function.
  6195. - * Although it can be used for policies that ship alongside NRS core, the
  6196. - * function is primarily intended for policies that register externally,
  6197. - * from other modules.
  6198. - *
  6199. - * \param[in] conf configuration information for the policy to unregister
  6200. - *
  6201. - * \retval -ve error
  6202. - * \retval   0 success
  6203. - */
  6204. -int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf)
  6205. -{
  6206. -   struct ptlrpc_nrs_pol_desc *desc;
  6207. -   int rc;
  6208. -
  6209. -   LASSERT(conf != NULL);
  6210. -
  6211. -   if (conf->nc_flags & PTLRPC_NRS_FL_FALLBACK) {
  6212. -       CERROR("Unable to unregister a fallback policy, unless the PTLRPC service is stopping.\n");
  6213. -       return -EPERM;
  6214. -   }
  6215. -
  6216. -   conf->nc_name[NRS_POL_NAME_MAX - 1] = '\0';
  6217. -
  6218. -   mutex_lock(&nrs_core.nrs_mutex);
  6219. -
  6220. -   desc = nrs_policy_find_desc_locked(conf->nc_name);
  6221. -   if (desc == NULL) {
  6222. -       CERROR("Failing to unregister NRS policy %s which has not been registered with NRS core!\n",
  6223. -              conf->nc_name);
  6224. -       rc = -ENOENT;
  6225. -       goto not_exist;
  6226. -   }
  6227. -
  6228. -   mutex_lock(&ptlrpc_all_services_mutex);
  6229. -
  6230. -   rc = nrs_policy_unregister_locked(desc);
  6231. -   if (rc < 0) {
  6232. -       if (rc == -EBUSY)
  6233. -           CERROR("Please first stop policy %s on all service partitions and then retry to unregister the policy.\n",
  6234. -                  conf->nc_name);
  6235. -       goto fail;
  6236. -   }
  6237. -
  6238. -   CDEBUG(D_INFO, "Unregistering policy %s from NRS core.\n",
  6239. -          conf->nc_name);
  6240. -
  6241. -   list_del(&desc->pd_list);
  6242. -   kfree(desc);
  6243. -
  6244. -fail:
  6245. -   mutex_unlock(&ptlrpc_all_services_mutex);
  6246. -
  6247. -not_exist:
  6248. -   mutex_unlock(&nrs_core.nrs_mutex);
  6249. -
  6250. -   return rc;
  6251. -}
  6252. -EXPORT_SYMBOL(ptlrpc_nrs_policy_unregister);
  6253. -
  6254. -/**
  6255.   * Setup NRS heads on all service partitions of service \a svc, and register
  6256.   * all compatible policies on those NRS heads.
  6257.   *
  6258. @@ -1554,22 +1489,6 @@ ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp,
  6259.  }
  6260.  
  6261.  /**
  6262. - * Dequeues request \a req from the policy it has been enqueued on.
  6263. - *
  6264. - * \param[in] req the request
  6265. - */
  6266. -void ptlrpc_nrs_req_del_nolock(struct ptlrpc_request *req)
  6267. -{
  6268. -   struct ptlrpc_nrs_policy *policy = nrs_request_policy(&req->rq_nrq);
  6269. -
  6270. -   policy->pol_desc->pd_ops->op_req_dequeue(policy, &req->rq_nrq);
  6271. -
  6272. -   req->rq_nrq.nr_enqueued = 0;
  6273. -
  6274. -   nrs_request_removed(policy);
  6275. -}
  6276. -
  6277. -/**
  6278.   * Returns whether there are any requests currently enqueued on any of the
  6279.   * policies of service partition's \a svcpt NRS head specified by \a hp. Should
  6280.   * be called while holding ptlrpc_service_part::scp_req_lock to get a reliable
  6281. @@ -1590,48 +1509,6 @@ bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp)
  6282.  };
  6283.  
  6284.  /**
  6285. - * Moves request \a req from the regular to the high-priority NRS head.
  6286. - *
  6287. - * \param[in] req the request to move
  6288. - */
  6289. -void ptlrpc_nrs_req_hp_move(struct ptlrpc_request *req)
  6290. -{
  6291. -   struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
  6292. -   struct ptlrpc_nrs_request *nrq = &req->rq_nrq;
  6293. -   struct ptlrpc_nrs_resource *res1[NRS_RES_MAX];
  6294. -   struct ptlrpc_nrs_resource *res2[NRS_RES_MAX];
  6295. -
  6296. -   /**
  6297. -    * Obtain the high-priority NRS head resources.
  6298. -    */
  6299. -   nrs_resource_get_safe(nrs_svcpt2nrs(svcpt, true), nrq, res1, true);
  6300. -
  6301. -   spin_lock(&svcpt->scp_req_lock);
  6302. -
  6303. -   if (!ptlrpc_nrs_req_can_move(req))
  6304. -       goto out;
  6305. -
  6306. -   ptlrpc_nrs_req_del_nolock(req);
  6307. -
  6308. -   memcpy(res2, nrq->nr_res_ptrs, NRS_RES_MAX * sizeof(res2[0]));
  6309. -   memcpy(nrq->nr_res_ptrs, res1, NRS_RES_MAX * sizeof(res1[0]));
  6310. -
  6311. -   ptlrpc_nrs_hpreq_add_nolock(req);
  6312. -
  6313. -   memcpy(res1, res2, NRS_RES_MAX * sizeof(res1[0]));
  6314. -out:
  6315. -   spin_unlock(&svcpt->scp_req_lock);
  6316. -
  6317. -   /**
  6318. -    * Release either the regular NRS head resources if we moved the
  6319. -    * request, or the high-priority NRS head resources if we took a
  6320. -    * reference earlier in this function and ptlrpc_nrs_req_can_move()
  6321. -    * returned false.
  6322. -    */
  6323. -   nrs_resource_put_safe(res1);
  6324. -}
  6325. -
  6326. -/**
  6327.   * Carries out a control operation \a opc on the policy identified by the
  6328.   * human-readable \a name, on either all partitions, or only on the first
  6329.   * partition of service \a svc.
  6330. diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
  6331. index 1b30ac59ef62..409b77785917 100644
  6332. --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
  6333. +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
  6334. @@ -94,30 +94,6 @@ int ptlrpc_buf_need_swab(struct ptlrpc_request *req, const int inout,
  6335.  }
  6336.  EXPORT_SYMBOL(ptlrpc_buf_need_swab);
  6337.  
  6338. -static inline int lustre_msg_check_version_v2(struct lustre_msg_v2 *msg,
  6339. -                         __u32 version)
  6340. -{
  6341. -   __u32 ver = lustre_msg_get_version(msg);
  6342. -   return (ver & LUSTRE_VERSION_MASK) != version;
  6343. -}
  6344. -
  6345. -int lustre_msg_check_version(struct lustre_msg *msg, __u32 version)
  6346. -{
  6347. -#define LUSTRE_MSG_MAGIC_V1 0x0BD00BD0
  6348. -   switch (msg->lm_magic) {
  6349. -   case LUSTRE_MSG_MAGIC_V1:
  6350. -       CERROR("msg v1 not supported - please upgrade you system\n");
  6351. -       return -EINVAL;
  6352. -   case LUSTRE_MSG_MAGIC_V2:
  6353. -       return lustre_msg_check_version_v2(msg, version);
  6354. -   default:
  6355. -       CERROR("incorrect message magic: %08x\n", msg->lm_magic);
  6356. -       return 0;
  6357. -   }
  6358. -#undef LUSTRE_MSG_MAGIC_V1
  6359. -}
  6360. -EXPORT_SYMBOL(lustre_msg_check_version);
  6361. -
  6362.  /* early reply size */
  6363.  int lustre_msg_early_size(void)
  6364.  {
  6365. @@ -695,28 +671,6 @@ int lustre_msg_buflen(struct lustre_msg *m, int n)
  6366.  }
  6367.  EXPORT_SYMBOL(lustre_msg_buflen);
  6368.  
  6369. -static inline void
  6370. -lustre_msg_set_buflen_v2(struct lustre_msg_v2 *m, int n, int len)
  6371. -{
  6372. -   if (n >= m->lm_bufcount)
  6373. -       LBUG();
  6374. -
  6375. -   m->lm_buflens[n] = len;
  6376. -}
  6377. -
  6378. -void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len)
  6379. -{
  6380. -   switch (m->lm_magic) {
  6381. -   case LUSTRE_MSG_MAGIC_V2:
  6382. -       lustre_msg_set_buflen_v2(m, n, len);
  6383. -       return;
  6384. -   default:
  6385. -       LASSERTF(0, "incorrect message magic: %08x\n", m->lm_magic);
  6386. -   }
  6387. -}
  6388. -
  6389. -EXPORT_SYMBOL(lustre_msg_set_buflen);
  6390. -
  6391.  /* NB return the bufcount for lustre_msg_v2 format, so if message is packed
  6392.   * in V1 format, the result is one bigger. (add struct ptlrpc_body). */
  6393.  int lustre_msg_bufcount(struct lustre_msg *m)
  6394. @@ -958,24 +912,6 @@ __u32 lustre_msg_get_type(struct lustre_msg *msg)
  6395.  }
  6396.  EXPORT_SYMBOL(lustre_msg_get_type);
  6397.  
  6398. -__u32 lustre_msg_get_version(struct lustre_msg *msg)
  6399. -{
  6400. -   switch (msg->lm_magic) {
  6401. -   case LUSTRE_MSG_MAGIC_V2: {
  6402. -       struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
  6403. -       if (!pb) {
  6404. -           CERROR("invalid msg %p: no ptlrpc body!\n", msg);
  6405. -           return 0;
  6406. -       }
  6407. -       return pb->pb_version;
  6408. -   }
  6409. -   default:
  6410. -       CERROR("incorrect message magic: %08x\n", msg->lm_magic);
  6411. -       return 0;
  6412. -   }
  6413. -}
  6414. -EXPORT_SYMBOL(lustre_msg_get_version);
  6415. -
  6416.  void lustre_msg_add_version(struct lustre_msg *msg, int version)
  6417.  {
  6418.     switch (msg->lm_magic) {
  6419. @@ -1010,24 +946,6 @@ __u32 lustre_msg_get_opc(struct lustre_msg *msg)
  6420.  }
  6421.  EXPORT_SYMBOL(lustre_msg_get_opc);
  6422.  
  6423. -__u64 lustre_msg_get_last_xid(struct lustre_msg *msg)
  6424. -{
  6425. -   switch (msg->lm_magic) {
  6426. -   case LUSTRE_MSG_MAGIC_V2: {
  6427. -       struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
  6428. -       if (!pb) {
  6429. -           CERROR("invalid msg %p: no ptlrpc body!\n", msg);
  6430. -           return 0;
  6431. -       }
  6432. -       return pb->pb_last_xid;
  6433. -   }
  6434. -   default:
  6435. -       CERROR("incorrect message magic: %08x\n", msg->lm_magic);
  6436. -       return 0;
  6437. -   }
  6438. -}
  6439. -EXPORT_SYMBOL(lustre_msg_get_last_xid);
  6440. -
  6441.  __u64 lustre_msg_get_last_committed(struct lustre_msg *msg)
  6442.  {
  6443.     switch (msg->lm_magic) {
  6444. @@ -1243,25 +1161,6 @@ __u32 lustre_msg_get_service_time(struct lustre_msg *msg)
  6445.     }
  6446.  }
  6447.  
  6448. -char *lustre_msg_get_jobid(struct lustre_msg *msg)
  6449. -{
  6450. -   switch (msg->lm_magic) {
  6451. -   case LUSTRE_MSG_MAGIC_V2: {
  6452. -       struct ptlrpc_body *pb =
  6453. -           lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF,
  6454. -                     sizeof(struct ptlrpc_body));
  6455. -       if (!pb)
  6456. -           return NULL;
  6457. -
  6458. -       return pb->pb_jobid;
  6459. -   }
  6460. -   default:
  6461. -       CERROR("incorrect message magic: %08x\n", msg->lm_magic);
  6462. -       return NULL;
  6463. -   }
  6464. -}
  6465. -EXPORT_SYMBOL(lustre_msg_get_jobid);
  6466. -
  6467.  __u32 lustre_msg_get_cksum(struct lustre_msg *msg)
  6468.  {
  6469.     switch (msg->lm_magic) {
  6470. @@ -1336,36 +1235,6 @@ void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc)
  6471.  }
  6472.  EXPORT_SYMBOL(lustre_msg_set_opc);
  6473.  
  6474. -void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid)
  6475. -{
  6476. -   switch (msg->lm_magic) {
  6477. -   case LUSTRE_MSG_MAGIC_V2: {
  6478. -       struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
  6479. -       LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
  6480. -       pb->pb_last_xid = last_xid;
  6481. -       return;
  6482. -   }
  6483. -   default:
  6484. -       LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
  6485. -   }
  6486. -}
  6487. -EXPORT_SYMBOL(lustre_msg_set_last_xid);
  6488. -
  6489. -void lustre_msg_set_last_committed(struct lustre_msg *msg, __u64 last_committed)
  6490. -{
  6491. -   switch (msg->lm_magic) {
  6492. -   case LUSTRE_MSG_MAGIC_V2: {
  6493. -       struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
  6494. -       LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
  6495. -       pb->pb_last_committed = last_committed;
  6496. -       return;
  6497. -   }
  6498. -   default:
  6499. -       LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
  6500. -   }
  6501. -}
  6502. -EXPORT_SYMBOL(lustre_msg_set_last_committed);
  6503. -
  6504.  void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions)
  6505.  {
  6506.     switch (msg->lm_magic) {
  6507. @@ -1509,14 +1378,6 @@ void ptlrpc_request_set_replen(struct ptlrpc_request *req)
  6508.  }
  6509.  EXPORT_SYMBOL(ptlrpc_request_set_replen);
  6510.  
  6511. -void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *lens)
  6512. -{
  6513. -   req->rq_replen = lustre_msg_size(req->rq_reqmsg->lm_magic, count, lens);
  6514. -   if (req->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V2)
  6515. -       req->rq_reqmsg->lm_repsize = req->rq_replen;
  6516. -}
  6517. -EXPORT_SYMBOL(ptlrpc_req_set_repsize);
  6518. -
  6519.  /**
  6520.   * Send a remote set_info_async.
  6521.   *
  6522. @@ -1968,15 +1829,6 @@ void lustre_swab_idx_info(struct idx_info *ii)
  6523.     __swab16s(&ii->ii_recsize);
  6524.  }
  6525.  
  6526. -void lustre_swab_lip_header(struct lu_idxpage *lip)
  6527. -{
  6528. -   /* swab header */
  6529. -   __swab32s(&lip->lip_magic);
  6530. -   __swab16s(&lip->lip_flags);
  6531. -   __swab16s(&lip->lip_nr);
  6532. -}
  6533. -EXPORT_SYMBOL(lustre_swab_lip_header);
  6534. -
  6535.  void lustre_swab_mdt_rec_reint (struct mdt_rec_reint *rr)
  6536.  {
  6537.     __swab32s(&rr->rr_opcode);
  6538. @@ -2019,46 +1871,6 @@ void lustre_swab_lov_desc(struct lov_desc *ld)
  6539.  }
  6540.  EXPORT_SYMBOL(lustre_swab_lov_desc);
  6541.  
  6542. -void lustre_swab_lmv_desc(struct lmv_desc *ld)
  6543. -{
  6544. -   __swab32s(&ld->ld_tgt_count);
  6545. -   __swab32s(&ld->ld_active_tgt_count);
  6546. -   __swab32s(&ld->ld_default_stripe_count);
  6547. -   __swab32s(&ld->ld_pattern);
  6548. -   __swab64s(&ld->ld_default_hash_size);
  6549. -   __swab32s(&ld->ld_qos_maxage);
  6550. -   /* uuid endian insensitive */
  6551. -}
  6552. -
  6553. -void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea)
  6554. -{
  6555. -   __swab32s(&mea->mea_magic);
  6556. -   __swab32s(&mea->mea_count);
  6557. -   __swab32s(&mea->mea_master);
  6558. -   CLASSERT(offsetof(typeof(*mea), mea_padding) != 0);
  6559. -}
  6560. -
  6561. -void lustre_swab_lmv_user_md(struct lmv_user_md *lum)
  6562. -{
  6563. -   int i;
  6564. -
  6565. -   __swab32s(&lum->lum_magic);
  6566. -   __swab32s(&lum->lum_stripe_count);
  6567. -   __swab32s(&lum->lum_stripe_offset);
  6568. -   __swab32s(&lum->lum_hash_type);
  6569. -   __swab32s(&lum->lum_type);
  6570. -   CLASSERT(offsetof(typeof(*lum), lum_padding1) != 0);
  6571. -   CLASSERT(offsetof(typeof(*lum), lum_padding2) != 0);
  6572. -   CLASSERT(offsetof(typeof(*lum), lum_padding3) != 0);
  6573. -
  6574. -   for (i = 0; i < lum->lum_stripe_count; i++) {
  6575. -       __swab32s(&lum->lum_objects[i].lum_mds);
  6576. -       lustre_swab_lu_fid(&lum->lum_objects[i].lum_fid);
  6577. -   }
  6578. -
  6579. -}
  6580. -EXPORT_SYMBOL(lustre_swab_lmv_user_md);
  6581. -
  6582.  static void print_lum(struct lov_user_md *lum)
  6583.  {
  6584.     CDEBUG(D_OTHER, "lov_user_md %p:\n", lum);
  6585. @@ -2282,7 +2094,6 @@ void dump_obdo(struct obdo *oa)
  6586.     if (valid & OBD_MD_FLCOOKIE)
  6587.         CDEBUG(D_RPCTRACE, "obdo: o_lcookie = (llog_cookie dumping not yet implemented)\n");
  6588.  }
  6589. -EXPORT_SYMBOL(dump_obdo);
  6590.  
  6591.  void dump_ost_body(struct ost_body *ob)
  6592.  {
  6593. @@ -2381,14 +2192,6 @@ void lustre_swab_lustre_capa(struct lustre_capa *c)
  6594.  }
  6595.  EXPORT_SYMBOL(lustre_swab_lustre_capa);
  6596.  
  6597. -void lustre_swab_lustre_capa_key(struct lustre_capa_key *k)
  6598. -{
  6599. -   __swab64s(&k->lk_seq);
  6600. -   __swab32s(&k->lk_keyid);
  6601. -   CLASSERT(offsetof(typeof(*k), lk_padding) != 0);
  6602. -}
  6603. -EXPORT_SYMBOL(lustre_swab_lustre_capa_key);
  6604. -
  6605.  void lustre_swab_hsm_user_state(struct hsm_user_state *state)
  6606.  {
  6607.     __swab32s(&state->hus_states);
  6608. diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
  6609. index b13aaa2660f7..07591d73e26e 100644
  6610. --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c
  6611. +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
  6612. @@ -44,20 +44,10 @@
  6613.  #include "../include/obd_class.h"
  6614.  #include "ptlrpc_internal.h"
  6615.  
  6616. -static int suppress_pings;
  6617. -module_param(suppress_pings, int, 0644);
  6618. -MODULE_PARM_DESC(suppress_pings, "Suppress pings");
  6619. -
  6620.  struct mutex pinger_mutex;
  6621.  static LIST_HEAD(pinger_imports);
  6622.  static struct list_head timeout_list = LIST_HEAD_INIT(timeout_list);
  6623.  
  6624. -int ptlrpc_pinger_suppress_pings(void)
  6625. -{
  6626. -   return suppress_pings;
  6627. -}
  6628. -EXPORT_SYMBOL(ptlrpc_pinger_suppress_pings);
  6629. -
  6630.  struct ptlrpc_request *
  6631.  ptlrpc_prep_ping(struct obd_import *imp)
  6632.  {
  6633. @@ -122,11 +112,6 @@ static void ptlrpc_update_next_ping(struct obd_import *imp, int soon)
  6634.     imp->imp_next_ping = cfs_time_shift(time);
  6635.  }
  6636.  
  6637. -void ptlrpc_ping_import_soon(struct obd_import *imp)
  6638. -{
  6639. -   imp->imp_next_ping = cfs_time_current();
  6640. -}
  6641. -
  6642.  static inline int imp_is_deactive(struct obd_import *imp)
  6643.  {
  6644.     return (imp->imp_deactive ||
  6645. @@ -324,9 +309,6 @@ int ptlrpc_start_pinger(void)
  6646.     l_wait_event(pinger_thread.t_ctl_waitq,
  6647.              thread_is_running(&pinger_thread), &lwi);
  6648.  
  6649. -   if (suppress_pings)
  6650. -       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");
  6651. -
  6652.     return 0;
  6653.  }
  6654.  
  6655. @@ -533,139 +515,3 @@ void ptlrpc_pinger_wake_up(void)
  6656.     thread_add_flags(&pinger_thread, SVC_EVENT);
  6657.     wake_up(&pinger_thread.t_ctl_waitq);
  6658.  }
  6659. -
  6660. -/* Ping evictor thread */
  6661. -#define PET_READY     1
  6662. -#define PET_TERMINATE 2
  6663. -
  6664. -static int pet_refcount;
  6665. -static int pet_state;
  6666. -static wait_queue_head_t pet_waitq;
  6667. -static LIST_HEAD(pet_list);
  6668. -static DEFINE_SPINLOCK(pet_lock);
  6669. -
  6670. -int ping_evictor_wake(struct obd_export *exp)
  6671. -{
  6672. -   struct obd_device *obd;
  6673. -
  6674. -   spin_lock(&pet_lock);
  6675. -   if (pet_state != PET_READY) {
  6676. -       /* eventually the new obd will call here again. */
  6677. -       spin_unlock(&pet_lock);
  6678. -       return 1;
  6679. -   }
  6680. -
  6681. -   obd = class_exp2obd(exp);
  6682. -   if (list_empty(&obd->obd_evict_list)) {
  6683. -       class_incref(obd, "evictor", obd);
  6684. -       list_add(&obd->obd_evict_list, &pet_list);
  6685. -   }
  6686. -   spin_unlock(&pet_lock);
  6687. -
  6688. -   wake_up(&pet_waitq);
  6689. -   return 0;
  6690. -}
  6691. -
  6692. -static int ping_evictor_main(void *arg)
  6693. -{
  6694. -   struct obd_device *obd;
  6695. -   struct obd_export *exp;
  6696. -   struct l_wait_info lwi = { 0 };
  6697. -   time64_t expire_time;
  6698. -
  6699. -   unshare_fs_struct();
  6700. -
  6701. -   CDEBUG(D_HA, "Starting Ping Evictor\n");
  6702. -   pet_state = PET_READY;
  6703. -   while (1) {
  6704. -       l_wait_event(pet_waitq, (!list_empty(&pet_list)) ||
  6705. -                (pet_state == PET_TERMINATE), &lwi);
  6706. -
  6707. -       /* loop until all obd's will be removed */
  6708. -       if ((pet_state == PET_TERMINATE) && list_empty(&pet_list))
  6709. -           break;
  6710. -
  6711. -       /* we only get here if pet_exp != NULL, and the end of this
  6712. -        * loop is the only place which sets it NULL again, so lock
  6713. -        * is not strictly necessary. */
  6714. -       spin_lock(&pet_lock);
  6715. -       obd = list_entry(pet_list.next, struct obd_device,
  6716. -                    obd_evict_list);
  6717. -       spin_unlock(&pet_lock);
  6718. -
  6719. -       expire_time = ktime_get_real_seconds() - PING_EVICT_TIMEOUT;
  6720. -
  6721. -       CDEBUG(D_HA, "evicting all exports of obd %s older than %lld\n",
  6722. -              obd->obd_name, (s64)expire_time);
  6723. -
  6724. -       /* Exports can't be deleted out of the list while we hold
  6725. -        * the obd lock (class_unlink_export), which means we can't
  6726. -        * lose the last ref on the export.  If they've already been
  6727. -        * removed from the list, we won't find them here. */
  6728. -       spin_lock(&obd->obd_dev_lock);
  6729. -       while (!list_empty(&obd->obd_exports_timed)) {
  6730. -           exp = list_entry(obd->obd_exports_timed.next,
  6731. -                        struct obd_export,
  6732. -                        exp_obd_chain_timed);
  6733. -           if (expire_time > exp->exp_last_request_time) {
  6734. -               class_export_get(exp);
  6735. -               spin_unlock(&obd->obd_dev_lock);
  6736. -               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",
  6737. -                         obd->obd_name,
  6738. -                         obd_uuid2str(&exp->exp_client_uuid),
  6739. -                         obd_export_nid2str(exp),
  6740. -                         (long)(ktime_get_real_seconds() -
  6741. -                            exp->exp_last_request_time),
  6742. -                         exp, (s64)ktime_get_real_seconds(),
  6743. -                         (s64)expire_time,
  6744. -                         (s64)exp->exp_last_request_time);
  6745. -               CDEBUG(D_HA, "Last request was at %lld\n",
  6746. -                      (s64)exp->exp_last_request_time);
  6747. -               class_fail_export(exp);
  6748. -               class_export_put(exp);
  6749. -               spin_lock(&obd->obd_dev_lock);
  6750. -           } else {
  6751. -               /* List is sorted, so everyone below is ok */
  6752. -               break;
  6753. -           }
  6754. -       }
  6755. -       spin_unlock(&obd->obd_dev_lock);
  6756. -
  6757. -       spin_lock(&pet_lock);
  6758. -       list_del_init(&obd->obd_evict_list);
  6759. -       spin_unlock(&pet_lock);
  6760. -
  6761. -       class_decref(obd, "evictor", obd);
  6762. -   }
  6763. -   CDEBUG(D_HA, "Exiting Ping Evictor\n");
  6764. -
  6765. -   return 0;
  6766. -}
  6767. -
  6768. -void ping_evictor_start(void)
  6769. -{
  6770. -   struct task_struct *task;
  6771. -
  6772. -   if (++pet_refcount > 1)
  6773. -       return;
  6774. -
  6775. -   init_waitqueue_head(&pet_waitq);
  6776. -
  6777. -   task = kthread_run(ping_evictor_main, NULL, "ll_evictor");
  6778. -   if (IS_ERR(task)) {
  6779. -       pet_refcount--;
  6780. -       CERROR("Cannot start ping evictor thread: %ld\n",
  6781. -           PTR_ERR(task));
  6782. -   }
  6783. -}
  6784. -EXPORT_SYMBOL(ping_evictor_start);
  6785. -
  6786. -void ping_evictor_stop(void)
  6787. -{
  6788. -   if (--pet_refcount > 0)
  6789. -       return;
  6790. -
  6791. -   pet_state = PET_TERMINATE;
  6792. -   wake_up(&pet_waitq);
  6793. -}
  6794. -EXPORT_SYMBOL(ping_evictor_stop);
  6795. diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
  6796. index 34c7e28afdaf..9274db2521df 100644
  6797. --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
  6798. +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
  6799. @@ -137,7 +137,6 @@ ptlrpc_nrs_req_peek_nolock(struct ptlrpc_service_part *svcpt, bool hp)
  6800.     return ptlrpc_nrs_req_get_nolock0(svcpt, hp, true, false);
  6801.  }
  6802.  
  6803. -void ptlrpc_nrs_req_del_nolock(struct ptlrpc_request *req);
  6804.  bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp);
  6805.  
  6806.  int ptlrpc_nrs_policy_control(const struct ptlrpc_service *svc,
  6807. @@ -243,7 +242,6 @@ int ptlrpc_stop_pinger(void);
  6808.  void ptlrpc_pinger_sending_on_import(struct obd_import *imp);
  6809.  void ptlrpc_pinger_commit_expected(struct obd_import *imp);
  6810.  void ptlrpc_pinger_wake_up(void);
  6811. -void ptlrpc_ping_import_soon(struct obd_import *imp);
  6812.  int ping_evictor_wake(struct obd_export *exp);
  6813.  
  6814.  /* sec_null.c */
  6815. diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
  6816. index 00efdbf40f46..ce036a1ac466 100644
  6817. --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
  6818. +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
  6819. @@ -196,48 +196,6 @@ ptlrpcd_select_pc(struct ptlrpc_request *req)
  6820.  }
  6821.  
  6822.  /**
  6823. - * Move all request from an existing request set to the ptlrpcd queue.
  6824. - * All requests from the set must be in phase RQ_PHASE_NEW.
  6825. - */
  6826. -void ptlrpcd_add_rqset(struct ptlrpc_request_set *set)
  6827. -{
  6828. -   struct list_head *tmp, *pos;
  6829. -   struct ptlrpcd_ctl *pc;
  6830. -   struct ptlrpc_request_set *new;
  6831. -   int count, i;
  6832. -
  6833. -   pc = ptlrpcd_select_pc(NULL);
  6834. -   new = pc->pc_set;
  6835. -
  6836. -   list_for_each_safe(pos, tmp, &set->set_requests) {
  6837. -       struct ptlrpc_request *req =
  6838. -           list_entry(pos, struct ptlrpc_request,
  6839. -                      rq_set_chain);
  6840. -
  6841. -       LASSERT(req->rq_phase == RQ_PHASE_NEW);
  6842. -       req->rq_set = new;
  6843. -       req->rq_queued_time = cfs_time_current();
  6844. -   }
  6845. -
  6846. -   spin_lock(&new->set_new_req_lock);
  6847. -   list_splice_init(&set->set_requests, &new->set_new_requests);
  6848. -   i = atomic_read(&set->set_remaining);
  6849. -   count = atomic_add_return(i, &new->set_new_count);
  6850. -   atomic_set(&set->set_remaining, 0);
  6851. -   spin_unlock(&new->set_new_req_lock);
  6852. -   if (count == i) {
  6853. -       wake_up(&new->set_waitq);
  6854. -
  6855. -       /* XXX: It maybe unnecessary to wakeup all the partners. But to
  6856. -        *      guarantee the async RPC can be processed ASAP, we have
  6857. -        *      no other better choice. It maybe fixed in future. */
  6858. -       for (i = 0; i < pc->pc_npartners; i++)
  6859. -           wake_up(&pc->pc_partners[i]->pc_set->set_waitq);
  6860. -   }
  6861. -}
  6862. -EXPORT_SYMBOL(ptlrpcd_add_rqset);
  6863. -
  6864. -/**
  6865.   * Return transferred RPCs count.
  6866.   */
  6867.  static int ptlrpcd_steal_rqset(struct ptlrpc_request_set *des,
  6868. diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c
  6869. index 5ee6641ea023..67604b560670 100644
  6870. --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
  6871. +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
  6872. @@ -297,46 +297,6 @@ void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync)
  6873.  }
  6874.  EXPORT_SYMBOL(sptlrpc_cli_ctx_put);
  6875.  
  6876. -/**
  6877. - * Expire the client context immediately.
  6878. - *
  6879. - * \pre Caller must hold at least 1 reference on the \a ctx.
  6880. - */
  6881. -void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx)
  6882. -{
  6883. -   LASSERT(ctx->cc_ops->force_die);
  6884. -   ctx->cc_ops->force_die(ctx, 0);
  6885. -}
  6886. -EXPORT_SYMBOL(sptlrpc_cli_ctx_expire);
  6887. -
  6888. -/**
  6889. - * To wake up the threads who are waiting for this client context. Called
  6890. - * after some status change happened on \a ctx.
  6891. - */
  6892. -void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx)
  6893. -{
  6894. -   struct ptlrpc_request *req, *next;
  6895. -
  6896. -   spin_lock(&ctx->cc_lock);
  6897. -   list_for_each_entry_safe(req, next, &ctx->cc_req_list,
  6898. -                    rq_ctx_chain) {
  6899. -       list_del_init(&req->rq_ctx_chain);
  6900. -       ptlrpc_client_wake_req(req);
  6901. -   }
  6902. -   spin_unlock(&ctx->cc_lock);
  6903. -}
  6904. -EXPORT_SYMBOL(sptlrpc_cli_ctx_wakeup);
  6905. -
  6906. -int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize)
  6907. -{
  6908. -   LASSERT(ctx->cc_ops);
  6909. -
  6910. -   if (ctx->cc_ops->display == NULL)
  6911. -       return 0;
  6912. -
  6913. -   return ctx->cc_ops->display(ctx, buf, bufsize);
  6914. -}
  6915. -
  6916.  static int import_sec_check_expire(struct obd_import *imp)
  6917.  {
  6918.     int adapt = 0;
  6919. @@ -1229,12 +1189,6 @@ static void sec_cop_destroy_sec(struct ptlrpc_sec *sec)
  6920.     sptlrpc_policy_put(policy);
  6921.  }
  6922.  
  6923. -void sptlrpc_sec_destroy(struct ptlrpc_sec *sec)
  6924. -{
  6925. -   sec_cop_destroy_sec(sec);
  6926. -}
  6927. -EXPORT_SYMBOL(sptlrpc_sec_destroy);
  6928. -
  6929.  static void sptlrpc_sec_kill(struct ptlrpc_sec *sec)
  6930.  {
  6931.     LASSERT_ATOMIC_POS(&sec->ps_refcount);
  6932. @@ -1507,13 +1461,6 @@ static void import_flush_ctx_common(struct obd_import *imp,
  6933.     sptlrpc_sec_put(sec);
  6934.  }
  6935.  
  6936. -void sptlrpc_import_flush_root_ctx(struct obd_import *imp)
  6937. -{
  6938. -   /* it's important to use grace mode, see explain in
  6939. -    * sptlrpc_req_refresh_ctx() */
  6940. -   import_flush_ctx_common(imp, 0, 1, 1);
  6941. -}
  6942. -
  6943.  void sptlrpc_import_flush_my_ctx(struct obd_import *imp)
  6944.  {
  6945.     import_flush_ctx_common(imp, from_kuid(&init_user_ns, current_uid()),
  6946. @@ -1697,16 +1644,6 @@ void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req)
  6947.     req->rq_repmsg = NULL;
  6948.  }
  6949.  
  6950. -int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp,
  6951. -               struct ptlrpc_cli_ctx *ctx)
  6952. -{
  6953. -   struct ptlrpc_sec_policy *policy = ctx->cc_sec->ps_policy;
  6954. -
  6955. -   if (!policy->sp_cops->install_rctx)
  6956. -       return 0;
  6957. -   return policy->sp_cops->install_rctx(imp, ctx->cc_sec, ctx);
  6958. -}
  6959. -
  6960.  int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp,
  6961.                 struct ptlrpc_svc_ctx *ctx)
  6962.  {
  6963. @@ -1921,46 +1858,6 @@ int sptlrpc_target_export_check(struct obd_export *exp,
  6964.  }
  6965.  EXPORT_SYMBOL(sptlrpc_target_export_check);
  6966.  
  6967. -void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
  6968. -                     struct sptlrpc_rule_set *rset)
  6969. -{
  6970. -   struct obd_export *exp;
  6971. -   struct sptlrpc_flavor new_flvr;
  6972. -
  6973. -   LASSERT(obd);
  6974. -
  6975. -   spin_lock(&obd->obd_dev_lock);
  6976. -
  6977. -   list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) {
  6978. -       if (exp->exp_connection == NULL)
  6979. -           continue;
  6980. -
  6981. -       /* note if this export had just been updated flavor
  6982. -        * (exp_flvr_changed == 1), this will override the
  6983. -        * previous one. */
  6984. -       spin_lock(&exp->exp_lock);
  6985. -       sptlrpc_target_choose_flavor(rset, exp->exp_sp_peer,
  6986. -                        exp->exp_connection->c_peer.nid,
  6987. -                        &new_flvr);
  6988. -       if (exp->exp_flvr_changed ||
  6989. -           !flavor_equal(&new_flvr, &exp->exp_flvr)) {
  6990. -           exp->exp_flvr_old[1] = new_flvr;
  6991. -           exp->exp_flvr_expire[1] = 0;
  6992. -           exp->exp_flvr_changed = 1;
  6993. -           exp->exp_flvr_adapt = 1;
  6994. -
  6995. -           CDEBUG(D_SEC, "exp %p (%s): updated flavor %x->%x\n",
  6996. -                  exp, sptlrpc_part2name(exp->exp_sp_peer),
  6997. -                  exp->exp_flvr.sf_rpc,
  6998. -                  exp->exp_flvr_old[1].sf_rpc);
  6999. -       }
  7000. -       spin_unlock(&exp->exp_lock);
  7001. -   }
  7002. -
  7003. -   spin_unlock(&obd->obd_dev_lock);
  7004. -}
  7005. -EXPORT_SYMBOL(sptlrpc_target_update_exp_flavor);
  7006. -
  7007.  static int sptlrpc_svc_check_from(struct ptlrpc_request *req, int svc_rc)
  7008.  {
  7009.     /* peer's claim is unreliable unless gss is being used */
  7010. @@ -2183,19 +2080,6 @@ void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req)
  7011.     req->rq_svc_ctx = NULL;
  7012.  }
  7013.  
  7014. -void sptlrpc_svc_ctx_invalidate(struct ptlrpc_request *req)
  7015. -{
  7016. -   struct ptlrpc_svc_ctx *ctx = req->rq_svc_ctx;
  7017. -
  7018. -   if (ctx == NULL)
  7019. -       return;
  7020. -
  7021. -   LASSERT_ATOMIC_POS(&ctx->sc_refcount);
  7022. -   if (ctx->sc_policy->sp_sops->invalidate_ctx)
  7023. -       ctx->sc_policy->sp_sops->invalidate_ctx(ctx);
  7024. -}
  7025. -EXPORT_SYMBOL(sptlrpc_svc_ctx_invalidate);
  7026. -
  7027.  /****************************************
  7028.   * bulk security           *
  7029.   ****************************************/
  7030. diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
  7031. index c18b71c71181..c89973c0e3a2 100644
  7032. --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
  7033. +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
  7034. @@ -302,150 +302,6 @@ static unsigned long enc_pools_cleanup(struct page ***pools, int npools)
  7035.     return cleaned;
  7036.  }
  7037.  
  7038. -/*
  7039. - * merge @npools pointed by @pools which contains @npages new pages
  7040. - * into current pools.
  7041. - *
  7042. - * we have options to avoid most memory copy with some tricks. but we choose
  7043. - * the simplest way to avoid complexity. It's not frequently called.
  7044. - */
  7045. -static void enc_pools_insert(struct page ***pools, int npools, int npages)
  7046. -{
  7047. -   int freeslot;
  7048. -   int op_idx, np_idx, og_idx, ng_idx;
  7049. -   int cur_npools, end_npools;
  7050. -
  7051. -   LASSERT(npages > 0);
  7052. -   LASSERT(page_pools.epp_total_pages+npages <= page_pools.epp_max_pages);
  7053. -   LASSERT(npages_to_npools(npages) == npools);
  7054. -   LASSERT(page_pools.epp_growing);
  7055. -
  7056. -   spin_lock(&page_pools.epp_lock);
  7057. -
  7058. -   /*
  7059. -    * (1) fill all the free slots of current pools.
  7060. -    */
  7061. -   /* free slots are those left by rent pages, and the extra ones with
  7062. -    * index >= total_pages, locate at the tail of last pool. */
  7063. -   freeslot = page_pools.epp_total_pages % PAGES_PER_POOL;
  7064. -   if (freeslot != 0)
  7065. -       freeslot = PAGES_PER_POOL - freeslot;
  7066. -   freeslot += page_pools.epp_total_pages - page_pools.epp_free_pages;
  7067. -
  7068. -   op_idx = page_pools.epp_free_pages / PAGES_PER_POOL;
  7069. -   og_idx = page_pools.epp_free_pages % PAGES_PER_POOL;
  7070. -   np_idx = npools - 1;
  7071. -   ng_idx = (npages - 1) % PAGES_PER_POOL;
  7072. -
  7073. -   while (freeslot) {
  7074. -       LASSERT(page_pools.epp_pools[op_idx][og_idx] == NULL);
  7075. -       LASSERT(pools[np_idx][ng_idx] != NULL);
  7076. -
  7077. -       page_pools.epp_pools[op_idx][og_idx] = pools[np_idx][ng_idx];
  7078. -       pools[np_idx][ng_idx] = NULL;
  7079. -
  7080. -       freeslot--;
  7081. -
  7082. -       if (++og_idx == PAGES_PER_POOL) {
  7083. -           op_idx++;
  7084. -           og_idx = 0;
  7085. -       }
  7086. -       if (--ng_idx < 0) {
  7087. -           if (np_idx == 0)
  7088. -               break;
  7089. -           np_idx--;
  7090. -           ng_idx = PAGES_PER_POOL - 1;
  7091. -       }
  7092. -   }
  7093. -
  7094. -   /*
  7095. -    * (2) add pools if needed.
  7096. -    */
  7097. -   cur_npools = (page_pools.epp_total_pages + PAGES_PER_POOL - 1) /
  7098. -            PAGES_PER_POOL;
  7099. -   end_npools = (page_pools.epp_total_pages + npages + PAGES_PER_POOL - 1)
  7100. -            / PAGES_PER_POOL;
  7101. -   LASSERT(end_npools <= page_pools.epp_max_pools);
  7102. -
  7103. -   np_idx = 0;
  7104. -   while (cur_npools < end_npools) {
  7105. -       LASSERT(page_pools.epp_pools[cur_npools] == NULL);
  7106. -       LASSERT(np_idx < npools);
  7107. -       LASSERT(pools[np_idx] != NULL);
  7108. -
  7109. -       page_pools.epp_pools[cur_npools++] = pools[np_idx];
  7110. -       pools[np_idx++] = NULL;
  7111. -   }
  7112. -
  7113. -   page_pools.epp_total_pages += npages;
  7114. -   page_pools.epp_free_pages += npages;
  7115. -   page_pools.epp_st_lowfree = page_pools.epp_free_pages;
  7116. -
  7117. -   if (page_pools.epp_total_pages > page_pools.epp_st_max_pages)
  7118. -       page_pools.epp_st_max_pages = page_pools.epp_total_pages;
  7119. -
  7120. -   CDEBUG(D_SEC, "add %d pages to total %lu\n", npages,
  7121. -          page_pools.epp_total_pages);
  7122. -
  7123. -   spin_unlock(&page_pools.epp_lock);
  7124. -}
  7125. -
  7126. -static int enc_pools_add_pages(int npages)
  7127. -{
  7128. -   static DEFINE_MUTEX(add_pages_mutex);
  7129. -   struct page ***pools;
  7130. -   int npools, alloced = 0;
  7131. -   int i, j, rc = -ENOMEM;
  7132. -
  7133. -   if (npages < PTLRPC_MAX_BRW_PAGES)
  7134. -       npages = PTLRPC_MAX_BRW_PAGES;
  7135. -
  7136. -   mutex_lock(&add_pages_mutex);
  7137. -
  7138. -   if (npages + page_pools.epp_total_pages > page_pools.epp_max_pages)
  7139. -       npages = page_pools.epp_max_pages - page_pools.epp_total_pages;
  7140. -   LASSERT(npages > 0);
  7141. -
  7142. -   page_pools.epp_st_grows++;
  7143. -
  7144. -   npools = npages_to_npools(npages);
  7145. -   pools = kcalloc(npools, sizeof(*pools), GFP_NOFS);
  7146. -   if (pools == NULL)
  7147. -       goto out;
  7148. -
  7149. -   for (i = 0; i < npools; i++) {
  7150. -       pools[i] = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS);
  7151. -       if (!pools[i])
  7152. -           goto out_pools;
  7153. -
  7154. -       for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) {
  7155. -           pools[i][j] = alloc_page(GFP_NOFS |
  7156. -                            __GFP_HIGHMEM);
  7157. -           if (pools[i][j] == NULL)
  7158. -               goto out_pools;
  7159. -
  7160. -           alloced++;
  7161. -       }
  7162. -   }
  7163. -   LASSERT(alloced == npages);
  7164. -
  7165. -   enc_pools_insert(pools, npools, npages);
  7166. -   CDEBUG(D_SEC, "added %d pages into pools\n", npages);
  7167. -   rc = 0;
  7168. -
  7169. -out_pools:
  7170. -   enc_pools_cleanup(pools, npools);
  7171. -   kfree(pools);
  7172. -out:
  7173. -   if (rc) {
  7174. -       page_pools.epp_st_grow_fails++;
  7175. -       CERROR("Failed to allocate %d enc pages\n", npages);
  7176. -   }
  7177. -
  7178. -   mutex_unlock(&add_pages_mutex);
  7179. -   return rc;
  7180. -}
  7181. -
  7182.  static inline void enc_pools_wakeup(void)
  7183.  {
  7184.     assert_spin_locked(&page_pools.epp_lock);
  7185. @@ -457,156 +313,6 @@ static inline void enc_pools_wakeup(void)
  7186.     }
  7187.  }
  7188.  
  7189. -static int enc_pools_should_grow(int page_needed, time64_t now)
  7190. -{
  7191. -   /* don't grow if someone else is growing the pools right now,
  7192. -    * or the pools has reached its full capacity
  7193. -    */
  7194. -   if (page_pools.epp_growing ||
  7195. -       page_pools.epp_total_pages == page_pools.epp_max_pages)
  7196. -       return 0;
  7197. -
  7198. -   /* if total pages is not enough, we need to grow */
  7199. -   if (page_pools.epp_total_pages < page_needed)
  7200. -       return 1;
  7201. -
  7202. -   /*
  7203. -    * we wanted to return 0 here if there was a shrink just happened
  7204. -    * moment ago, but this may cause deadlock if both client and ost
  7205. -    * live on single node.
  7206. -    */
  7207. -#if 0
  7208. -   if (now - page_pools.epp_last_shrink < 2)
  7209. -       return 0;
  7210. -#endif
  7211. -
  7212. -   /*
  7213. -    * here we perhaps need consider other factors like wait queue
  7214. -    * length, idle index, etc. ?
  7215. -    */
  7216. -
  7217. -   /* grow the pools in any other cases */
  7218. -   return 1;
  7219. -}
  7220. -
  7221. -/*
  7222. - * we allocate the requested pages atomically.
  7223. - */
  7224. -int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc)
  7225. -{
  7226. -   wait_queue_t waitlink;
  7227. -   unsigned long this_idle = -1;
  7228. -   unsigned long tick = 0;
  7229. -   long now;
  7230. -   int p_idx, g_idx;
  7231. -   int i;
  7232. -
  7233. -   LASSERT(desc->bd_iov_count > 0);
  7234. -   LASSERT(desc->bd_iov_count <= page_pools.epp_max_pages);
  7235. -
  7236. -   /* resent bulk, enc iov might have been allocated previously */
  7237. -   if (desc->bd_enc_iov != NULL)
  7238. -       return 0;
  7239. -
  7240. -   desc->bd_enc_iov = kcalloc(desc->bd_iov_count,
  7241. -                  sizeof(*desc->bd_enc_iov), GFP_NOFS);
  7242. -   if (desc->bd_enc_iov == NULL)
  7243. -       return -ENOMEM;
  7244. -
  7245. -   spin_lock(&page_pools.epp_lock);
  7246. -
  7247. -   page_pools.epp_st_access++;
  7248. -again:
  7249. -   if (unlikely(page_pools.epp_free_pages < desc->bd_iov_count)) {
  7250. -       if (tick == 0)
  7251. -           tick = cfs_time_current();
  7252. -
  7253. -       now = ktime_get_seconds();
  7254. -
  7255. -       page_pools.epp_st_missings++;
  7256. -       page_pools.epp_pages_short += desc->bd_iov_count;
  7257. -
  7258. -       if (enc_pools_should_grow(desc->bd_iov_count, now)) {
  7259. -           page_pools.epp_growing = 1;
  7260. -
  7261. -           spin_unlock(&page_pools.epp_lock);
  7262. -           enc_pools_add_pages(page_pools.epp_pages_short / 2);
  7263. -           spin_lock(&page_pools.epp_lock);
  7264. -
  7265. -           page_pools.epp_growing = 0;
  7266. -
  7267. -           enc_pools_wakeup();
  7268. -       } else {
  7269. -           if (++page_pools.epp_waitqlen >
  7270. -               page_pools.epp_st_max_wqlen)
  7271. -               page_pools.epp_st_max_wqlen =
  7272. -                       page_pools.epp_waitqlen;
  7273. -
  7274. -           set_current_state(TASK_UNINTERRUPTIBLE);
  7275. -           init_waitqueue_entry(&waitlink, current);
  7276. -           add_wait_queue(&page_pools.epp_waitq, &waitlink);
  7277. -
  7278. -           spin_unlock(&page_pools.epp_lock);
  7279. -           schedule();
  7280. -           remove_wait_queue(&page_pools.epp_waitq, &waitlink);
  7281. -           LASSERT(page_pools.epp_waitqlen > 0);
  7282. -           spin_lock(&page_pools.epp_lock);
  7283. -           page_pools.epp_waitqlen--;
  7284. -       }
  7285. -
  7286. -       LASSERT(page_pools.epp_pages_short >= desc->bd_iov_count);
  7287. -       page_pools.epp_pages_short -= desc->bd_iov_count;
  7288. -
  7289. -       this_idle = 0;
  7290. -       goto again;
  7291. -   }
  7292. -
  7293. -   /* record max wait time */
  7294. -   if (unlikely(tick != 0)) {
  7295. -       tick = cfs_time_current() - tick;
  7296. -       if (tick > page_pools.epp_st_max_wait)
  7297. -           page_pools.epp_st_max_wait = tick;
  7298. -   }
  7299. -
  7300. -   /* proceed with rest of allocation */
  7301. -   page_pools.epp_free_pages -= desc->bd_iov_count;
  7302. -
  7303. -   p_idx = page_pools.epp_free_pages / PAGES_PER_POOL;
  7304. -   g_idx = page_pools.epp_free_pages % PAGES_PER_POOL;
  7305. -
  7306. -   for (i = 0; i < desc->bd_iov_count; i++) {
  7307. -       LASSERT(page_pools.epp_pools[p_idx][g_idx] != NULL);
  7308. -       desc->bd_enc_iov[i].kiov_page =
  7309. -                   page_pools.epp_pools[p_idx][g_idx];
  7310. -       page_pools.epp_pools[p_idx][g_idx] = NULL;
  7311. -
  7312. -       if (++g_idx == PAGES_PER_POOL) {
  7313. -           p_idx++;
  7314. -           g_idx = 0;
  7315. -       }
  7316. -   }
  7317. -
  7318. -   if (page_pools.epp_free_pages < page_pools.epp_st_lowfree)
  7319. -       page_pools.epp_st_lowfree = page_pools.epp_free_pages;
  7320. -
  7321. -   /*
  7322. -    * new idle index = (old * weight + new) / (weight + 1)
  7323. -    */
  7324. -   if (this_idle == -1) {
  7325. -       this_idle = page_pools.epp_free_pages * IDLE_IDX_MAX /
  7326. -               page_pools.epp_total_pages;
  7327. -   }
  7328. -   page_pools.epp_idle_idx = (page_pools.epp_idle_idx * IDLE_IDX_WEIGHT +
  7329. -                  this_idle) /
  7330. -                 (IDLE_IDX_WEIGHT + 1);
  7331. -
  7332. -   page_pools.epp_last_access = ktime_get_seconds();
  7333. -
  7334. -   spin_unlock(&page_pools.epp_lock);
  7335. -   return 0;
  7336. -}
  7337. -EXPORT_SYMBOL(sptlrpc_enc_pool_get_pages);
  7338. -
  7339.  void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc)
  7340.  {
  7341.     int p_idx, g_idx;
  7342. @@ -651,41 +357,6 @@ void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc)
  7343.  }
  7344.  EXPORT_SYMBOL(sptlrpc_enc_pool_put_pages);
  7345.  
  7346. -/*
  7347. - * we don't do much stuff for add_user/del_user anymore, except adding some
  7348. - * initial pages in add_user() if current pools are empty, rest would be
  7349. - * handled by the pools's self-adaption.
  7350. - */
  7351. -int sptlrpc_enc_pool_add_user(void)
  7352. -{
  7353. -   int need_grow = 0;
  7354. -
  7355. -   spin_lock(&page_pools.epp_lock);
  7356. -   if (page_pools.epp_growing == 0 && page_pools.epp_total_pages == 0) {
  7357. -       page_pools.epp_growing = 1;
  7358. -       need_grow = 1;
  7359. -   }
  7360. -   spin_unlock(&page_pools.epp_lock);
  7361. -
  7362. -   if (need_grow) {
  7363. -       enc_pools_add_pages(PTLRPC_MAX_BRW_PAGES +
  7364. -                   PTLRPC_MAX_BRW_PAGES);
  7365. -
  7366. -       spin_lock(&page_pools.epp_lock);
  7367. -       page_pools.epp_growing = 0;
  7368. -       enc_pools_wakeup();
  7369. -       spin_unlock(&page_pools.epp_lock);
  7370. -   }
  7371. -   return 0;
  7372. -}
  7373. -EXPORT_SYMBOL(sptlrpc_enc_pool_add_user);
  7374. -
  7375. -int sptlrpc_enc_pool_del_user(void)
  7376. -{
  7377. -   return 0;
  7378. -}
  7379. -EXPORT_SYMBOL(sptlrpc_enc_pool_del_user);
  7380. -
  7381.  static inline void enc_pools_alloc(void)
  7382.  {
  7383.     LASSERT(page_pools.epp_max_pools);
  7384. diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
  7385. index 7769ab225a2d..0d29b8734a53 100644
  7386. --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
  7387. +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
  7388. @@ -48,27 +48,6 @@
  7389.  
  7390.  #include "ptlrpc_internal.h"
  7391.  
  7392. -const char *sptlrpc_part2name(enum lustre_sec_part part)
  7393. -{
  7394. -   switch (part) {
  7395. -   case LUSTRE_SP_CLI:
  7396. -       return "cli";
  7397. -   case LUSTRE_SP_MDT:
  7398. -       return "mdt";
  7399. -   case LUSTRE_SP_OST:
  7400. -       return "ost";
  7401. -   case LUSTRE_SP_MGC:
  7402. -       return "mgc";
  7403. -   case LUSTRE_SP_MGS:
  7404. -       return "mgs";
  7405. -   case LUSTRE_SP_ANY:
  7406. -       return "any";
  7407. -   default:
  7408. -       return "err";
  7409. -   }
  7410. -}
  7411. -EXPORT_SYMBOL(sptlrpc_part2name);
  7412. -
  7413.  enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd)
  7414.  {
  7415.     const char *type = obd->obd_type->typ_name;
  7416. @@ -430,19 +409,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
  7417.  }
  7418.  EXPORT_SYMBOL(sptlrpc_rule_set_choose);
  7419.  
  7420. -void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset)
  7421. -{
  7422. -   struct sptlrpc_rule *r;
  7423. -   int n;
  7424. -
  7425. -   for (n = 0; n < rset->srs_nrule; n++) {
  7426. -       r = &rset->srs_rules[n];
  7427. -       CDEBUG(D_SEC, "<%02d> from %x to %x, net %x, rpc %x\n", n,
  7428. -              r->sr_from, r->sr_to, r->sr_netid, r->sr_flvr.sf_rpc);
  7429. -   }
  7430. -}
  7431. -EXPORT_SYMBOL(sptlrpc_rule_set_dump);
  7432. -
  7433.  /**********************************
  7434.   * sptlrpc configuration support  *
  7435.   **********************************/
  7436. @@ -836,20 +802,6 @@ out:
  7437.     flavor_set_flags(sf, from, to, 1);
  7438.  }
  7439.  
  7440. -/**
  7441. - * called by target devices, determine the expected flavor from
  7442. - * certain peer (from, nid).
  7443. - */
  7444. -void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
  7445. -                 enum lustre_sec_part from,
  7446. -                 lnet_nid_t nid,
  7447. -                 struct sptlrpc_flavor *sf)
  7448. -{
  7449. -   if (sptlrpc_rule_set_choose(rset, from, LUSTRE_SP_ANY, nid, sf) == 0)
  7450. -       get_default_flavor(sf);
  7451. -}
  7452. -EXPORT_SYMBOL(sptlrpc_target_choose_flavor);
  7453. -
  7454.  #define SEC_ADAPT_DELAY     (10)
  7455.  
  7456.  /**
  7457. diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
  7458. index c3ad1dabced8..520329f88465 100644
  7459. --- a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
  7460. +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c
  7461. @@ -103,21 +103,6 @@ void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec)
  7462.  }
  7463.  EXPORT_SYMBOL(sptlrpc_gc_del_sec);
  7464.  
  7465. -void sptlrpc_gc_add_ctx(struct ptlrpc_cli_ctx *ctx)
  7466. -{
  7467. -   LASSERT(list_empty(&ctx->cc_gc_chain));
  7468. -
  7469. -   CDEBUG(D_SEC, "hand over ctx %p(%u->%s)\n",
  7470. -          ctx, ctx->cc_vcred.vc_uid, sec2target_str(ctx->cc_sec));
  7471. -   spin_lock(&sec_gc_ctx_list_lock);
  7472. -   list_add(&ctx->cc_gc_chain, &sec_gc_ctx_list);
  7473. -   spin_unlock(&sec_gc_ctx_list_lock);
  7474. -
  7475. -   thread_add_flags(&sec_gc_thread, SVC_SIGNAL);
  7476. -   wake_up(&sec_gc_thread.t_ctl_waitq);
  7477. -}
  7478. -EXPORT_SYMBOL(sptlrpc_gc_add_ctx);
  7479. -
  7480.  static void sec_process_ctx_list(void)
  7481.  {
  7482.     struct ptlrpc_cli_ctx *ctx;
  7483. diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c
  7484. index 623871beb5aa..d8ae490afdcf 100644
  7485. --- a/drivers/staging/lustre/lustre/ptlrpc/service.c
  7486. +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
  7487. @@ -179,33 +179,6 @@ ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, int post)
  7488.     return rc;
  7489.  }
  7490.  
  7491. -/**
  7492. - * Part of Rep-Ack logic.
  7493. - * Puts a lock and its mode into reply state associated to request reply.
  7494. - */
  7495. -void
  7496. -ptlrpc_save_lock(struct ptlrpc_request *req,
  7497. -        struct lustre_handle *lock, int mode, int no_ack)
  7498. -{
  7499. -   struct ptlrpc_reply_state *rs = req->rq_reply_state;
  7500. -   int idx;
  7501. -
  7502. -   LASSERT(rs != NULL);
  7503. -   LASSERT(rs->rs_nlocks < RS_MAX_LOCKS);
  7504. -
  7505. -   if (req->rq_export->exp_disconnected) {
  7506. -       ldlm_lock_decref(lock, mode);
  7507. -   } else {
  7508. -       idx = rs->rs_nlocks++;
  7509. -       rs->rs_locks[idx] = *lock;
  7510. -       rs->rs_modes[idx] = mode;
  7511. -       rs->rs_difficult = 1;
  7512. -       rs->rs_no_ack = !!no_ack;
  7513. -   }
  7514. -}
  7515. -EXPORT_SYMBOL(ptlrpc_save_lock);
  7516. -
  7517. -
  7518.  struct ptlrpc_hr_partition;
  7519.  
  7520.  struct ptlrpc_hr_thread {
  7521. @@ -246,12 +219,6 @@ struct ptlrpc_hr_service {
  7522.     struct ptlrpc_hr_partition  **hr_partitions;
  7523.  };
  7524.  
  7525. -struct rs_batch {
  7526. -   struct list_head            rsb_replies;
  7527. -   unsigned int            rsb_n_replies;
  7528. -   struct ptlrpc_service_part  *rsb_svcpt;
  7529. -};
  7530. -
  7531.  /** reply handling service. */
  7532.  static struct ptlrpc_hr_service        ptlrpc_hr;
  7533.  
  7534. @@ -261,17 +228,6 @@ static struct ptlrpc_hr_service        ptlrpc_hr;
  7535.  #define MAX_SCHEDULED 256
  7536.  
  7537.  /**
  7538. - * Initialize a reply batch.
  7539. - *
  7540. - * \param b batch
  7541. - */
  7542. -static void rs_batch_init(struct rs_batch *b)
  7543. -{
  7544. -   memset(b, 0, sizeof(*b));
  7545. -   INIT_LIST_HEAD(&b->rsb_replies);
  7546. -}
  7547. -
  7548. -/**
  7549.   * Choose an hr thread to dispatch requests to.
  7550.   */
  7551.  static struct ptlrpc_hr_thread *
  7552. @@ -297,76 +253,6 @@ ptlrpc_hr_select(struct ptlrpc_service_part *svcpt)
  7553.  }
  7554.  
  7555.  /**
  7556. - * Dispatch all replies accumulated in the batch to one from
  7557. - * dedicated reply handling threads.
  7558. - *
  7559. - * \param b batch
  7560. - */
  7561. -static void rs_batch_dispatch(struct rs_batch *b)
  7562. -{
  7563. -   if (b->rsb_n_replies != 0) {
  7564. -       struct ptlrpc_hr_thread *hrt;
  7565. -
  7566. -       hrt = ptlrpc_hr_select(b->rsb_svcpt);
  7567. -
  7568. -       spin_lock(&hrt->hrt_lock);
  7569. -       list_splice_init(&b->rsb_replies, &hrt->hrt_queue);
  7570. -       spin_unlock(&hrt->hrt_lock);
  7571. -
  7572. -       wake_up(&hrt->hrt_waitq);
  7573. -       b->rsb_n_replies = 0;
  7574. -   }
  7575. -}
  7576. -
  7577. -/**
  7578. - * Add a reply to a batch.
  7579. - * Add one reply object to a batch, schedule batched replies if overload.
  7580. - *
  7581. - * \param b batch
  7582. - * \param rs reply
  7583. - */
  7584. -static void rs_batch_add(struct rs_batch *b, struct ptlrpc_reply_state *rs)
  7585. -{
  7586. -   struct ptlrpc_service_part *svcpt = rs->rs_svcpt;
  7587. -
  7588. -   if (svcpt != b->