* Copyright (C) 2001-2003 Cluster File Systems, Inc.
* Author: Andreas Dilger <adilger@clusterfs.com>
*
- * This file is part of Lustre, http://www.lustre.org.
+ * This file is part of the Lustre file system, http://www.lustre.org
+ * Lustre is a trademark of Cluster File Systems, Inc.
*
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
+ * You may have signed or agreed to another license before downloading
+ * this software. If so, you are bound by the terms and conditions
+ * of that agreement, and the following does not apply to you. See the
+ * LICENSE file included with this distribution for more information.
*
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * If you did not agree to a different license, then this copy of Lustre
+ * is open source software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
*
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * In either case, Lustre is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * license text for more details.
*
* remote api for llog - server side
*
#include <linux/obd_class.h>
#include <linux/lustre_log.h>
#include <linux/lustre_net.h>
-#include <portals/list.h>
+#include <libcfs/list.h>
#include <linux/lustre_fsfilt.h>
#ifdef __KERNEL__
struct obd_device *disk_obd;
struct llog_handle *loghandle;
struct llogd_body *body;
- struct obd_run_ctxt saved;
+ struct lvfs_run_ctxt saved;
struct llog_logid *logid = NULL;
struct llog_ctxt *ctxt;
char * name = NULL;
CERROR("Can't unpack name\n");
GOTO(out, rc = -EFAULT);
}
+ CDEBUG(D_INFO, "opening log %s\n", name);
}
ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
- LASSERT(ctxt != NULL);
+ if (ctxt == NULL)
+ GOTO(out, rc = -EINVAL);
disk_obd = ctxt->loc_exp->exp_obd;
- push_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
+ push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
rc = llog_create(ctxt, &loghandle, logid, name);
if (rc)
if (!rc)
rc = rc2;
out_pop:
- pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
+ pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
out:
RETURN(rc);
}
struct obd_device *disk_obd;
struct llog_handle *loghandle;
struct llogd_body *body;
- struct obd_run_ctxt saved;
+ struct lvfs_run_ctxt saved;
struct llog_ctxt *ctxt;
__u32 flags;
__u8 *buf;
GOTO(out, rc = -ENOMEM);
ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
- LASSERT(ctxt != NULL);
+ if (ctxt == NULL)
+ GOTO(out, rc = -EINVAL);
disk_obd = ctxt->loc_exp->exp_obd;
- push_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
+ push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
if (rc)
rc = rc2;
out_pop:
- pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
+ pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
OBD_FREE(buf, LLOG_CHUNK_SIZE);
out:
RETURN(rc);
struct llog_handle *loghandle;
struct llogd_body *body;
struct llog_log_hdr *hdr;
- struct obd_run_ctxt saved;
+ struct lvfs_run_ctxt saved;
struct llog_ctxt *ctxt;
__u32 flags;
- __u8 *buf;
int size[] = {sizeof (*hdr)};
int rc, rc2;
ENTRY;
GOTO(out, rc =-EFAULT);
}
- OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
- if (!buf)
- GOTO(out, rc = -ENOMEM);
-
ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
- LASSERT(ctxt != NULL);
+ if (ctxt == NULL)
+ GOTO(out, rc = -EINVAL);
disk_obd = ctxt->loc_exp->exp_obd;
- push_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
+ push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
if (rc)
if (rc)
GOTO(out_close, rc);
-
rc = lustre_pack_reply(req, 1, size, NULL);
if (rc)
GOTO(out_close, rc = -ENOMEM);
rc = rc2;
out_pop:
- pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
- OBD_FREE(buf, LLOG_CHUNK_SIZE);
+ pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
out:
RETURN(rc);
struct llog_cookie *logcookies;
struct llog_ctxt *ctxt;
int num_cookies, rc = 0, err, i;
- struct obd_run_ctxt saved;
+ struct lvfs_run_ctxt saved;
struct llog_handle *cathandle;
struct inode *inode;
void *handle;
}
disk_obd = ctxt->loc_exp->exp_obd;
- push_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
+ push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
for (i = 0; i < num_cookies; i++, logcookies++) {
cathandle = ctxt->loc_handle;
LASSERT(cathandle != NULL);
inode = cathandle->lgh_file->f_dentry->d_inode;
- handle = fsfilt_start(disk_obd, inode,
- FSFILT_OP_CANCEL_UNLINK_LOG, NULL);
+ handle = fsfilt_start_log(disk_obd, inode,
+ FSFILT_OP_CANCEL_UNLINK, NULL, 1);
if (IS_ERR(handle)) {
CERROR("fsfilt_start failed: %ld\n", PTR_ERR(handle));
GOTO(pop_ctxt, rc = PTR_ERR(handle));
}
}
pop_ctxt:
- pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
+ pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
if (rc)
CERROR("cancel %d llog-records failed: %d\n", num_cookies, rc);
else
{
struct mds_obd *mds = &obd->u.mds;
struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
- struct obd_run_ctxt saved;
+ struct lvfs_run_ctxt saved;
struct llog_handle *handle = NULL;
char name[4][64];
int rc, i, l, remains = buf_len;
if (ctxt == NULL || mds == NULL)
RETURN(-EOPNOTSUPP);
- push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
+ push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
sprintf(name[0], "%s", mds->mds_profile);
sprintf(name[1], "%s-clean", mds->mds_profile);
break;
}
out_pop:
- pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
+ pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
RETURN(rc);
}
}
ctxt = cbd->ctxt;
- if (!(cat->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)))
+ if (!(cat->lgh_hdr->llh_flags & LLOG_F_IS_CAT))
RETURN(-EINVAL);
lir = (struct llog_logid_rec *)rec;
{
struct mds_obd *mds = &obd->u.mds;
struct llog_handle *handle;
- struct obd_run_ctxt saved;
+ struct lvfs_run_ctxt saved;
int size, i, count;
- struct llog_logid *idarray, *id;
- char name[32] = "CATLIST";
+ struct llog_catid *idarray;
+ struct llog_logid *id;
+ char name[32] = CATLIST;
int rc;
struct cb_data data;
struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
OBD_ALLOC(idarray, size);
if (!idarray)
RETURN(-ENOMEM);
- memset(idarray, 0, size);
rc = llog_get_cat_list(obd, obd, name, count, idarray);
if (rc)
GOTO(out_free, rc);
- push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
+ push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
- id = idarray;
data.ctxt = ctxt;
data.out = buf;
data.remains = buf_len;
for (i = 0; i < count; i++) {
int l, index, uncanceled = 0;
+
+ id = &idarray[i].lci_logid;
rc = llog_create(ctxt, &handle, id, NULL);
if (rc)
GOTO(out_pop, rc);
break;
}
out_pop:
- pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
+ pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
out_free:
OBD_FREE(idarray, size);
RETURN(rc);