/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * linux/fs/obdfilter/filter_log.c
+ * GPL HEADER START
*
- * Copyright (c) 2001-2003 Cluster File Systems, Inc.
- * Author: Peter Braam <braam@clusterfs.com>
- * Author: Andreas Dilger <adilger@clusterfs.com>
- * Author: Phil Schwan <phil@clusterfs.com>
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * This file is part of the Lustre file system, http://www.lustre.org
- * Lustre is a trademark of Cluster File Systems, Inc.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * 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.
+ * This program 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 version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
*
- * 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
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
- * 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.
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lustre/obdfilter/filter_lvb.c
+ *
+ * Author: Peter Braam <braam@clusterfs.com>
+ * Author: Andreas Dilger <adilger@clusterfs.com>
+ * Author: Phil Schwan <phil@clusterfs.com>
*/
#define DEBUG_SUBSYSTEM S_FILTER
-#ifdef HAVE_KERNEL_CONFIG_H
+#ifndef AUTOCONF_INCLUDED
#include <linux/config.h>
#endif
#include <linux/module.h>
LASSERT(res);
LASSERT_SEM_LOCKED(&res->lr_lvb_sem);
- /* we only want lvb's for object resources */
- /* check for internal locks: these have name[1] != 0 */
- if (res->lr_name.name[1])
- RETURN(0);
-
if (res->lr_lvb_data)
RETURN(0);
obd = res->lr_namespace->ns_lvbp;
LASSERT(obd != NULL);
- dentry = filter_fid2dentry(obd, NULL, res->lr_name.name[2],
+ CDEBUG(D_INODE, "%s: filter_lvbo_init(o_gr="LPU64", o_id="
+ LPU64")\n", obd->obd_name, res->lr_name.name[1],
+ res->lr_name.name[0]);
+
+ dentry = filter_fid2dentry(obd, NULL, res->lr_name.name[1],
res->lr_name.name[0]);
if (IS_ERR(dentry)) {
rc = PTR_ERR(dentry);
inode_init_lvb(dentry->d_inode, lvb);
- CDEBUG(D_DLMTRACE, "res: "LPU64" initial lvb size: "LPU64", "
- "mtime: "LPU64", blocks: "LPU64"\n",
+ CDEBUG(D_DLMTRACE, "res: "LPX64" initial lvb size: "LPX64", "
+ "mtime: "LPX64", blocks: "LPX64"\n",
res->lr_name.name[0], lvb->lvb_size,
lvb->lvb_mtime, lvb->lvb_blocks);
out_dentry:
f_dput(dentry);
+ if (rc)
+ OST_LVB_SET_ERR(lvb->lvb_blocks, rc);
/* Don't free lvb data on lookup error */
return rc;
}
LASSERT(res);
- /* we only want lvb's for object resources */
- /* check for internal locks: these have name[1] != 0 */
- if (res->lr_name.name[1])
- RETURN(0);
-
down(&res->lr_lvb_sem);
lvb = res->lr_lvb_data;
if (lvb == NULL) {
obd = res->lr_namespace->ns_lvbp;
LASSERT(obd);
- dentry = filter_fid2dentry(obd, NULL, res->lr_name.name[2],
+ dentry = filter_fid2dentry(obd, NULL, res->lr_name.name[1],
res->lr_name.name[0]);
if (IS_ERR(dentry))
GOTO(out, rc = PTR_ERR(dentry));
if (dentry->d_inode == NULL)
GOTO(out_dentry, rc = -ENOENT);
- if (dentry->d_inode->i_size > lvb->lvb_size || !increase_only) {
+ if (i_size_read(dentry->d_inode) > lvb->lvb_size || !increase_only) {
CDEBUG(D_DLMTRACE, "res: "LPU64" updating lvb size from disk: "
LPU64" -> %llu\n", res->lr_name.name[0],
- lvb->lvb_size, dentry->d_inode->i_size);
- lvb->lvb_size = dentry->d_inode->i_size;
+ lvb->lvb_size, i_size_read(dentry->d_inode));
+ lvb->lvb_size = i_size_read(dentry->d_inode);
}
if (LTIME_S(dentry->d_inode->i_mtime) >lvb->lvb_mtime|| !increase_only){
}
if (lvb->lvb_blocks != dentry->d_inode->i_blocks) {
CDEBUG(D_DLMTRACE,"res: "LPU64" updating lvb blocks from disk: "
- LPU64" -> %lu\n", res->lr_name.name[0],
- lvb->lvb_blocks, dentry->d_inode->i_blocks);
+ LPU64" -> %llu\n", res->lr_name.name[0],
+ lvb->lvb_blocks, (unsigned long long)dentry->d_inode->i_blocks);
lvb->lvb_blocks = dentry->d_inode->i_blocks;
}