* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2012, Intel, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
if (to > 0 && cur_index > to)
RETURN(-LLOG_EEMPTY);
- if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
- struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
- struct llog_handle *log_handle;
+ if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
+ struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
+ struct llog_handle *loghandle;
if (rec->lrh_type != LLOG_LOGID_MAGIC) {
l = snprintf(out, remains, "[index]: %05d [type]: "
}
if (handle->lgh_ctxt == NULL)
RETURN(-EOPNOTSUPP);
- rc = llog_cat_id2handle(env, handle, &log_handle, &lir->lid_id);
- if (rc) {
- CDEBUG(D_IOCTL,
- "cannot find log #"LPX64"#"LPX64"#%08x\n",
- lir->lid_id.lgl_oid, lir->lid_id.lgl_oseq,
- lir->lid_id.lgl_ogen);
- RETURN(rc);
- }
- rc = llog_process(env, log_handle, llog_check_cb, NULL, NULL);
- llog_close(env, log_handle);
- } else {
+ rc = llog_cat_id2handle(env, handle, &loghandle, &lir->lid_id);
+ if (rc) {
+ CDEBUG(D_IOCTL,
+ "cannot find log #"LPX64"#"LPX64"#%08x\n",
+ lir->lid_id.lgl_oid, lir->lid_id.lgl_oseq,
+ lir->lid_id.lgl_ogen);
+ RETURN(rc);
+ }
+ rc = llog_process(env, loghandle, llog_check_cb, NULL, NULL);
+ llog_handle_put(loghandle);
+ } else {
bool ok;
switch (rec->lrh_type) {
static int llog_remove_log(const struct lu_env *env, struct llog_handle *cat,
struct llog_logid *logid)
{
- struct llog_handle *log;
- int rc, index = 0;
+ struct llog_handle *log;
+ int rc;
- ENTRY;
+ ENTRY;
rc = llog_cat_id2handle(env, cat, &log, logid);
- if (rc) {
- CDEBUG(D_IOCTL, "cannot find log #"LPX64"#"LPX64"#%08x\n",
- logid->lgl_oid, logid->lgl_oseq, logid->lgl_ogen);
- GOTO(out, rc = -ENOENT);
- }
+ if (rc) {
+ CDEBUG(D_IOCTL, "cannot find log #"LPX64"#"LPX64"#%08x\n",
+ logid->lgl_oid, logid->lgl_oseq, logid->lgl_ogen);
+ RETURN(-ENOENT);
+ }
- index = log->u.phd.phd_cookie.lgc_index;
- LASSERT(index);
rc = llog_destroy(env, log);
if (rc) {
CDEBUG(D_IOCTL, "cannot destroy log\n");
GOTO(out, rc);
}
- cfs_down_write(&cat->lgh_lock);
- if (cat->u.chd.chd_current_log == log)
- cat->u.chd.chd_current_log = NULL;
- cfs_up_write(&cat->lgh_lock);
- llog_cat_set_first_idx(cat, index);
- rc = llog_cancel_rec(env, cat, index);
+ llog_cat_cleanup(env, cat, log, log->u.phd.phd_cookie.lgc_index);
out:
- llog_close(env, log);
+ llog_handle_put(log);
RETURN(rc);
}
if (!idarray)
RETURN(-ENOMEM);
- cfs_mutex_lock(&obd->obd_olg.olg_cat_processing);
+ mutex_lock(&obd->obd_olg.olg_cat_processing);
rc = llog_get_cat_list(obd, name, 0, count, idarray);
if (rc)
GOTO(out, rc);
}
out:
/* release semaphore */
- cfs_mutex_unlock(&obd->obd_olg.olg_cat_processing);
+ mutex_unlock(&obd->obd_olg.olg_cat_processing);
OBD_FREE_LARGE(idarray, size);
RETURN(rc);