From: lincent Date: Mon, 12 Sep 2005 14:36:59 +0000 (+0000) Subject: MGS/MGC requests. X-Git-Tag: v1_8_0_110~486^4~175^2~1 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=c1d473cf6b92c852a4a20d98355ae8da6ca6f5c4;p=fs%2Flustre-release.git MGS/MGC requests. --- diff --git a/lustre/include/linux/lvfs.h b/lustre/include/linux/lvfs.h index 11d97cb..99d1868 100644 --- a/lustre/include/linux/lvfs.h +++ b/lustre/include/linux/lvfs.h @@ -1,28 +1,28 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * Copyright (C) 2001 Cluster File Systems, Inc. - * - * This file is part of Lustre, http://www.lustre.org. - * - * 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. - * - * 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. - * - * 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. - * - * lustre VFS/process permission interface - */ - -#ifndef __LVFS_H__ -#define __LVFS_H__ + /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + * + * Copyright (C) 2001 Cluster File Systems, Inc. + * + * This file is part of Lustre, http://www.lustre.org. + * + * 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. + * + * 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. + * + * 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. + * + * lustre VFS/process permission interface + */ + + #ifndef __LVFS_H__ + #define __LVFS_H__ #include @@ -73,7 +73,6 @@ struct lvfs_run_ctxt { /* lvfs_common.c */ struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *, __u64, __u32, __u64 ,void *data); -int lvfs_open_llog(struct lvfs_run_ctxt*, __u64, struct dentry*, void *data); void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx, struct lvfs_ucred *cred); diff --git a/lustre/lvfs/lvfs_common.c b/lustre/lvfs/lvfs_common.c index e5593da..08f4f14 100644 --- a/lustre/lvfs/lvfs_common.c +++ b/lustre/lvfs/lvfs_common.c @@ -33,14 +33,5 @@ struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *ctxt, __u64 id, return ctxt->cb_ops.l_fid2dentry(id, gen, gr, data); } -int lvfs_open_llog(struct lvfs_run_ctxt *ctxt, __u64 id, - struct dentry *dentry, void *data) -{ - if (ctxt->cb_ops.l_open_llog) - return ctxt->cb_ops.l_open_llog(id, dentry, data); - else - return 0; -} EXPORT_SYMBOL(lvfs_fid2dentry); -EXPORT_SYMBOL(lvfs_open_llog); diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 26251db..6e6e07e 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -58,6 +58,7 @@ static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb, struct dentry *dentry; int err = 0; + LASSERT(sbi); obd->obd_fsops = fsfilt_get_ops(MT_STR(sbi->lsi_ldd)); diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 2c07f21..9d864ab 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -393,9 +393,13 @@ static struct dentry *mgs_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr, return mgs_fid2dentry(&obd->u.mgs, &fid, NULL); } -static int mgs_lvfs_open_llog(__u64 id, struct dentry *dentry , void *data) +static int mgs_open_llog(__u64 id, void *data, void *handle) { struct obd_device *obd = data; + struct mgs_update_llh *mul = handle; + struct llog_handle *lgh = &mul->mul_lgh; + struct dentry *dentry = lgh->lgh_file->f_dentry; + __u64 id = dentry->d_inode->i_ino; struct mgs_obd *mgs = &obd->u.mgs; struct mgs_open_llog *mollog, *n; struct list_head *llog_list = &mgs->mgs_open_llogs; @@ -426,6 +430,7 @@ static int mgs_lvfs_open_llog(__u64 id, struct dentry *dentry , void *data) list_add(&mollog->mol_list, &mgs->mgs_open_llogs); spin_unlock(&mgs->mgs_llogs_lock); + lgh-> return 0; } diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 9f6f78c..7078be5 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -123,8 +123,7 @@ static int mgs_start_record(struct obd_device *obd, rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT), llh_res, NULL, fsname, name); if (rc == 0) - llog_init_handle(*llh_res, LLOG_F_IS_PLAIN, - &cfg_uuid); + llog_init_handle(mul->mul_llh, LLOG_F_IS_PLAIN, &cfg_uuid); pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); @@ -236,6 +235,37 @@ static int mgs_do_record(struct obd_device *obd, RETURN(rc); } +int mgs_update_llog(struct obd_device *obd, + struct obd_ioctl_data *data) +{ + struct mgs_obd *mgs = &obd->u.mgs; + struct mgs_update_llh *mul; + char *name = data->ioc_inlbuf1; + char *fsname = data->ioc_inlbuf2; + int rc; + + /*First phase: writing mds log */ + logname = name; + data->ioc_inlbuf1 = logname; + data->ioc_inllen1 = strlen(data->ioc_inlbuf1) + 1; + data->ioc_inlbuf2 = fsname; + data->ioc_inllen2 = strlen(data->ioc_inlbuf2) + 1; + + rc = mgs_clear_record(obd, data); + if (rc) { + CERROR("failed to clear log %s: %d\n", logname, rc); + RETURN(rc); + } + + rc = mgs_start_record(obd, data); + if (rc) { + CERROR("failed to record log %s: %d\n", logname, rc); + RETURN(rc); + } + sprintf(lovuuid, "lov_%s_%s", fsname, name); + +} + int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void *uarg) { @@ -270,6 +300,10 @@ int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len, RETURN(rc); } + case OBD_IOC_UPDATE_LOG: { + rc = mgs_update_llog(obd, data); + RETURN(rc); + } case OBD_IOC_PARSE: { struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);