/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * linux/mds/mds_ext3.c
- *
+ * lustre/mds/mds_ext3.c
* Lustre Metadata Server (mds) journal abstraction routines
*
* Copyright (C) 2002 Cluster File Systems, Inc.
- * author: Andreas Dilger <adilger@clusterfs.com>
+ * Author: Andreas Dilger <adilger@clusterfs.com>
+ *
+ * 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.
*
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
+ * 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.
*
*/
#include <linux/module.h>
static struct mds_fs_operations mds_ext3_fs_ops;
-static kmem_cache_t *jcb_cache;
-static int jcb_cache_count;
+static kmem_cache_t *mcb_cache;
+static int mcb_cache_count;
struct mds_cb_data {
struct journal_callback cb_jcb;
{
/* For updates to the last recieved file */
int nblocks = EXT3_DATA_TRANS_BLOCKS;
+ void *handle;
switch(op) {
case MDS_FSOP_RMDIR:
LBUG();
}
- return journal_start(EXT3_JOURNAL(inode), nblocks);
+ lock_kernel();
+ handle = journal_start(EXT3_JOURNAL(inode), nblocks);
+ unlock_kernel();
+
+ return handle;
}
static int mds_ext3_commit(struct inode *inode, void *handle)
{
- return journal_stop((handle_t *)handle);
+ int rc;
+
+ lock_kernel();
+ rc = journal_stop((handle_t *)handle);
+ unlock_kernel();
+
+ return rc;
}
static int mds_ext3_setattr(struct dentry *dentry, void *handle,
struct iattr *iattr)
{
struct inode *inode = dentry->d_inode;
+ int rc;
+
+ lock_kernel();
/* a _really_ horrible hack to avoid removing the data stored
in the block pointers; this data is the object id
}
if (inode->i_op->setattr)
- return inode->i_op->setattr(dentry, iattr);
+ rc = inode->i_op->setattr(dentry, iattr);
else
- return inode_setattr(inode, iattr);
+ rc = inode_setattr(inode, iattr);
+
+ unlock_kernel();
+
+ return rc;
}
/*
* dirty (it currently is used with other operations that
* subsequently also mark the inode dirty).
*/
-static int mds_ext3_set_objid(struct inode *inode, void *handle, obd_id id)
+static int mds_ext3_set_md(struct inode *inode, void *handle,
+ void *obd_md, int len)
{
*((__u64 *)EXT3_I(inode)->i_data) = cpu_to_le64(id);
return 0;
mds_ext3_fs_ops.cl_delete_inode(inode);
}
-static void mds_ext3_callback_status(void *jcb, int error)
+static void mds_ext3_callback_status(struct journal_callback *jcb, int error)
{
struct mds_cb_data *mcb = (struct mds_cb_data *)jcb;
- CDEBUG(D_EXT2, "got callback for last_rcvd %Ld: rc = %d\n",
+ CDEBUG(D_EXT2, "got callback for last_rcvd "LPD64": rc = %d\n",
mcb->cb_last_rcvd, error);
if (!error && mcb->cb_last_rcvd > mcb->cb_mds->mds_last_committed)
mcb->cb_mds->mds_last_committed = mcb->cb_last_rcvd;
- kmem_cache_free(jcb_cache, mcb);
- --jcb_cache_count;
+ kmem_cache_free(mcb_cache, mcb);
+ --mcb_cache_count;
}
static int mds_ext3_set_last_rcvd(struct mds_obd *mds, void *handle)
{
struct mds_cb_data *mcb;
- mcb = kmem_cache_alloc(jcb_cache, GFP_NOFS);
+ mcb = kmem_cache_alloc(mcb_cache, GFP_NOFS);
if (!mcb)
RETURN(-ENOMEM);
- ++jcb_cache_count;
+ ++mcb_cache_count;
mcb->cb_mds = mds;
mcb->cb_last_rcvd = mds->mds_last_rcvd;
#ifdef HAVE_JOURNAL_CALLBACK_STATUS
- CDEBUG(D_EXT2, "set callback for last_rcvd: %Ld\n",
- (unsigned long long)mcb->cb_last_rcvd);
+ CDEBUG(D_EXT2, "set callback for last_rcvd: "LPD64"\n",
+ mcb->cb_last_rcvd);
+ lock_kernel();
+ /* Note that an "incompatible pointer warning here is OK for now */
journal_callback_set(handle, mds_ext3_callback_status,
- (void *)mcb);
+ (struct journal_callback *)mcb);
+ unlock_kernel();
#else
#warning "no journal callback kernel patch, faking it..."
{
{
int rc;
- jcb_cache = kmem_cache_create("mds_ext3_jcb",
+ mcb_cache = kmem_cache_create("mds_ext3_mcb",
sizeof(struct mds_cb_data), 0,
0, NULL, NULL);
- if (!jcb_cache) {
+ if (!mcb_cache) {
CERROR("error allocating MDS journal callback cache\n");
GOTO(out, rc = -ENOMEM);
}
rc = mds_register_fs_type(&mds_ext3_fs_ops, "ext3");
if (rc)
- kmem_cache_destroy(jcb_cache);
+ kmem_cache_destroy(mcb_cache);
out:
return rc;
}
static void __exit mds_ext3_exit(void)
{
- int rc = 0;
+ int rc;
mds_unregister_fs_type("ext3");
- rc = kmem_cache_destroy(jcb_cache);
+ rc = kmem_cache_destroy(mcb_cache);
- if (rc || jcb_cache_count) {
+ if (rc || mcb_cache_count) {
CERROR("can't free MDS callback cache: count %d, rc = %d\n",
- jcb_cache_count, rc);
+ mcb_cache_count, rc);
}
}
* lustre/mds/mds_extN.c
* Lustre Metadata Server (mds) journal abstraction routines
*
- * Copyright (c) 2002 Cluster File Systems, Inc.
+ * Copyright (C) 2002 Cluster File Systems, Inc.
* Author: Andreas Dilger <adilger@clusterfs.com>
*
* This file is part of Lustre, http://www.lustre.org.
#include <linux/obd_lov.h>
static struct mds_fs_operations mds_extN_fs_ops;
-static kmem_cache_t *jcb_cache;
-static int jcb_cache_count;
+static kmem_cache_t *mcb_cache;
+static int mcb_cache_count;
struct mds_cb_data {
struct journal_callback cb_jcb;
LBUG();
}
- //lock_kernel();
+ lock_kernel();
handle = journal_start(EXTN_JOURNAL(inode), nblocks);
- //if (IS_ERR(handle))
- // unlock_kernel();
+ unlock_kernel();
return handle;
}
static int mds_extN_commit(struct inode *inode, void *handle)
{
- int rc = journal_stop((handle_t *)handle);
+ int rc;
- //unlock_kernel();
+ lock_kernel();
+ rc = journal_stop((handle_t *)handle);
+ unlock_kernel();
return rc;
}
-/* Assumes BKL is held */
static int mds_extN_setattr(struct dentry *dentry, void *handle,
struct iattr *iattr)
{
struct inode *inode = dentry->d_inode;
+ int rc;
+ lock_kernel();
if (inode->i_op->setattr)
- return inode->i_op->setattr(dentry, iattr);
+ rc = inode->i_op->setattr(dentry, iattr);
else
- return inode_setattr(inode, iattr);
+ rc = inode_setattr(inode, iattr);
+
+ unlock_kernel();
+
+ return rc;
}
static int mds_extN_set_md(struct inode *inode, void *handle,
return;
}
if (mds_extN_set_md(inode, handle, NULL))
- CERROR("error clearing obdo on %ld\n", inode->i_ino);
+ CERROR("error clearing objid on %ld\n", inode->i_ino);
if (mds_extN_fs_ops.cl_delete_inode)
mds_extN_fs_ops.cl_delete_inode(inode);
if (!error && mcb->cb_last_rcvd > mcb->cb_mds->mds_last_committed)
mcb->cb_mds->mds_last_committed = mcb->cb_last_rcvd;
- kmem_cache_free(jcb_cache, jcb);
- --jcb_cache_count;
+ kmem_cache_free(mcb_cache, mcb);
+ --mcb_cache_count;
}
static int mds_extN_set_last_rcvd(struct mds_obd *mds, void *handle)
{
struct mds_cb_data *mcb;
- mcb = kmem_cache_alloc(jcb_cache, GFP_NOFS);
+ mcb = kmem_cache_alloc(mcb_cache, GFP_NOFS);
if (!mcb)
RETURN(-ENOMEM);
- ++jcb_cache_count;
+ ++mcb_cache_count;
mcb->cb_mds = mds;
mcb->cb_last_rcvd = mds->mds_last_rcvd;
#ifdef HAVE_JOURNAL_CALLBACK_STATUS
- CDEBUG(D_EXT2, "set callback for last_rcvd: %Ld\n",
- (unsigned long long)mcb->cb_last_rcvd);
+ CDEBUG(D_EXT2, "set callback for last_rcvd: "LPD64"\n",
+ mcb->cb_last_rcvd);
+ lock_kernel();
/* Note that an "incompatible pointer warning here is OK for now */
journal_callback_set(handle, mds_extN_callback_status,
(struct journal_callback *)mcb);
+ unlock_kernel();
#else
#warning "no journal callback kernel patch, faking it..."
{
CERROR("no journal callback kernel patch, faking it...\n");
next = jiffies + 300 * HZ;
}
- }
+
mds_extN_callback_status((struct journal_callback *)mcb, 0);
#endif
int rc;
//rc = extN_xattr_register();
- jcb_cache = kmem_cache_create("mds_extN_jcb",
+ mcb_cache = kmem_cache_create("mds_extN_mcb",
sizeof(struct mds_cb_data), 0,
0, NULL, NULL);
- if (!jcb_cache) {
+ if (!mcb_cache) {
CERROR("error allocating MDS journal callback cache\n");
GOTO(out, rc = -ENOMEM);
}
+
rc = mds_register_fs_type(&mds_extN_fs_ops, "extN");
if (rc)
- kmem_cache_destroy(jcb_cache);
+ kmem_cache_destroy(mcb_cache);
out:
return rc;
}
int rc;
mds_unregister_fs_type("extN");
- rc = kmem_cache_destroy(jcb_cache);
+ rc = kmem_cache_destroy(mcb_cache);
- if (rc || jcb_cache_count) {
+ if (rc || mcb_cache_count) {
CERROR("can't free MDS callback cache: count %d, rc = %d\n",
- jcb_cache_count, rc);
+ mcb_cache_count, rc);
}
//rc = extN_xattr_unregister();