Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
b=18696
[fs/lustre-release.git]
/
lustre
/
include
/
lustre_log.h
diff --git
a/lustre/include/lustre_log.h
b/lustre/include/lustre_log.h
index
215330c
..
eddaeef
100644
(file)
--- a/
lustre/include/lustre_log.h
+++ b/
lustre/include/lustre_log.h
@@
-124,6
+124,11
@@
struct llog_process_data {
* in catalog.
*/
llog_cb_t lpd_cb;
* in catalog.
*/
llog_cb_t lpd_cb;
+ /**
+ * Start processing the catalog from startcat/startidx
+ */
+ int lpd_startcat;
+ int lpd_startidx;
};
struct llog_process_cat_data {
};
struct llog_process_cat_data {
@@
-157,14
+162,19
@@
int llog_cat_add_rec(struct llog_handle *cathandle, struct llog_rec_hdr *rec,
struct llog_cookie *reccookie, void *buf);
int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
struct llog_cookie *cookies);
struct llog_cookie *reccookie, void *buf);
int llog_cat_cancel_records(struct llog_handle *cathandle, int count,
struct llog_cookie *cookies);
-int llog_cat_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data);
+int llog_cat_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data,
+ int startcat, int startidx);
int llog_cat_process_thread(void *data);
int llog_cat_reverse_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data);
int llog_cat_set_first_idx(struct llog_handle *cathandle, int index);
/* llog_obd.c */
int llog_cat_process_thread(void *data);
int llog_cat_reverse_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data);
int llog_cat_set_first_idx(struct llog_handle *cathandle, int index);
/* llog_obd.c */
+int llog_setup_named(struct obd_device *obd, struct obd_llog_group *olg,
+ int index, struct obd_device *disk_obd, int count,
+ struct llog_logid *logid, const char *logname,
+ struct llog_operations *op);
int llog_setup(struct obd_device *obd, struct obd_llog_group *olg, int index,
int llog_setup(struct obd_device *obd, struct obd_llog_group *olg, int index,
- struct obd_device *disk_obd, int count,
struct llog_logid *logid,
+ struct obd_device *disk_obd, int count, struct llog_logid *logid,
struct llog_operations *op);
int __llog_ctxt_put(struct llog_ctxt *ctxt);
int llog_cleanup(struct llog_ctxt *);
struct llog_operations *op);
int __llog_ctxt_put(struct llog_ctxt *ctxt);
int llog_cleanup(struct llog_ctxt *);
@@
-177,7
+187,7
@@
int llog_cancel(struct llog_ctxt *, struct lov_stripe_md *lsm,
int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg,
int index, struct obd_device *disk_obd, int count,
int llog_obd_origin_setup(struct obd_device *obd, struct obd_llog_group *olg,
int index, struct obd_device *disk_obd, int count,
- struct llog_logid *logid);
+ struct llog_logid *logid
, const char *name
);
int llog_obd_origin_cleanup(struct llog_ctxt *ctxt);
int llog_obd_origin_add(struct llog_ctxt *ctxt,
struct llog_rec_hdr *rec, struct lov_stripe_md *lsm,
int llog_obd_origin_cleanup(struct llog_ctxt *ctxt);
int llog_obd_origin_add(struct llog_ctxt *ctxt,
struct llog_rec_hdr *rec, struct lov_stripe_md *lsm,
@@
-228,9
+238,9
@@
struct llog_operations {
int (*lop_close)(struct llog_handle *handle);
int (*lop_read_header)(struct llog_handle *handle);
int (*lop_close)(struct llog_handle *handle);
int (*lop_read_header)(struct llog_handle *handle);
- int (*lop_setup)(struct obd_device *obd, struct obd_llog_group *olg,
+ int (*lop_setup)(struct obd_device *obd, struct obd_llog_group *olg,
int ctxt_idx, struct obd_device *disk_obd, int count,
int ctxt_idx, struct obd_device *disk_obd, int count,
- struct llog_logid *logid);
+ struct llog_logid *logid
, const char *name
);
int (*lop_sync)(struct llog_ctxt *ctxt, struct obd_export *exp);
int (*lop_cleanup)(struct llog_ctxt *ctxt);
int (*lop_add)(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
int (*lop_sync)(struct llog_ctxt *ctxt, struct obd_export *exp);
int (*lop_cleanup)(struct llog_ctxt *ctxt);
int (*lop_add)(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
@@
-282,14
+292,18
@@
struct llog_commit_master {
*/
atomic_t lcm_count;
/**
*/
atomic_t lcm_count;
/**
+ * The refcount for lcm
+ */
+ atomic_t lcm_refcount;
+ /**
* Thread control structure. Used for control commit thread.
*/
struct ptlrpcd_ctl lcm_pc;
* Thread control structure. Used for control commit thread.
*/
struct ptlrpcd_ctl lcm_pc;
- /*
+ /*
*
* Lock protecting list of llcds.
*/
spinlock_t lcm_lock;
* Lock protecting list of llcds.
*/
spinlock_t lcm_lock;
- /*
+ /*
*
* Llcds in flight for debugging purposes.
*/
struct list_head lcm_llcds;
* Llcds in flight for debugging purposes.
*/
struct list_head lcm_llcds;
@@
-299,6
+313,23
@@
struct llog_commit_master {
char lcm_name[LCM_NAME_SIZE];
};
char lcm_name[LCM_NAME_SIZE];
};
+static inline struct llog_commit_master
+*lcm_get(struct llog_commit_master *lcm)
+{
+ LASSERT(atomic_read(&lcm->lcm_refcount) > 0);
+ atomic_inc(&lcm->lcm_refcount);
+ return lcm;
+}
+
+static inline void
+lcm_put(struct llog_commit_master *lcm)
+{
+ if (!atomic_dec_and_test(&lcm->lcm_refcount)) {
+ return ;
+ }
+ OBD_FREE_PTR(lcm);
+}
+
struct llog_canceld_ctxt {
/**
* Llog context this llcd is attached to. Used for accessing
struct llog_canceld_ctxt {
/**
* Llog context this llcd is attached to. Used for accessing
@@
-316,7
+347,7
@@
struct llog_canceld_ctxt {
* left in llcd to cookie comming cookies.
*/
int llcd_size;
* left in llcd to cookie comming cookies.
*/
int llcd_size;
- /*
+ /*
*
* Link to lcm llcds list.
*/
struct list_head llcd_list;
* Link to lcm llcds list.
*/
struct list_head llcd_list;
@@
-335,10
+366,10
@@
struct llog_canceld_ctxt {
/* ptlrpc/recov_thread.c */
extern struct llog_commit_master *llog_recov_thread_init(char *name);
/* ptlrpc/recov_thread.c */
extern struct llog_commit_master *llog_recov_thread_init(char *name);
-extern void llog_recov_thread_fini(struct llog_commit_master *lcm,
+extern void llog_recov_thread_fini(struct llog_commit_master *lcm,
int force);
extern int llog_recov_thread_start(struct llog_commit_master *lcm);
int force);
extern int llog_recov_thread_start(struct llog_commit_master *lcm);
-extern void llog_recov_thread_stop(struct llog_commit_master *lcm,
+extern void llog_recov_thread_stop(struct llog_commit_master *lcm,
int force);
static inline void llog_gen_init(struct llog_ctxt *ctxt)
int force);
static inline void llog_gen_init(struct llog_ctxt *ctxt)
@@
-425,7
+456,7
@@
static inline void llog_group_set_export(struct obd_llog_group *olg,
struct obd_export *exp)
{
LASSERT(exp != NULL);
struct obd_export *exp)
{
LASSERT(exp != NULL);
-
+
spin_lock(&olg->olg_lock);
if (olg->olg_exp != NULL && olg->olg_exp != exp)
CWARN("%s: export for group %d is changed: 0x%p -> 0x%p\n",
spin_lock(&olg->olg_lock);
if (olg->olg_exp != NULL && olg->olg_exp != exp)
CWARN("%s: export for group %d is changed: 0x%p -> 0x%p\n",
@@
-440,7
+471,7
@@
static inline int llog_group_set_ctxt(struct obd_llog_group *olg,
{
LASSERT(index >= 0 && index < LLOG_MAX_CTXTS);
{
LASSERT(index >= 0 && index < LLOG_MAX_CTXTS);
- spin_lock(&olg->olg_lock);
+ spin_lock(&olg->olg_lock);
if (olg->olg_ctxts[index] != NULL) {
spin_unlock(&olg->olg_lock);
return -EEXIST;
if (olg->olg_ctxts[index] != NULL) {
spin_unlock(&olg->olg_lock);
return -EEXIST;
@@
-457,7
+488,7
@@
static inline struct llog_ctxt *llog_group_get_ctxt(struct obd_llog_group *olg,
LASSERT(index >= 0 && index < LLOG_MAX_CTXTS);
LASSERT(index >= 0 && index < LLOG_MAX_CTXTS);
- spin_lock(&olg->olg_lock);
+ spin_lock(&olg->olg_lock);
if (olg->olg_ctxts[index] == NULL) {
ctxt = NULL;
} else {
if (olg->olg_ctxts[index] == NULL) {
ctxt = NULL;
} else {
@@
-499,6
+530,7
@@
static inline int llog_write_rec(struct llog_handle *handle,
if (lop->lop_write_rec == NULL)
RETURN(-EOPNOTSUPP);
if (lop->lop_write_rec == NULL)
RETURN(-EOPNOTSUPP);
+ /* FIXME: Why doesn't caller just set the right lrh_len itself? */
if (buf)
buflen = rec->lrh_len + sizeof(struct llog_rec_hdr)
+ sizeof(struct llog_rec_tail);
if (buf)
buflen = rec->lrh_len + sizeof(struct llog_rec_hdr)
+ sizeof(struct llog_rec_tail);
@@
-508,10
+540,10
@@
static inline int llog_write_rec(struct llog_handle *handle,
raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
if (!raised)
raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
if (!raised)
- cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
+ cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
rc = lop->lop_write_rec(handle, rec, logcookies, numcookies, buf, idx);
if (!raised)
rc = lop->lop_write_rec(handle, rec, logcookies, numcookies, buf, idx);
if (!raised)
- cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
+ cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
RETURN(rc);
}
RETURN(rc);
}