Commit 8c85bd76 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

staging/lustre/llog: remove unused server code

Most of the code in llog.c and llog_cat.c is completely unused
on the client and can be removed, as a preparation for removing
the dt_object code.

Two tricky parts are:

 - In llog_cat_close(), we rely on the fact that llh_flags never
   contains LLOG_F_ZAP_WHEN_EMPTY, because nobody ever sets that
   flag.

 - In llog_read_header(), we check the return value of the lpi_cb
   callback, and again we know that it cannot be LLOG_PROC_BREAK
   or LLOG_DEL_RECORD and can remove the respective code path.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fdeccfdc
......@@ -58,7 +58,6 @@
#include "obd_class.h"
#include "lustre/lustre_idl.h"
#include "dt_object.h"
#define LOG_NAME_LIMIT(logname, name) \
snprintf(logname, sizeof(logname), "LOGS/%s", name)
......@@ -117,24 +116,15 @@ struct llog_handle;
/* llog.c - general API */
int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,
int flags, struct obd_uuid *uuid);
int llog_copy_handler(const struct lu_env *env, struct llog_handle *llh,
struct llog_rec_hdr *rec, void *data);
int llog_process(const struct lu_env *env, struct llog_handle *loghandle,
llog_cb_t cb, void *data, void *catdata);
int llog_process_or_fork(const struct lu_env *env,
struct llog_handle *loghandle,
llog_cb_t cb, void *data, void *catdata, bool fork);
int llog_reverse_process(const struct lu_env *env,
struct llog_handle *loghandle, llog_cb_t cb,
void *data, void *catdata);
int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle,
int index);
int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt,
struct llog_handle **lgh, struct llog_logid *logid,
char *name, enum llog_open_param open_param);
int llog_close(const struct lu_env *env, struct llog_handle *cathandle);
int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt,
char *name);
int llog_backup(const struct lu_env *env, struct obd_device *obd,
struct llog_ctxt *ctxt, struct llog_ctxt *bak_ctxt,
char *name, char *backup);
......@@ -172,29 +162,14 @@ struct llog_process_cat_data {
int lpcd_last_idx;
};
struct thandle;
int llog_cat_close(const struct lu_env *env, struct llog_handle *cathandle);
int llog_cat_add_rec(const struct lu_env *env, struct llog_handle *cathandle,
struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
void *buf, struct thandle *th);
int llog_cat_declare_add_rec(const struct lu_env *env,
struct llog_handle *cathandle,
struct llog_rec_hdr *rec, struct thandle *th);
int llog_cat_add(const struct lu_env *env, struct llog_handle *cathandle,
struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
void *buf);
int llog_cat_cancel_records(const struct lu_env *env,
struct llog_handle *cathandle, int count,
struct llog_cookie *cookies);
int llog_cat_process_or_fork(const struct lu_env *env,
struct llog_handle *cat_llh, llog_cb_t cb,
void *data, int startcat, int startidx, bool fork);
int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
llog_cb_t cb, void *data, int startcat, int startidx);
int llog_cat_reverse_process(const struct lu_env *env,
struct llog_handle *cat_llh, llog_cb_t cb,
void *data);
int llog_cat_init_and_process(const struct lu_env *env,
struct llog_handle *llh);
/* llog_obd.c */
int llog_setup(const struct lu_env *env, struct obd_device *obd,
......@@ -202,16 +177,11 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
struct obd_device *disk_obd, struct llog_operations *op);
int __llog_ctxt_put(const struct lu_env *env, struct llog_ctxt *ctxt);
int llog_cleanup(const struct lu_env *env, struct llog_ctxt *);
int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
struct llog_cookie *cookies, int flags);
/* llog_net.c */
int llog_initiator_connect(struct llog_ctxt *ctxt);
struct llog_operations {
int (*lop_destroy)(const struct lu_env *env,
struct llog_handle *handle);
int (*lop_next_block)(const struct lu_env *env, struct llog_handle *h,
int *curr_idx, int next_idx, __u64 *offset,
void *buf, int len);
......@@ -254,8 +224,6 @@ struct llog_operations {
int (*lop_declare_create)(const struct lu_env *env,
struct llog_handle *handle,
struct thandle *th);
int (*lop_create)(const struct lu_env *env, struct llog_handle *handle,
struct thandle *th);
/**
* write new record in llog. It appends records usually but can edit
* existing records too.
......@@ -287,8 +255,6 @@ struct llog_handle {
spinlock_t lgh_hdr_lock; /* protect lgh_hdr data */
struct llog_logid lgh_id; /* id of this log */
struct llog_log_hdr *lgh_hdr;
struct file *lgh_file;
struct dt_object *lgh_obj;
int lgh_last_idx;
int lgh_cur_idx; /* used during llog_process */
__u64 lgh_cur_offset; /* used during llog_process */
......@@ -318,7 +284,6 @@ struct llog_ctxt {
struct mutex loc_mutex; /* protect loc_imp */
atomic_t loc_refcount;
long loc_flags; /* flags, see above defines */
struct dt_object *loc_dir;
};
#define LLOG_PROC_BREAK 0x0001
......@@ -440,22 +405,6 @@ static inline int llog_ctxt_null(struct obd_device *obd, int index)
return llog_group_ctxt_null(&obd->obd_olg, index);
}
static inline int llog_destroy(const struct lu_env *env,
struct llog_handle *handle)
{
struct llog_operations *lop;
int rc;
rc = llog_handle2ops(handle, &lop);
if (rc)
return rc;
if (lop->lop_destroy == NULL)
return -EOPNOTSUPP;
rc = lop->lop_destroy(env, handle);
return rc;
}
static inline int llog_next_block(const struct lu_env *env,
struct llog_handle *loghandle, int *cur_idx,
int next_idx, __u64 *cur_offset, void *buf,
......@@ -510,11 +459,6 @@ static inline int llog_connect(struct llog_ctxt *ctxt,
}
/* llog.c */
int llog_exist(struct llog_handle *loghandle);
int llog_declare_create(const struct lu_env *env,
struct llog_handle *loghandle, struct thandle *th);
int llog_create(const struct lu_env *env, struct llog_handle *handle,
struct thandle *th);
int llog_declare_write_rec(const struct lu_env *env,
struct llog_handle *handle,
struct llog_rec_hdr *rec, int idx,
......@@ -522,24 +466,10 @@ int llog_declare_write_rec(const struct lu_env *env,
int llog_write_rec(const struct lu_env *env, struct llog_handle *handle,
struct llog_rec_hdr *rec, struct llog_cookie *logcookies,
int numcookies, void *buf, int idx, struct thandle *th);
int llog_add(const struct lu_env *env, struct llog_handle *lgh,
struct llog_rec_hdr *rec, struct llog_cookie *logcookies,
void *buf, struct thandle *th);
int llog_declare_add(const struct lu_env *env, struct llog_handle *lgh,
struct llog_rec_hdr *rec, struct thandle *th);
int lustre_process_log(struct super_block *sb, char *logname,
struct config_llog_instance *cfg);
int lustre_end_log(struct super_block *sb, char *logname,
struct config_llog_instance *cfg);
int llog_open_create(const struct lu_env *env, struct llog_ctxt *ctxt,
struct llog_handle **res, struct llog_logid *logid,
char *name);
int llog_erase(const struct lu_env *env, struct llog_ctxt *ctxt,
struct llog_logid *logid, char *name);
int llog_write(const struct lu_env *env, struct llog_handle *loghandle,
struct llog_rec_hdr *rec, struct llog_cookie *reccookie,
int cookiecount, void *buf, int idx);
/** @} log */
#endif
......@@ -53,7 +53,6 @@ struct llog_process_info {
struct llog_thread_info {
struct lu_attr lgi_attr;
struct lu_fid lgi_fid;
struct dt_object_format lgi_dof;
struct lu_buf lgi_buf;
loff_t lgi_off;
struct llog_rec_hdr lgi_lrh;
......@@ -62,15 +61,6 @@ struct llog_thread_info {
extern struct lu_context_key llog_thread_key;
static inline struct llog_thread_info *llog_info(const struct lu_env *env)
{
struct llog_thread_info *lgi;
lgi = lu_context_key_get(&env->le_ctx, &llog_thread_key);
LASSERT(lgi);
return lgi;
}
int llog_info_init(void);
void llog_info_fini(void);
......
......@@ -212,36 +212,6 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
}
EXPORT_SYMBOL(llog_setup);
int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags)
{
int rc = 0;
if (!ctxt)
return 0;
if (CTXTP(ctxt, sync))
rc = CTXTP(ctxt, sync)(ctxt, exp, flags);
return rc;
}
EXPORT_SYMBOL(llog_sync);
int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
struct llog_cookie *cookies, int flags)
{
int rc;
if (!ctxt) {
CERROR("No ctxt\n");
return -ENODEV;
}
CTXT_CHECK_OP(ctxt, cancel, -EOPNOTSUPP);
rc = CTXTP(ctxt, cancel)(env, ctxt, cookies, flags);
return rc;
}
EXPORT_SYMBOL(llog_cancel);
/* context key constructor/destructor: llog_key_init, llog_key_fini */
LU_KEY_INIT_FINI(llog, struct llog_thread_info);
/* context key: llog_thread_key */
......
......@@ -142,41 +142,6 @@ static int llog_client_open(const struct lu_env *env,
return rc;
}
static int llog_client_destroy(const struct lu_env *env,
struct llog_handle *loghandle)
{
struct obd_import *imp;
struct ptlrpc_request *req = NULL;
struct llogd_body *body;
int rc;
LLOG_CLIENT_ENTRY(loghandle->lgh_ctxt, imp);
req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_DESTROY,
LUSTRE_LOG_VERSION,
LLOG_ORIGIN_HANDLE_DESTROY);
if (req == NULL) {
rc = -ENOMEM;
goto err_exit;
}
body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY);
body->lgd_logid = loghandle->lgh_id;
body->lgd_llh_flags = loghandle->lgh_hdr->llh_flags;
if (!(body->lgd_llh_flags & LLOG_F_IS_PLAIN))
CERROR("%s: wrong llog flags %x\n", imp->imp_obd->obd_name,
body->lgd_llh_flags);
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
ptlrpc_req_finished(req);
err_exit:
LLOG_CLIENT_EXIT(loghandle->lgh_ctxt, imp);
return rc;
}
static int llog_client_next_block(const struct lu_env *env,
struct llog_handle *loghandle,
int *cur_idx, int next_idx,
......@@ -360,7 +325,6 @@ struct llog_operations llog_client_ops = {
.lop_prev_block = llog_client_prev_block,
.lop_read_header = llog_client_read_header,
.lop_open = llog_client_open,
.lop_destroy = llog_client_destroy,
.lop_close = llog_client_close,
};
EXPORT_SYMBOL(llog_client_ops);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment