# error "No word size defined"
#endif
+/* lustre_id output helper macros */
+#define DLID4 "%lu/%lu/%lu/%lu"
+
+#define OLID4(id) \
+ (unsigned long)(id)->li_fid.lf_id, \
+ (unsigned long)(id)->li_fid.lf_group, \
+ (unsigned long)(id)->li_stc.u.e3s.l3s_ino, \
+ (unsigned long)(id)->li_stc.u.e3s.l3s_gen
+
#endif
+
#define PORTALS_DEV_PATH "/dev/portals"
#define OBD_DEV_ID 1
#define OBD_DEV_PATH "/dev/obd"
+#define SMFS_DEV_ID 2
+#define SMFS_DEV_PATH "/dev/snapdev"
int ptl_name2nal(char *str);
int ptl_parse_ipaddr (__u32 *ipaddrp, char *str);
#define PORTALS_DEV_PATH "/dev/portals"
#define OBD_DEV_ID 1
#define OBD_DEV_PATH "/dev/obd"
+#define SMFS_DEV_ID 2
+#define SMFS_DEV_PATH "/dev/snapdev"
int ptl_name2nal(char *str);
int ptl_parse_ipaddr (__u32 *ipaddrp, char *str);
{"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
"rpc", "mgmt", "portals", "libcfs", "socknal", "qswnal", "pinger",
"filter", "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd",
- "ibnal", NULL};
+ "ibnal", "lmv", "cmobd", "smfs", NULL};
static const char *portal_debug_masks[] =
{"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
"blocks", "net", "warning", "buffs", "other", "dentry", "portals",
{"obdfilter", "lustre/obdfilter"},
{"extN", "lustre/extN"},
{"lov", "lustre/lov"},
+ {"lmv", "lustre/lmv"},
{"fsfilt_ext3", "lustre/lvfs"},
{"fsfilt_extN", "lustre/lvfs"},
{"fsfilt_reiserfs", "lustre/lvfs"},
{"ptlbd", "lustre/ptlbd"},
{"mgmt_svc", "lustre/mgmt"},
{"mgmt_cli", "lustre/mgmt"},
+ {"cobd", "lustre/cobd"},
+ {"cmobd", "lustre/cmobd"},
{"conf_obd", "lustre/obdclass"},
{NULL, NULL}
};
MODULES := cmobd
-cmobd-objs := cache_manager_obd.o cmobd_reint.o cmobd_write.o
-cmobd-objs += cmobd_oss_reint.o cmobd_mds_reint.o lproc_cm.o
+cmobd-objs := cm_obd.o cm_reint.o cm_write.o
+cmobd-objs += cm_oss_reint.o cm_mds_reint.o lproc_cm.o
@INCLUDE_RULES@
include $(src)/../portals/Kernelenv
obj-y += cmobd.o
-cmobd-objs := cache_manager_obd.o cmobd_reint.o cmobd_write.o \
- cmobd_oss_reint.o cmobd_mds_reint.o lproc_cm.o
+cmobd-objs := cm_obd.o cm_reint.o cm_write.o \
+ cm_oss_reint.o cm_mds_reint.o lproc_cm.o
endif
MOSTLYCLEANFILES = *.o *.ko *.mod.c
-DIST_SOURCES = $(cmobd-objs:%.o=%.c) cmobd_internal.h
+DIST_SOURCES = $(cmobd-objs:%.o=%.c) cm_internal.h
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (c) 2002 Cluster File Systems, Inc. <info@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.
- *
- * 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.
- */
-
-#define DEBUG_SUBSYSTEM S_CMOBD
-
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/obd_support.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_net.h>
-#include <linux/lustre_idl.h>
-#include <linux/obd_class.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_cmobd.h>
-#include <linux/lprocfs_status.h>
-#include <linux/obd_lov.h>
-
-#include "cmobd_internal.h"
-
-static int cmobd_attach(struct obd_device *obd, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
-
- lprocfs_init_vars(cmobd, &lvars);
- return lprocfs_obd_attach(obd, lvars.obd_vars);
-}
-
-static int cmobd_detach(struct obd_device *obd)
-{
- return lprocfs_obd_detach(obd);
-}
-
-static void cmobd_find_master_client_obd(struct obd_device *obd,
- struct obd_uuid *uuid)
-{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
-
- cmobd->cm_master_obd = class_find_client_obd(NULL, OBD_LOV_DEVICENAME,
- uuid);
- if (cmobd->cm_master_obd == NULL)
- cmobd->cm_master_obd = class_find_client_obd(NULL,
- LUSTRE_MDC_NAME,
- uuid);
-}
-
-static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
-{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct lustre_cfg* lcfg = buf;
- struct obd_uuid master_uuid, cache_uuid;
- struct lustre_handle conn = { 0 };
- int rc;
- ENTRY;
-
- if (lcfg->lcfg_inllen1 < 1 || !lcfg->lcfg_inlbuf1) {
- CERROR("CMOBD setup requires master uuid\n");
- RETURN(-EINVAL);
- }
- if (lcfg->lcfg_inllen2 < 1 || !lcfg->lcfg_inlbuf2) {
- CERROR("CMOBD setup requires cache uuid\n");
- RETURN(-EINVAL);
- }
-
- obd_str2uuid(&master_uuid, lcfg->lcfg_inlbuf1);
- obd_str2uuid(&cache_uuid, lcfg->lcfg_inlbuf2);
-
- cmobd_find_master_client_obd(obd, &master_uuid);
- if (cmobd->cm_master_obd == NULL) {
- CERROR("Can't find master obd %s\n", &master_uuid.uuid[0]);
- RETURN(-EINVAL);
- }
- cmobd->cm_cache_obd = class_uuid2obd(&cache_uuid);
- if (cmobd->cm_cache_obd == NULL) {
- CERROR("Can't find cache obd %s\n", &cache_uuid.uuid[0]);
- RETURN(-EINVAL);
- }
-
- /* master lov connects to master ost here */
- rc = obd_connect(&conn, cmobd->cm_master_obd, &obd->obd_uuid, 0);
- if (rc)
- RETURN(rc);
- cmobd->cm_master_exp = class_conn2export(&conn);
-
- memset(&conn, 0, sizeof(conn));
- rc = class_connect(&conn, cmobd->cm_cache_obd, &obd->obd_uuid);
- if (rc)
- GOTO(put_master, rc);
- cmobd->cm_cache_exp = class_conn2export(&conn);
- if (!strcmp(cmobd->cm_master_obd->obd_type->typ_name,
- OBD_LOV_DEVICENAME)){
- /* for master osc remove the recovery flag of oscc */
- rc = obd_set_info(cmobd->cm_master_exp, strlen("unrecovery"),
- "unrecovery", 0, NULL);
- if (rc)
- GOTO(put_master, rc);
-
- rc = cmobd_init_write_srv(obd);
- if (rc)
- GOTO(put_cache, rc);
-
- } else {
- /*FIXME later temp fix here
- *Assumation:cache mds only have one ost*/
- cmobd->cm_master_obd->u.cli.cl_max_mds_easize =
- lov_mds_md_size(1);
- }
- /* start n threads for write replay */
- RETURN(0);
-put_cache:
- class_disconnect(cmobd->cm_cache_exp, 0);
-put_master:
- obd_disconnect(cmobd->cm_master_exp, 0);
- RETURN(rc);
-}
-
-static int cmobd_cleanup(struct obd_device *obd, int flags)
-{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- ENTRY;
-
- if (!strcmp(cmobd->cm_master_obd->obd_type->typ_name,
- OBD_LOV_DEVICENAME)) {
- cmobd_cleanup_write_srv(obd);
- }
- class_disconnect(cmobd->cm_cache_exp, 0);
- obd_disconnect(cmobd->cm_master_exp, 0);
-
- RETURN(0);
-}
-
-static int cmobd_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
- void *karg, void *uarg)
-{
- struct obd_device *obd = exp->exp_obd;
- int rc = 0;
- ENTRY;
-
- switch (cmd) {
- case OBD_IOC_CMOBD_SYNC: /* trigger reintegration */
- rc = cmobd_reintegrate(obd);
- break;
- default:
- CERROR("unrecognized ioctl %#x\n", cmd);
- rc = -EINVAL;
- break;
- }
-
- RETURN(rc);
-}
-
-static struct obd_ops cmobd_ops = {
- o_owner: THIS_MODULE,
- o_attach: cmobd_attach,
- o_detach: cmobd_detach,
- o_setup: cmobd_setup,
- o_cleanup: cmobd_cleanup,
- o_iocontrol: cmobd_iocontrol,
-};
-
-kmem_cache_t *cmobd_extent_slab;
-
-static int __init cmobd_init(void)
-{
- struct lprocfs_static_vars lvars;
- int rc;
- ENTRY;
-
- printk(KERN_INFO "Lustre: Cache Manager OBD driver; info@clusterfs.com\n");
-
- lprocfs_init_vars(cmobd, &lvars);
- rc = class_register_type(&cmobd_ops, NULL, lvars.module_vars,
- LUSTRE_CMOBD_NAME);
- if (rc)
- RETURN(rc);
- cmobd_extent_slab = kmem_cache_create("cmobd_extents",
- sizeof(struct cmobd_extent_info), 0,
- SLAB_HWCACHE_ALIGN, NULL, NULL);
- if (cmobd_extent_slab == NULL) {
- class_unregister_type(LUSTRE_CMOBD_NAME);
- RETURN(-ENOMEM);
- }
- RETURN(0);
-}
-
-static void /*__exit*/ cmobd_exit(void)
-{
- class_unregister_type(LUSTRE_CMOBD_NAME);
- if (kmem_cache_destroy(cmobd_extent_slab) != 0)
- CERROR("couldn't free cmobd extent slab\n");
-}
-
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Cache Manager OBD driver");
-MODULE_LICENSE("GPL");
-
-module_init(cmobd_init);
-module_exit(cmobd_exit);
--- /dev/null
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * Copyright (C) 2003 Cluster File Systems, Inc.
+ *
+ * This code is issued under the GNU General Public License.
+ * See the file COPYING in this distribution
+ */
+
+#ifndef CM_INTERNAL_H
+#define CM_INTERNAL_H
+
+int cmobd_reintegrate(struct obd_device *);
+int cmobd_dummy_lsm(struct lov_stripe_md **, int, struct obdo*, __u32);
+void cmobd_free_lsm(struct lov_stripe_md **);
+
+int cmobd_replay_write(struct obd_device *, struct obdo *,
+ struct ldlm_extent *);
+
+int cmobd_init_write_srv(struct obd_device *);
+void cmobd_cleanup_write_srv(struct obd_device *);
+
+int cmobd_reint_mds(struct obd_device*obd, void *record, int opcode);
+int cmobd_reint_oss(struct obd_device *obd, void *record, int opcode);
+
+/* methods for updating/reading master lustre_id from local MDS inode EA.*/
+int mds_update_mid(struct obd_device *obd, struct lustre_id *id,
+ void *data, int data_len);
+
+int mds_read_mid(struct obd_device *obd, struct lustre_id *id,
+ void *data, int data_len);
+
+#endif /* CM_INTERNAL_H */
--- /dev/null
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * Copyright (C) 2001-2003 Cluster File Systems, Inc.
+ *
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
+ *
+ * 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.
+ */
+
+#define DEBUG_SUBSYSTEM S_CMOBD
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/obd_class.h>
+#include <linux/lustre_net.h>
+#include <linux/lustre_mds.h>
+#include <linux/lustre_smfs.h>
+
+#include "cm_internal.h"
+
+/* converts mds_rec_setattr to struct iattr. */
+static inline void cmobd_rec2iattr(struct mds_rec_setattr *rec,
+ struct iattr *iattr)
+{
+ iattr->ia_uid = rec->sa_uid;
+ iattr->ia_gid = rec->sa_gid;
+ iattr->ia_mode = rec->sa_mode;
+ iattr->ia_size = rec->sa_size;
+ iattr->ia_valid = rec->sa_valid;
+ LTIME_S(iattr->ia_atime) = rec->sa_atime;
+ LTIME_S(iattr->ia_mtime) = rec->sa_mtime;
+ LTIME_S(iattr->ia_ctime) = rec->sa_ctime;
+ iattr->ia_attr_flags = rec->sa_attr_flags;
+}
+
+static void
+cmobd_prepare_mdc_data(struct mdc_op_data *data, struct lustre_id *id1,
+ struct lustre_id *id2, const char *name,
+ int namelen, __u32 mode)
+{
+ LASSERT(id1);
+ LASSERT(data);
+
+ memset(data, 0, sizeof(*data));
+
+ data->id1 = *id1;
+ if (id2)
+ data->id2 = *id2;
+ else
+ memset(&data->id2, 0, sizeof(data->id2));
+
+ data->valid = 0;
+ data->name = name;
+ data->namelen = namelen;
+ data->create_mode = mode;
+ data->mod_time = LTIME_S(CURRENT_TIME);
+}
+
+/* If mdc_setattr() is called with an 'iattr', then it is a normal RPC that
+ * should take the normal semaphore and go to the normal portal.
+ *
+ * If it is called with iattr->ia_valid & ATTR_FROM_OPEN, then it is a magic
+ * open-path setattr that should take the setattr semaphore and go to the
+ * setattr portal. */
+static int cmobd_reint_setattr(struct obd_device *obd, void *record)
+{
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct ptlrpc_request *req = NULL;
+ struct mds_kml_pack_info *mkpi;
+ struct mds_rec_setattr *rec;
+ struct mdc_op_data op_data;
+ struct lustre_msg *msg;
+ int ea1len, ea2len;
+ struct iattr iattr;
+ void *ea1, *ea2;
+ int rc = 0;
+ ENTRY;
+
+ mkpi = (struct mds_kml_pack_info *)record;
+ msg = (struct lustre_msg *)(record + sizeof(*mkpi));
+
+ rec = lustre_msg_buf(msg, 0, 0);
+ if (!rec)
+ RETURN(-EINVAL);
+
+ /* converting setattr rec to struct iattr. */
+ cmobd_rec2iattr(rec, &iattr);
+
+ /* FIXME-UMKA: here should be handling of setattr() from open. Bug
+ * #249. Will be fixed later. */
+
+ /* converting localstore cookie to remote lustre_id. */
+ rc = mds_read_mid(cmobd->cache_obd, &rec->sa_id,
+ &rec->sa_id, sizeof(rec->sa_id));
+ if (rc) {
+ CERROR("Can't read master MDS store cookie "
+ "from local inode EA, err = %d.\n", rc);
+ RETURN(rc);
+ }
+
+ cmobd_prepare_mdc_data(&op_data, &rec->sa_id, NULL,
+ NULL, 0, 0);
+
+ /* handling possible EAs. */
+ ea1 = lustre_msg_buf(msg, 1, 0);
+ ea1len = ea1 ? msg->buflens[1] : 0;
+
+ ea2 = lustre_msg_buf(msg, 2, 0);
+ ea2len = ea2 ? msg->buflens[2] : 0;
+
+ rc = md_setattr(cmobd->master_exp, &op_data, &iattr,
+ ea1, ea1len, ea2, ea2len, &req);
+
+ if (req)
+ ptlrpc_req_finished(req);
+ RETURN(rc);
+}
+
+static int cmobd_reint_create(struct obd_device *obd, void *record)
+{
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct ptlrpc_request *req = NULL;
+ struct mds_kml_pack_info *mkpi;
+ int rc = 0, namelen, datalen;
+ struct mds_rec_create *rec;
+ struct mdc_op_data op_data;
+ struct lustre_msg *msg;
+ struct mds_body *body;
+ struct lustre_id lid;
+ char *name, *data;
+ ENTRY;
+
+ mkpi = (struct mds_kml_pack_info *)record;
+ msg = (struct lustre_msg *)(record + sizeof(*mkpi));
+
+ rec = lustre_msg_buf(msg, 0, 0);
+ if (!rec)
+ RETURN(-EINVAL);
+
+ lid = rec->cr_replayid;
+
+ /* zeroing @rec->cr_replayid out in request, as master MDS should create
+ * own inode (with own store cookie). */
+ memset(&rec->cr_replayid, 0, sizeof(rec->cr_replayid));
+
+ /* converting local inode store cookie to remote lustre_id. */
+ rc = mds_read_mid(cmobd->cache_obd, &rec->cr_id,
+ &rec->cr_id, sizeof(rec->cr_id));
+ if (rc) {
+ CERROR("Can't read master MDS store cookie "
+ "from local inode EA, err = %d.\n", rc);
+ RETURN(rc);
+ }
+
+ /* getting name to be created and its length */
+ name = lustre_msg_string(msg, 1, 0);
+ namelen = name ? msg->buflens[1] - 1 : 0;
+
+ /* getting misc data (symlink) and its length */
+ data = (char *)lustre_msg_buf(msg, 2, 0);
+ datalen = data ? msg->buflens[2] : 0;
+
+ /* prepare mdc request data. */
+ cmobd_prepare_mdc_data(&op_data, &rec->cr_id, &rec->cr_replayid,
+ name, namelen, rec->cr_mode);
+
+ /* requesting to master to create object with passed attributes. */
+ rc = md_create(cmobd->master_exp, &op_data, data, datalen,
+ rec->cr_mode, current->fsuid, current->fsgid,
+ rec->cr_rdev, &req);
+
+ if (!rc) {
+ /* here we save store cookie from master MDS to local
+ * inode EA. */
+ body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
+
+ rc = mds_update_mid(cmobd->cache_obd, &lid,
+ &body->id1, sizeof(body->id1));
+ }
+
+ if (req)
+ ptlrpc_req_finished(req);
+ RETURN(rc);
+}
+
+static int cmobd_reint_unlink(struct obd_device *obd, void *record)
+{
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct ptlrpc_request *req = NULL;
+ struct mds_kml_pack_info *mkpi;
+ struct mdc_op_data op_data;
+ struct mds_rec_unlink *rec;
+ struct lustre_msg *msg;
+ int rc = 0, namelen;
+ char *name = NULL;
+ ENTRY;
+
+ mkpi = (struct mds_kml_pack_info *)record;
+ msg = (struct lustre_msg *)(record + sizeof(*mkpi));
+
+ rec = lustre_msg_buf(msg, 0, 0);
+ if (!rec)
+ RETURN(-EINVAL);
+
+ /* converting local store cookie to remote lustre_id. */
+ rc = mds_read_mid(cmobd->cache_obd, &rec->ul_id1,
+ &rec->ul_id1, sizeof(rec->ul_id1));
+ if (rc) {
+ CERROR("Can't read master MDS store cookie "
+ "from local inode EA, err = %d.\n", rc);
+ RETURN(rc);
+ }
+
+ /* getting name to be created and its length */
+ name = lustre_msg_string(msg, 1, 0);
+ namelen = name ? msg->buflens[1] - 1 : 0;
+
+ /* prepare mdc request data. */
+ cmobd_prepare_mdc_data(&op_data, &rec->ul_id1, NULL,
+ name, namelen, rec->ul_mode);
+
+ rc = md_unlink(cmobd->master_exp, &op_data, &req);
+
+ if (req)
+ ptlrpc_req_finished(req);
+ RETURN(rc);
+}
+
+static int cmobd_reint_link(struct obd_device *obd, void *record)
+{
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct ptlrpc_request *req = NULL;
+ struct mds_kml_pack_info *mkpi;
+ struct mdc_op_data op_data;
+ struct mds_rec_link *rec;
+ struct lustre_msg *msg;
+ int rc = 0, namelen;
+ char *name;
+ ENTRY;
+
+ mkpi = (struct mds_kml_pack_info *)record;
+ msg = (struct lustre_msg *)(record + sizeof(*mkpi));
+
+ rec = lustre_msg_buf(msg, 0, 0);
+ if (!rec)
+ RETURN(-EINVAL);
+
+ /* converting local store cookie for both ids to remote lustre_id. */
+ rc = mds_read_mid(cmobd->cache_obd, &rec->lk_id1,
+ &rec->lk_id1, sizeof(rec->lk_id1));
+ if (rc) {
+ CERROR("Can't read master MDS store cookie "
+ "from local inode EA, err = %d.\n", rc);
+ RETURN(rc);
+ }
+
+ rc = mds_read_mid(cmobd->cache_obd, &rec->lk_id2,
+ &rec->lk_id2, sizeof(rec->lk_id2));
+ if (rc) {
+ CERROR("Can't read master MDS store cookie "
+ "from local inode EA, err = %d.\n", rc);
+ RETURN(rc);
+ }
+
+ /* getting name to be created and its length */
+ name = lustre_msg_string(msg, 1, 0);
+ namelen = name ? msg->buflens[1] - 1: 0;
+
+ /* prepare mdc request data. */
+ cmobd_prepare_mdc_data(&op_data, &rec->lk_id1, &rec->lk_id2,
+ name, namelen, 0);
+
+ rc = md_link(cmobd->master_exp, &op_data, &req);
+
+ if (req)
+ ptlrpc_req_finished(req);
+ RETURN(rc);
+}
+
+static int cmobd_reint_rename(struct obd_device *obd, void *record)
+{
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct ptlrpc_request *req = NULL;
+ struct mds_kml_pack_info *mkpi;
+ struct mdc_op_data op_data;
+ struct mds_rec_rename *rec;
+ int rc = 0, oldlen, newlen;
+ struct lustre_msg *msg;
+ char *old, *new;
+ ENTRY;
+
+ mkpi = (struct mds_kml_pack_info *)record;
+ msg = (struct lustre_msg *)(record + sizeof(*mkpi));
+
+ rec = lustre_msg_buf(msg, 0, 0);
+ if (!rec)
+ RETURN(-EINVAL);
+
+ /* converting local store cookie for both ids to remote lustre_id. */
+ rc = mds_read_mid(cmobd->cache_obd, &rec->rn_id1,
+ &rec->rn_id1, sizeof(rec->rn_id1));
+ if (rc) {
+ CERROR("Can't read master MDS store cookie "
+ "from local inode EA, err = %d.\n", rc);
+ RETURN(rc);
+ }
+
+ rc = mds_read_mid(cmobd->cache_obd, &rec->rn_id2,
+ &rec->rn_id2, sizeof(rec->rn_id2));
+ if (rc) {
+ CERROR("Can't read master MDS store cookie "
+ "from local inode EA, err = %d.\n", rc);
+ RETURN(rc);
+ }
+
+ /* getting old name and its length */
+ old = lustre_msg_string(msg, 1, 0);
+ oldlen = old ? msg->buflens[1] - 1 : 0;
+
+ /* getting new len and its length */
+ new = lustre_msg_string(msg, 2, 0);
+ newlen = new ? msg->buflens[2] - 1: 0;
+
+ /* prepare mdc request data. */
+ cmobd_prepare_mdc_data(&op_data, &rec->rn_id1, &rec->rn_id1,
+ NULL, 0, 0);
+
+ rc = md_rename(cmobd->master_exp, &op_data, old, oldlen,
+ new, newlen, &req);
+
+ if (req)
+ ptlrpc_req_finished(req);
+ RETURN(rc);
+}
+
+typedef int (*cmobd_reint_rec_func_t)(struct obd_device *, void *);
+
+static cmobd_reint_rec_func_t mds_reint_handler[REINT_MAX + 1] = {
+ [REINT_SETATTR] cmobd_reint_setattr,
+ [REINT_CREATE] cmobd_reint_create,
+ [REINT_LINK] cmobd_reint_link,
+ [REINT_UNLINK] cmobd_reint_unlink,
+ [REINT_RENAME] cmobd_reint_rename,
+};
+
+int cmobd_reint_mds(struct obd_device *obd, void *record, int dummy)
+{
+ struct mds_kml_pack_info *mkpi;
+ struct lustre_msg *msg;
+ __u32 opcode;
+
+ mkpi = (struct mds_kml_pack_info *)record;
+ msg = (struct lustre_msg *)(record + sizeof(*mkpi));
+
+ opcode = *(__u32 *)lustre_msg_buf(msg, 0, 0);
+
+ if (opcode > REINT_MAX || opcode <= 0) {
+ CERROR("Invalid mds reint opcode %u\n",
+ opcode);
+ return -EINVAL;
+ }
+
+ return mds_reint_handler[opcode](obd, record);
+}
--- /dev/null
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * Copyright (c) 2002 Cluster File Systems, Inc. <info@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.
+ *
+ * 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.
+ */
+
+#define DEBUG_SUBSYSTEM S_CMOBD
+
+#include <linux/version.h>
+#include <linux/init.h>
+#include <linux/obd_support.h>
+#include <linux/lustre_lib.h>
+#include <linux/lustre_net.h>
+#include <linux/lustre_idl.h>
+#include <linux/obd_class.h>
+#include <linux/lustre_mds.h>
+#include <linux/lustre_cmobd.h>
+#include <linux/lprocfs_status.h>
+#include <linux/obd_lov.h>
+#include <linux/obd_lmv.h>
+
+#include "cm_internal.h"
+
+static int cmobd_attach(struct obd_device *obd,
+ obd_count len, void *data)
+{
+ struct lprocfs_static_vars lvars;
+
+ lprocfs_init_vars(cmobd, &lvars);
+ return lprocfs_obd_attach(obd, lvars.obd_vars);
+}
+
+static int cmobd_detach(struct obd_device *obd)
+{
+ return lprocfs_obd_detach(obd);
+}
+
+static struct obd_device *cmobd_find_master(struct obd_device *obd,
+ struct obd_uuid *uuid)
+{
+ struct obd_device *master_obd;
+
+ CWARN("%s: looking for client obd %s\n",
+ obd->obd_uuid.uuid, uuid->uuid);
+
+ master_obd = class_find_client_obd(NULL,
+ OBD_LOV_DEVICENAME,
+ uuid);
+ if (master_obd)
+ return master_obd;
+
+ master_obd = class_find_client_obd(NULL,
+ OBD_LMV_DEVICENAME,
+ uuid);
+ if (master_obd)
+ return master_obd;
+
+ master_obd = class_find_client_obd(NULL, LUSTRE_MDC_NAME,
+ uuid);
+ return master_obd;
+}
+
+static inline int cmobd_lmv_obd(struct obd_device *obd)
+{
+ if (!strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) ||
+ !strcmp(obd->obd_type->typ_name, OBD_LMV_DEVICENAME))
+ return 1;
+
+ return 0;
+}
+
+static inline int cmobd_lov_obd(struct obd_device *obd)
+{
+ if (!strcmp(obd->obd_type->typ_name, OBD_LOV_DEVICENAME))
+ return 1;
+
+ return 0;
+}
+
+static void cmobd_init_ea_size(struct obd_device *obd)
+{
+ int ost_count = 1, easize, cookiesize;
+ struct cm_obd *cmobd = &obd->u.cm;
+ ENTRY;
+
+ /* FIXME-UMKA: here we should also take into account that there is
+ * possible to have few OSTs. */
+ easize = lov_mds_md_size(ost_count);
+ cookiesize = ost_count * sizeof(struct llog_cookie);
+
+ obd_init_ea_size(cmobd->master_exp, easize, cookiesize);
+
+ cmobd->master_obd->u.cli.cl_max_mds_easize = easize;
+ cmobd->master_obd->u.cli.cl_max_mds_cookiesize = cookiesize;
+
+ EXIT;
+}
+
+static int cmobd_setup(struct obd_device *obd, obd_count len, void *buf)
+{
+ struct obd_uuid master_uuid, cache_uuid;
+ struct lustre_handle conn = { 0 };
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct lustre_cfg* lcfg = buf;
+ struct lustre_id mid, lid;
+ int valsize, rc;
+ ENTRY;
+
+ if (lcfg->lcfg_inllen1 < 1 || !lcfg->lcfg_inlbuf1) {
+ CERROR("CMOBD setup requires master uuid\n");
+ RETURN(-EINVAL);
+ }
+ if (lcfg->lcfg_inllen2 < 1 || !lcfg->lcfg_inlbuf2) {
+ CERROR("CMOBD setup requires cache uuid\n");
+ RETURN(-EINVAL);
+ }
+
+ obd_str2uuid(&master_uuid, lcfg->lcfg_inlbuf1);
+ obd_str2uuid(&cache_uuid, lcfg->lcfg_inlbuf2);
+
+ /* FIXME-WANGDI: saving client obds here is not correct as they may
+ become invalid due to refcounter exhausting on cleanup. The prefer
+ way seems to be getting them each time we need them. */
+ cmobd->master_obd = cmobd_find_master(obd, &master_uuid);
+ if (cmobd->master_obd == NULL) {
+ CERROR("Can't find master obd %s\n", &master_uuid.uuid[0]);
+ RETURN(-EINVAL);
+ }
+
+ cmobd->cache_obd = class_uuid2obd(&cache_uuid);
+ if (cmobd->cache_obd == NULL) {
+ CERROR("Can't find cache obd %s\n", &cache_uuid.uuid[0]);
+ RETURN(-EINVAL);
+ }
+
+ rc = obd_connect(&conn, cmobd->master_obd, &obd->obd_uuid, 0);
+ if (rc)
+ RETURN(rc);
+ cmobd->master_exp = class_conn2export(&conn);
+
+ memset(&conn, 0, sizeof(conn));
+ rc = class_connect(&conn, cmobd->cache_obd, &obd->obd_uuid);
+ if (rc)
+ GOTO(put_master, rc);
+
+ cmobd->cache_exp = class_conn2export(&conn);
+
+ if (cmobd_lov_obd(cmobd->master_obd)) {
+ /* for master osc remove the recovery flag. */
+ rc = obd_set_info(cmobd->master_exp, strlen("unrecovery"),
+ "unrecovery", 0, NULL);
+ if (rc)
+ GOTO(put_master, rc);
+
+ rc = cmobd_init_write_srv(obd);
+ if (rc)
+ GOTO(put_cache, rc);
+ } else {
+ cmobd_init_ea_size(obd);
+ cmobd->write_srv = NULL;
+ }
+
+ if (cmobd_lmv_obd(cmobd->master_obd)) {
+ /* making sure, that both obds are ready. This is especially
+ * important in the case of using LMV as master. */
+ rc = obd_getready(cmobd->master_exp);
+ if (rc) {
+ CERROR("Can't make %s obd ready.\n",
+ master_uuid.uuid);
+ GOTO(put_cache, rc);
+ }
+
+ rc = obd_getready(cmobd->cache_exp);
+ if (rc) {
+ CERROR("Can't make %s obd ready.\n",
+ cache_uuid.uuid);
+ GOTO(put_cache, rc);
+ }
+
+ /* requesting master obd to have its root inode store cookie to
+ * be able to save it to local root inode EA. */
+ valsize = sizeof(struct lustre_id);
+
+ rc = obd_get_info(cmobd->master_exp, strlen("rootid"),
+ "rootid", &valsize, &mid);
+ if (rc) {
+ CERROR("Can't get rootid from master MDS %s, "
+ "err= %d.\n", master_uuid.uuid, rc);
+ GOTO(put_cache, rc);
+ }
+
+ /* getting rootid from cache MDS. It is needed to update local
+ * (cache) root inode by rootid value from master obd. */
+ rc = obd_get_info(cmobd->cache_exp, strlen("rootid"),
+ "rootid", &valsize, &lid);
+ if (rc) {
+ CERROR("Can't get rootid from local MDS %s, "
+ "err= %d.\n", cache_uuid.uuid, rc);
+ GOTO(put_cache, rc);
+ }
+
+ /* storing master MDS rootid to local root inode EA. */
+ CWARN("storing "DLID4" to local inode "DLID4".\n",
+ OLID4(&mid), OLID4(&lid));
+
+ rc = mds_update_mid(cmobd->cache_obd, &lid,
+ &mid, sizeof(mid));
+ if (rc) {
+ CERROR("Can't update local root inode by ID "
+ "from master MDS %s, err = %d.\n",
+ master_uuid.uuid, rc);
+ GOTO(put_cache, rc);
+ }
+ }
+
+ RETURN(rc);
+put_cache:
+ class_disconnect(cmobd->cache_exp, 0);
+put_master:
+ obd_disconnect(cmobd->master_exp, 0);
+ RETURN(rc);
+}
+
+static int cmobd_cleanup(struct obd_device *obd, int flags)
+{
+ struct cm_obd *cmobd = &obd->u.cm;
+ ENTRY;
+
+ if (cmobd->write_srv)
+ cmobd_cleanup_write_srv(obd);
+
+ class_disconnect(cmobd->cache_exp, 0);
+ obd_disconnect(cmobd->master_exp, 0);
+
+ RETURN(0);
+}
+
+static int cmobd_iocontrol(unsigned int cmd, struct obd_export *exp,
+ int len, void *karg, void *uarg)
+{
+ struct obd_device *obd = exp->exp_obd;
+ int rc = 0;
+ ENTRY;
+
+ switch (cmd) {
+ case OBD_IOC_CMOBD_SYNC: /* trigger reintegration */
+ rc = cmobd_reintegrate(obd);
+ break;
+ default:
+ CERROR("unrecognized ioctl %#x\n", cmd);
+ rc = -EINVAL;
+ break;
+ }
+
+ RETURN(rc);
+}
+
+static struct obd_ops cmobd_ops = {
+ o_owner: THIS_MODULE,
+ o_attach: cmobd_attach,
+ o_detach: cmobd_detach,
+ o_setup: cmobd_setup,
+ o_cleanup: cmobd_cleanup,
+ o_iocontrol: cmobd_iocontrol,
+};
+
+kmem_cache_t *cmobd_extent_slab;
+
+static int __init cmobd_init(void)
+{
+ struct lprocfs_static_vars lvars;
+ int rc;
+ ENTRY;
+
+ printk(KERN_INFO "Lustre: Cache Manager OBD driver; info@clusterfs.com\n");
+
+ lprocfs_init_vars(cmobd, &lvars);
+ rc = class_register_type(&cmobd_ops, NULL, lvars.module_vars,
+ LUSTRE_CMOBD_NAME);
+ if (rc)
+ RETURN(rc);
+ cmobd_extent_slab = kmem_cache_create("cmobd_extents",
+ sizeof(struct cmobd_extent_info), 0,
+ SLAB_HWCACHE_ALIGN, NULL, NULL);
+ if (cmobd_extent_slab == NULL) {
+ class_unregister_type(LUSTRE_CMOBD_NAME);
+ RETURN(-ENOMEM);
+ }
+ RETURN(0);
+}
+
+static void /*__exit*/ cmobd_exit(void)
+{
+ class_unregister_type(LUSTRE_CMOBD_NAME);
+ if (kmem_cache_destroy(cmobd_extent_slab) != 0)
+ CERROR("couldn't free cmobd extent slab\n");
+}
+
+MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_DESCRIPTION("Lustre Cache Manager OBD driver");
+MODULE_LICENSE("GPL");
+
+module_init(cmobd_init);
+module_exit(cmobd_exit);
#include <linux/lustre_fsfilt.h>
#include <linux/lustre_smfs.h>
-#include "cmobd_internal.h"
+#include "cm_internal.h"
-int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count, int pattern);
void lov_free_memmd(struct lov_stripe_md **lsmp);
-int smfs_rec_unpack(struct smfs_proc_args *args, char *record, char **pbuf,
- int *opcode);
+
+int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count,
+ int pattern);
+
+int smfs_rec_unpack(struct smfs_proc_args *args, char *record,
+ char **pbuf, int *opcode);
/* helper functions for cmobd to construct pseudo lsm */
int cmobd_dummy_lsm(struct lov_stripe_md **lsmp, int stripe_cnt,
}
/* reintegration functions */
-int cmobd_reint_setattr(struct obd_device *obd, void *rec)
+static int cmobd_setattr_reint(struct obd_device *obd, void *rec)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
- struct obd_export *exp = cmobd->cm_master_exp;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct lov_obd *lov = &cmobd->master_obd->u.lov;
+ struct obd_export *exp = cmobd->master_exp;
struct lov_stripe_md *lsm;
struct obdo *oa = (struct obdo*)rec;
int rc;
RETURN(rc);
}
-int cmobd_reint_create(struct obd_device *obd, void *rec)
+static int cmobd_create_reint(struct obd_device *obd, void *rec)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
- struct obd_export *exp = cmobd->cm_master_exp;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct lov_obd *lov = &cmobd->master_obd->u.lov;
+ struct obd_export *exp = cmobd->master_exp;
struct lov_stripe_md *lsm;
struct obd_trans_info oti = { 0 };
struct obdo *oa=(struct obdo*)rec;
(__u32)lov->desc.ld_default_stripe_size);
if (rc)
GOTO(out, rc);
- if (cmobd->cm_master_group != oa->o_gr) {
+ if (cmobd->master_group != oa->o_gr) {
int group = oa->o_gr;
int valsize = sizeof(group);
rc = obd_set_info(exp, strlen("mds_conn"), "mds_conn",
valsize, &group);
if (rc)
GOTO(out, rc = -EINVAL);
- cmobd->cm_master_group = oa->o_gr;
+ cmobd->master_group = oa->o_gr;
}
rc = obd_create(exp, oa, &lsm, &oti);
static int cmobd_write_extents(struct obd_device *obd, struct obdo *oa,
struct ldlm_extent *extent)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct obd_device *cache = cmobd->cm_cache_obd;
- struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct obd_device *cache = cmobd->cache_obd;
+ struct lov_obd *lov = &cmobd->master_obd->u.lov;
struct ldlm_res_id res_id;
ldlm_policy_data_t policy;
struct lustre_handle lockh_src = { 0 };
if (rc)
GOTO(out_lock, rc);
- rc = obd_enqueue(cmobd->cm_master_exp, lsm, LDLM_EXTENT, &policy,
+ rc = obd_enqueue(cmobd->master_exp, lsm, LDLM_EXTENT, &policy,
LCK_PW, &flags, master_blocking_ast,
ldlm_completion_ast, NULL,
NULL, 0, NULL, &lockh_dst);
err = cmobd_replay_write(obd, oa, &policy.l_extent);
- rc = obd_cancel(cmobd->cm_master_exp, lsm, LCK_PW, &lockh_dst);
+ rc = obd_cancel(cmobd->master_exp, lsm, LCK_PW, &lockh_dst);
if (rc)
GOTO(out_lsm, rc);
/* XXX in fact, I just want to cancel the only lockh_dst
* instantly. */
- rc = obd_cancel_unused(cmobd->cm_master_exp, lsm, 0, NULL);
+ rc = obd_cancel_unused(cmobd->master_exp, lsm, 0, NULL);
if (err)
rc = err;
out_lsm:
ldlm_lock_decref(&lockh_src, LCK_PR);
RETURN(rc);
}
-int cmobd_reint_write(struct obd_device *obd, void *rec)
+
+static int cmobd_write_reint(struct obd_device *obd, void *rec)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct obd_device *cache = cmobd->cm_cache_obd;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct obd_device *cache = cmobd->cache_obd;
struct obdo *oa = (struct obdo *)rec;
struct ldlm_extent *extent = NULL;
unsigned long csb, ino;
size = sizeof(csb);
- obd_get_info(cmobd->cm_cache_exp, strlen("cache_sb") + 1,
+ obd_get_info(cmobd->cache_exp, strlen("cache_sb") + 1,
"cache_sb", &size, &csb);
ino = *(int*)(&oa->o_inline[0]);
}
out:
if (extents_buf)
- fsfilt_free_write_extents(cache, (struct super_block *)csb, ino,
- extents_buf, ext_num);
+ fsfilt_free_write_extents(cache, (struct super_block *)csb,
+ ino, extents_buf, ext_num);
RETURN(rc);
}
+int cmobd_reint_oss(struct obd_device *obd, void *record, int opcode)
+{
+ switch (opcode) {
+ case OST_CREATE:
+ return cmobd_create_reint(obd, record);
+ case OST_SETATTR:
+ return cmobd_setattr_reint(obd, record);
+ case OST_WRITE:
+ return cmobd_write_reint(obd, record);
+ default:
+ CERROR("unrecognized oss reint opcode %d\n",
+ opcode);
+ return -EINVAL;
+ }
+}
#include <linux/lustre_fsfilt.h>
#include <linux/lustre_smfs.h>
-#include "cmobd_internal.h"
+#include "cm_internal.h"
-static int cmobd_reint_record(int opcode, struct obd_device *obd, char *record)
+#define OSS_REINT(opcode) \
+({ \
+ int _opcode = (opcode); \
+ \
+ (_opcode == OST_CREATE || \
+ _opcode == OST_SETATTR || \
+ _opcode == OST_WRITE); \
+})
+
+#define MDS_REINT(opcode) \
+ ((opcode) == MDS_REINT)
+
+static int cmobd_reint_record(struct obd_device *obd,
+ void *record, int opcode)
{
- int rc = 0;
+ if (OSS_REINT(opcode))
+ return cmobd_reint_oss(obd, record, opcode);
- switch (opcode) {
- case OST_CREATE:
- rc = cmobd_reint_create(obd, record);
- break;
- case OST_SETATTR:
- rc = cmobd_reint_setattr(obd, record);
- break;
- case OST_WRITE:
- rc = cmobd_reint_write(obd, record);
- break;
- case MDS_REINT:
- rc = cmobd_reint_mds(obd, record);
- break;
- default:
- CERROR("unrecognized format %d\n", opcode);
- rc = -EINVAL;
- break;
- }
- return rc;
-}
-static int cmobd_reint_cb(struct llog_handle *llh, struct llog_rec_hdr *rec,
+ if (MDS_REINT(opcode))
+ return cmobd_reint_mds(obd, record, opcode);
+
+ CERROR("unrecognized reint opcode %d\n", opcode);
+ return -EINVAL;
+}
+
+static int cmobd_reint_cb(struct llog_handle *llh,
+ struct llog_rec_hdr *rec,
void *data)
{
struct obd_device *obd = (struct obd_device*)data;
CERROR("log is not plain log\n");
RETURN(-EINVAL);
}
+
if (rec->lrh_type != SMFS_UPDATE_REC)
RETURN(-EINVAL);
rc = smfs_rec_unpack(NULL, buf, &pbuf, &opcode);
if (rc)
GOTO(out, rc);
- rc = cmobd_reint_record(opcode, obd, pbuf);
+
+ rc = cmobd_reint_record(obd, pbuf, opcode);
if (rc)
GOTO(out, rc);
- /*delete this record*/
+
+ /* delete this record. */
rc = LLOG_DEL_RECORD;
out:
RETURN(rc);
int cmobd_reintegrate(struct obd_device *obd)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
+ struct cm_obd *cmobd = &obd->u.cm;
struct llog_ctxt *ctxt = NULL;
struct llog_handle *llh;
int val_size, rc = 0;
/* XXX just fetch the reintegration log context from
* cache ost directly, use logid later ?? */
val_size = sizeof(ctxt);
- rc = obd_get_info(cmobd->cm_cache_exp, strlen("reint_log") + 1,
+ rc = obd_get_info(cmobd->cache_exp, strlen("reint_log") + 1,
"reint_log", &val_size, &ctxt);
if (rc)
RETURN(rc);
RETURN(rc);
}
-
-
#include <asm/div64.h>
#include <linux/pagemap.h>
-#include "cmobd_internal.h"
+#include "cm_internal.h"
extern kmem_cache_t *cmobd_extent_slab;
valid_flags = OBD_MD_FLTYPE | OBD_MD_FLATIME;
if (cmd == OBD_BRW_WRITE) {
oa->o_valid |= OBD_MD_FLIFID;
- mdc_pack_fid(obdo_fid(oa), inode->i_ino, 0, inode->i_mode);
-
+
+ /* FIXME-UMKA: should be here some mds num and mds id? */
+ mdc_pack_id(obdo_id(oa), inode->i_ino, 0,
+ inode->i_mode, 0, 0);
valid_flags |= OBD_MD_FLMTIME | OBD_MD_FLCTIME;
}
obd_count oa_bufs,
struct cmobd_extent_set *set)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct obd_export *exp = cmobd->cm_master_exp;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct obd_export *exp = cmobd->master_exp;
struct cmobd_async_page *cmap = NULL;
obd_count i;
int rc = 0;
struct cmobd_extent_info *ei)
{
struct cmobd_extent_set *set = ei->ei_set;
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
+ struct cm_obd *cmobd = &obd->u.cm;
unsigned long flags;
struct obd_ioobj ioo;
struct niobuf_local *lnb;
obdo_to_ioobj(oa, &ioo);
ioo.ioo_bufcnt = oa_bufs;
- ret = obd_preprw(OBD_BRW_READ, cmobd->cm_cache_exp, oa, 1, &ioo,
+ ret = obd_preprw(OBD_BRW_READ, cmobd->cache_exp, oa, 1, &ioo,
oa_bufs, rnb, lnb, NULL);
if (ret)
GOTO(out, rc = ret);
if (rc)
CERROR("cmobd_send_pages failed %d\n", rc);
- rc = obd_commitrw(OBD_BRW_READ, cmobd->cm_cache_exp, oa, 1, &ioo,
+ rc = obd_commitrw(OBD_BRW_READ, cmobd->cache_exp, oa, 1, &ioo,
oa_bufs, lnb, NULL, ret);
/* countdown and wake up */
struct ptlrpc_svc_data *data = (struct ptlrpc_svc_data *)arg;
struct ptlrpc_thread *thread = data->thread;
struct obd_device *obd = data->dev;
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct cmobd_write_service *ws = cmobd->cm_write_srv;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct cmobd_write_service *ws = cmobd->write_srv;
struct cmobd_extent_info *extent = NULL;
unsigned long flags;
int rc;
ENTRY;
lock_kernel();
-
ptlrpc_daemonize();
SIGNAL_MASK_LOCK(current, flags);
* ptlrpc threads functions */
static int cmobd_start_thread(struct obd_device *obd, char *name)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct cmobd_write_service *ws = cmobd->cm_write_srv;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct cmobd_write_service *ws = cmobd->write_srv;
struct l_wait_info lwi = { 0 };
struct ptlrpc_svc_data d;
struct ptlrpc_thread *thread;
static void cmobd_stop_thread(struct obd_device *obd,
struct ptlrpc_thread *thread)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct cmobd_write_service *ws = cmobd->cm_write_srv;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct cmobd_write_service *ws = cmobd->write_srv;
struct l_wait_info lwi = { 0 };
unsigned long flags;
ENTRY;
static void cmobd_stop_all_threads(struct obd_device *obd)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct cmobd_write_service *ws = cmobd->cm_write_srv;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct cmobd_write_service *ws = cmobd->write_srv;
unsigned long flags;
struct ptlrpc_thread *thread;
ENTRY;
void cmobd_cleanup_write_srv(struct obd_device *obd)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
+ struct cm_obd *cmobd = &obd->u.cm;
struct list_head *pos, *n;
struct cmobd_extent_info *ei;
ENTRY;
cmobd_stop_all_threads(obd);
- list_for_each_safe(pos, n, &cmobd->cm_write_srv->ws_extents) {
+ list_for_each_safe(pos, n, &cmobd->write_srv->ws_extents) {
ei = list_entry(pos, struct cmobd_extent_info, ei_link);
list_del_init(&ei->ei_link);
OBD_FREE(ei, sizeof(*ei));
}
- OBD_FREE(cmobd->cm_write_srv, sizeof(*cmobd->cm_write_srv));
+ OBD_FREE(cmobd->write_srv, sizeof(*cmobd->write_srv));
EXIT;
}
int cmobd_init_write_srv(struct obd_device *obd)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
+ struct cm_obd *cmobd = &obd->u.cm;
struct cmobd_write_service *ws;
int rc;
ENTRY;
- OBD_ALLOC(cmobd->cm_write_srv, sizeof(*cmobd->cm_write_srv));
- if (cmobd->cm_write_srv == NULL)
+ OBD_ALLOC(cmobd->write_srv, sizeof(*cmobd->write_srv));
+ if (cmobd->write_srv == NULL)
RETURN(-ENOMEM);
- ws = cmobd->cm_write_srv;
+ ws = cmobd->write_srv;
INIT_LIST_HEAD(&ws->ws_threads);
spin_lock_init(&ws->ws_thread_lock);
static void cmobd_queue_extent(struct obd_device *obd,
struct cmobd_extent_info *ex)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct cmobd_write_service *ws = cmobd->cm_write_srv;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct cmobd_write_service *ws = cmobd->write_srv;
struct cmobd_extent_set *set = ex->ei_set;
unsigned long flags;
struct l_wait_info lwi = { 0 };
EXIT;
}
-static obd_size cmobd_fid2size(struct obd_export *exp, obd_id id, obd_gr grp)
+static obd_size cmobd_id2size(struct obd_export *exp, obd_id id, obd_gr grp)
{
struct lvfs_run_ctxt saved;
struct dentry *de = NULL;
push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
- de = obd_lvfs_fid2dentry(exp, id, 0, grp);
+ de = obd_lvfs_id2dentry(exp, id, 0, grp);
LASSERT(de);
size = de->d_inode->i_size;
int cmobd_replay_write(struct obd_device *obd, struct obdo *oa,
struct ldlm_extent *ext)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct lov_obd *lov = &cmobd->master_obd->u.lov;
struct lov_stripe_md *lsm = NULL;
struct cmobd_extent_set set;
struct cmobd_extent_info *ex;
set.es_extent.start = ext->start;
set.es_extent.end = ext->end;
set.es_lsm = lsm;
- set.es_exp = cmobd->cm_master_exp;
+ set.es_exp = cmobd->master_exp;
set.es_ext_sz = CMOBD_MAX_EXTENT_SZ;
set.es_count = 0;
memcpy(&set.es_oa, oa, sizeof(*oa));
set.es_extent.start -= set.es_extent.start & ~PAGE_MASK;
/* if the end of extent is EOF, set it as file size */
if (set.es_extent.end == OBD_OBJECT_EOF) {
- set.es_extent.end = cmobd_fid2size(cmobd->cm_cache_exp,
- oa->o_id, oa->o_gr) - 1;
+ set.es_extent.end = cmobd_id2size(cmobd->cache_exp,
+ oa->o_id, oa->o_gr) - 1;
if (set.es_extent.end <= 0)
GOTO(out, rc = 0);
}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2003 Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#ifndef CMOBD_INTERNAL_H
-#define CMOBD_INTERNAL_H
-
-/* cmobd_reint.c */
-int cmobd_reintegrate(struct obd_device *);
-int cmobd_dummy_lsm(struct lov_stripe_md **, int, struct obdo*, __u32);
-void cmobd_free_lsm(struct lov_stripe_md **);
-
-/* cmobd_write.c */
-int cmobd_replay_write(struct obd_device *, struct obdo*, struct ldlm_extent *);
-int cmobd_init_write_srv(struct obd_device *);
-void cmobd_cleanup_write_srv(struct obd_device *);
-
-int cmobd_reint_mds(struct obd_device*, void *record);
-int cmobd_reint_setattr(struct obd_device *obd, void *rec);
-int cmobd_reint_create(struct obd_device *obd, void *rec);
-int cmobd_reint_write(struct obd_device *obd, void *rec);
-
-#endif /* CMOBD_INTERNAL_H */
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001-2003 Cluster File Systems, Inc.
- *
- * This file is part of Lustre, http://www.sf.net/projects/lustre/
- *
- * 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.
- */
-
-#define DEBUG_SUBSYSTEM S_CMOBD
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/obd_class.h>
-#include <linux/lustre_net.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_smfs.h>
-#include "cmobd_internal.h"
-
-/* If mdc_setattr is called with an 'iattr', then it is a normal RPC that
- * should take the normal semaphore and go to the normal portal.
- *
- * If it is called with iattr->ia_valid & ATTR_FROM_OPEN, then it is a
- * magic open-path setattr that should take the setattr semaphore and
- * go to the setattr portal. */
-int cmobd_setattr_reint(struct obd_device *obd, struct ptlrpc_request *req)
-{
- struct mds_rec_setattr *rec;
- int size[1], rc = 0;
-
- ENTRY;
-
- rec = (struct mds_rec_setattr *)lustre_msg_buf(req->rq_reqmsg, 0, 0);
- if (!rec)
- RETURN (-EINVAL);
- if (rec->sa_valid & ATTR_FROM_OPEN)
- req->rq_request_portal = MDS_SETATTR_PORTAL; //XXX FIXME bug 249
-
- if (rec->sa_valid & (ATTR_MTIME | ATTR_CTIME))
- CDEBUG(D_INODE, "setting mtime %lu, ctime %lu\n",
- ((time_t)rec->sa_mtime),
- ((time_t)rec->sa_ctime));
- size[0] = sizeof(struct mds_body);
- req->rq_replen = lustre_msg_size(1, size);
-
- rc = mdc_reint(req, NULL, LUSTRE_IMP_FULL);
-
- if (rc == -ERESTARTSYS)
- rc = 0;
-
- RETURN(rc);
-}
-
-int cmobd_create_reint(struct obd_device *obd, struct ptlrpc_request *req)
-{
- int rc = 0, level, size[1];
- ENTRY;
-
- size[0] = sizeof(struct mds_body);
- req->rq_replen = lustre_msg_size(1, size);
-
- level = LUSTRE_IMP_FULL;
- resend:
- rc = mdc_reint(req, NULL, level);
- /* Resend if we were told to. */
- if (rc == -ERESTARTSYS) {
- level = LUSTRE_IMP_RECOVER;
- goto resend;
- }
-
- if (!rc)
- mdc_store_inode_generation(NULL, req, 0, 0);
-
- RETURN(rc);
-}
-
-int cmobd_unlink_reint(struct obd_device *obd, struct ptlrpc_request *req)
-{
- int rc = 0, size[3];
- ENTRY;
-
- size[0] = sizeof(struct mds_body);
- size[1] = obd->u.cli.cl_max_mds_easize;
- size[2] = obd->u.cli.cl_max_mds_cookiesize;
- req->rq_replen = lustre_msg_size(3, size);
-
- rc = mdc_reint(req, NULL, LUSTRE_IMP_FULL);
- if (rc == -ERESTARTSYS)
- rc = 0;
- RETURN(rc);
-}
-
-int cmobd_link_reint(struct obd_device *obd, struct ptlrpc_request *req)
-{
- int rc = 0, size[1];
- ENTRY;
-
- size[0] = sizeof(struct mds_body);
- req->rq_replen = lustre_msg_size(1, size);
-
- rc = mdc_reint(req, NULL, LUSTRE_IMP_FULL);
- if (rc == -ERESTARTSYS)
- rc = 0;
-
- RETURN(rc);
-}
-
-int cmobd_rename_reint(struct obd_device *obd, struct ptlrpc_request *req)
-{
- int rc = 0, size[2];
- ENTRY;
-
- size[0] = sizeof(struct mds_body);
- size[1] = obd->u.cli.cl_max_mds_easize;
- req->rq_replen = lustre_msg_size(2, size);
-
- rc = mdc_reint(req, NULL, LUSTRE_IMP_FULL);
- if (rc == -ERESTARTSYS)
- rc = 0;
-
- RETURN(rc);
-}
-
-typedef int (*cmobd_reint_mds_rec)(struct obd_device*,
- struct ptlrpc_request *req);
-
-static cmobd_reint_mds_rec cmobd_mds_reint[REINT_MAX + 1] = {
- [REINT_SETATTR] cmobd_setattr_reint,
- [REINT_CREATE] cmobd_create_reint,
- [REINT_LINK] cmobd_link_reint,
- [REINT_UNLINK] cmobd_unlink_reint,
- [REINT_RENAME] cmobd_rename_reint,
-};
-
-int cmobd_reint_mds(struct obd_device *obd, void* record)
-{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct ptlrpc_request *req;
- struct lustre_msg *msg;
- struct mds_kml_pack_info *mkpi;
- __u32 opcode;
- int rc = 0;
- mkpi = (struct mds_kml_pack_info *)record;
-
- req = ptlrpc_prep_req(class_exp2cliimp(cmobd->cm_master_exp),
- LUSTRE_MDS_VERSION, MDS_REINT,
- mkpi->mpi_bufcount, mkpi->mpi_size, NULL);
- if (req == NULL)
- RETURN(-ENOMEM);
- record += sizeof(*mkpi);
- msg = (struct lustre_msg *)record;
- opcode = (__u32)*(int*)lustre_msg_buf(msg, 0, 0);
- if (opcode > REINT_MAX || opcode <= 0) {
- CERROR("Unrecorgnized reint opcode %u in cmobd mds reint\n",
- opcode);
- GOTO(out, rc=-EINVAL);
- }
-
- memcpy(req->rq_reqmsg, record, mkpi->mpi_total_size);
- /*flags and opc will be rewrite, so reset here
- *FIXME maybe should set some flags in reint process*/
-
- req->rq_reqmsg->opc = MDS_REINT;
- req->rq_reqmsg->flags = 0;
-
- rc = cmobd_mds_reint[opcode](cmobd->cm_master_obd, req);
-out:
- ptlrpc_req_finished(req);
- return rc;
-}
-
{
struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
struct cache_obd *cobd = &obd->u.cobd;
-// struct lustre_handle real_conn = {0,}, cache_conn = {0,};
- struct lustre_handle cache_conn = {0,};
- struct obd_device *real;
+#if 0
+ struct lustre_handle master_conn = {0,};
+#endif
+ struct lustre_handle cache_conn = {0,};
+ struct obd_device *master;
struct obd_device *cache;
int rc;
ENTRY;
if (lcfg->lcfg_inllen1 == 0 || lcfg->lcfg_inlbuf1 == NULL) {
- CERROR("%s: setup requires real device name\n",
+ CERROR("%s: setup requires master device name\n",
obd->obd_name);
RETURN(-EINVAL);
}
- real = class_name2obd(lcfg->lcfg_inlbuf1);
- if (real == NULL) {
- CERROR("%s: unable to find a client for real: %s\n",
+ master = class_name2obd(lcfg->lcfg_inlbuf1);
+ if (master == NULL) {
+ CERROR("%s: unable to find a client for master: %s\n",
obd->obd_name, lcfg->lcfg_inlbuf1);
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
- cache = class_name2obd(lcfg->lcfg_inlbuf2);
+ cache = class_name2obd(lcfg->lcfg_inlbuf2);
if (cache == NULL) {
CERROR("%s: unable to find a client for cache: %s\n",
obd->obd_name, lcfg->lcfg_inlbuf2);
RETURN(-EINVAL);
}
- OBD_ALLOC(cobd->cobd_real_name, strlen(lcfg->lcfg_inlbuf1) + 1);
- if (!cobd->cobd_real_name)
+ OBD_ALLOC(cobd->master_name, strlen(lcfg->lcfg_inlbuf1) + 1);
+ if (!cobd->master_name)
GOTO(exit, rc = -ENOMEM);
- memcpy(cobd->cobd_real_name, lcfg->lcfg_inlbuf1,
+ memcpy(cobd->master_name, lcfg->lcfg_inlbuf1,
strlen(lcfg->lcfg_inlbuf1));
- OBD_ALLOC(cobd->cobd_cache_name, strlen(lcfg->lcfg_inlbuf2) + 1);
- if (!cobd->cobd_cache_name)
+ OBD_ALLOC(cobd->cache_name, strlen(lcfg->lcfg_inlbuf2) + 1);
+ if (!cobd->cache_name)
GOTO(exit, rc = -ENOMEM);
- memcpy(cobd->cobd_cache_name, lcfg->lcfg_inlbuf2,
+ memcpy(cobd->cache_name, lcfg->lcfg_inlbuf2,
strlen(lcfg->lcfg_inlbuf2));
#if 0
- /* don't bother checking attached/setup;
- * obd_connect() should, and it can change underneath us */
- rc = connect_to_obd(cobd->cobd_real_name, &real_conn);
+ /* don't bother checking attached/setup; obd_connect() should, and it
+ * can change underneath us */
+ rc = connect_to_obd(cobd->master_name, &master_conn);
if (rc != 0)
GOTO(exit, rc);
- cobd->cobd_real_exp = class_conn2export(&real_conn);
+ cobd->master_exp = class_conn2export(&master_conn);
#endif
- rc = connect_to_obd(cobd->cobd_cache_name, &cache_conn);
+ rc = connect_to_obd(cobd->cache_name, &cache_conn);
if (rc != 0) {
- obd_disconnect(cobd->cobd_cache_exp, 0);
+ obd_disconnect(cobd->cache_exp, 0);
GOTO(exit, rc);
}
- cobd->cobd_cache_exp = class_conn2export(&cache_conn);
-
+ cobd->cache_exp = class_conn2export(&cache_conn);
cobd->cache_on = 1;
- if (!strcmp(real->obd_type->typ_name, LUSTRE_MDC_NAME)) {
- /* set mds_num for lustre */
- int mds_num;
- mds_num = REAL_MDS_NUMBER;
- obd_set_info(cobd->cobd_real_exp, strlen("mds_num"),
- "mds_num", sizeof(mds_num), &mds_num);
- mds_num = CACHE_MDS_NUMBER;
- obd_set_info(cobd->cobd_cache_exp, strlen("mds_num"),
- "mds_num", sizeof(mds_num), &mds_num);
+
+ if (!strcmp(master->obd_type->typ_name, LUSTRE_MDC_NAME)) {
+ int mds_type;
+
+ mds_type = MDS_MASTER_OBD;
+ obd_set_info(cobd->master_exp, strlen("mds_type"),
+ "mds_type", sizeof(mds_type), &mds_type);
+
+ mds_type = MDS_CACHE_OBD;
+ obd_set_info(cobd->cache_exp, strlen("mds_type"),
+ "mds_type", sizeof(mds_type), &mds_type);
}
- /*default write to real obd*/
exit:
if (rc) {
- if (cobd->cobd_cache_name)
- OBD_FREE(cobd->cobd_cache_name,
- strlen(cobd->cobd_cache_name) + 1);
- if (cobd->cobd_real_name)
- OBD_FREE(cobd->cobd_real_name,
- strlen(cobd->cobd_real_name) + 1);
+ if (cobd->cache_name)
+ OBD_FREE(cobd->cache_name,
+ strlen(cobd->cache_name) + 1);
+ if (cobd->master_name)
+ OBD_FREE(cobd->master_name,
+ strlen(cobd->master_name) + 1);
}
RETURN(rc);
}
if (!list_empty(&obd->obd_exports))
return (-EBUSY);
- if (cobd->cobd_cache_name)
- OBD_FREE(cobd->cobd_cache_name,
- strlen(cobd->cobd_cache_name) + 1);
- if (cobd->cobd_real_name)
- OBD_FREE(cobd->cobd_real_name,
- strlen(cobd->cobd_real_name) + 1);
+ if (cobd->cache_name)
+ OBD_FREE(cobd->cache_name,
+ strlen(cobd->cache_name) + 1);
+ if (cobd->master_name)
+ OBD_FREE(cobd->master_name,
+ strlen(cobd->master_name) + 1);
if (cobd->cache_on) {
- rc = obd_disconnect(cobd->cobd_cache_exp, flags);
+ rc = obd_disconnect(cobd->cache_exp, flags);
if (rc != 0)
CERROR("error %d disconnecting cache\n", rc);
}
- rc = obd_disconnect(cobd->cobd_real_exp, flags);
+ rc = obd_disconnect(cobd->master_exp, flags);
if (rc != 0)
- CERROR("error %d disconnecting real\n", rc);
+ CERROR("error %d disconnecting master\n", rc);
return (rc);
}
struct cache_obd *cobd = &obd->u.cobd;
if (cobd->cache_on)
- return cobd->cobd_cache_exp;
+ return cobd->cache_exp;
else
- return cobd->cobd_real_exp;
+ return cobd->master_exp;
}
static int
cobd_connect(struct lustre_handle *conn, struct obd_device *obd,
struct obd_uuid *cluuid, unsigned long connect_flags)
{
- int rc;
- rc = class_connect(conn, obd, cluuid);
- return rc;
+ return class_connect(conn, obd, cluuid);
}
static int cobd_disconnect(struct obd_export *exp, int flags)
{
- int rc;
- rc = class_disconnect(exp, 0);
- return rc;
+ return class_disconnect(exp, 0);
}
static int cobd_get_info(struct obd_export *exp, obd_count keylen,
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_export *cobd_exp;
+
if (obd == NULL) {
CERROR("invalid client cookie "LPX64"\n",
exp->exp_handle.h_cookie);
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- /* intercept cache utilisation info? */
+ /* intercept cache utilisation info? */
return obd_get_info(cobd_exp, keylen, key, vallen, val);
}
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
+
/* intercept cache utilisation info? */
-
return obd_set_info(cobd_exp, keylen, key, vallen, val);
}
static int cobd_precleanup(struct obd_device *obd, int flags)
{
- /*FIXME Do we need some cleanup here?*/
+ /* FIXME-WANGDI: do we need some cleanup here? */
return 0;
}
}
static int cobd_getattr_async(struct obd_export *exp,
- struct obdo *obdo, struct lov_stripe_md *ea,
- struct ptlrpc_request_set *set)
+ struct obdo *obdo, struct lov_stripe_md *ea,
+ struct ptlrpc_request_set *set)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_export *cobd_exp;
return obd_setattr(cobd_exp, obdo, ea, oti);
}
-static int cobd_md_getstatus(struct obd_export *exp, struct ll_fid *rootfid)
+static int cobd_md_getstatus(struct obd_export *exp,
+ struct lustre_id *rootid)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_export *cobd_exp;
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_getstatus(cobd_exp, rootfid);
+ return md_getstatus(cobd_exp, rootid);
}
static int cobd_brw(int cmd, struct obd_export *exp, struct obdo *oa,
static int cobd_flush(struct obd_device *obd)
{
- /*FLUSH the filesystem from the cache
- *to the real device */
+ /* flush the filesystem from the cache to the real device. */
return 0;
}
{
struct obd_device *obd = class_exp2obd(exp);
struct cache_obd *cobd = &obd->u.cobd;
- struct obd_device *real_dev = NULL;
+ struct obd_device *master_dev = NULL;
struct obd_export *cobd_exp;
int rc = 0;
if (!cobd->cache_on) {
struct lustre_handle cache_conn = {0,};
- rc = obd_disconnect(cobd->cobd_real_exp, 0);
+ rc = obd_disconnect(cobd->master_exp, 0);
if (rc != 0)
- CERROR("error %d disconnecting real\n", rc);
- rc = connect_to_obd(cobd->cobd_cache_name, &cache_conn);
+ CERROR("error %d disconnecting master\n", rc);
+ rc = connect_to_obd(cobd->cache_name, &cache_conn);
if (rc != 0)
RETURN(rc);
- cobd->cobd_cache_exp = class_conn2export(&cache_conn);
+ cobd->cache_exp = class_conn2export(&cache_conn);
cobd->cache_on = 1;
}
break;
case OBD_IOC_COBD_COFF:
if (cobd->cache_on) {
- struct lustre_handle real_conn = {0,};
+ struct lustre_handle master_conn = {0,};
struct obd_device *cache_dev = NULL;
int m_easize, m_cooksize;
- cache_dev = class_exp2obd(cobd->cobd_cache_exp);
+ cache_dev = class_exp2obd(cobd->cache_exp);
m_easize = cache_dev->u.cli.cl_max_mds_easize;
m_cooksize = cache_dev->u.cli.cl_max_mds_cookiesize;
- rc = obd_disconnect(cobd->cobd_cache_exp, 0);
+ rc = obd_disconnect(cobd->cache_exp, 0);
if (rc != 0)
- CERROR("error %d disconnecting real\n", rc);
+ CERROR("error %d disconnecting master\n", rc);
- /*FIXME, should read from real_dev*/
+ /* FIXME-WANGDI: should we read from master_dev? */
- rc = connect_to_obd(cobd->cobd_real_name, &real_conn);
+ rc = connect_to_obd(cobd->master_name, &master_conn);
if (rc != 0)
RETURN(rc);
- cobd->cobd_real_exp = class_conn2export(&real_conn);
- real_dev = class_exp2obd(cobd->cobd_real_exp);
- real_dev->u.cli.cl_max_mds_easize = m_easize;
- real_dev->u.cli.cl_max_mds_cookiesize = m_cooksize;
+ cobd->master_exp = class_conn2export(&master_conn);
+ master_dev = class_exp2obd(cobd->master_exp);
+ master_dev->u.cli.cl_max_mds_easize = m_easize;
+ master_dev->u.cli.cl_max_mds_cookiesize = m_cooksize;
cobd->cache_on = 0;
}
break;
return 0;
}
-static int cobd_md_getattr(struct obd_export *exp, struct ll_fid *fid,
+static int cobd_md_getattr(struct obd_export *exp, struct lustre_id *id,
unsigned long valid, unsigned int ea_size,
struct ptlrpc_request **request)
{
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_getattr(cobd_exp, fid, valid, ea_size, request);
+ return md_getattr(cobd_exp, id, valid, ea_size, request);
}
static int cobd_md_req2lustre_md (struct obd_export *mdc_exp,
return md_req2lustre_md(cobd_exp, req, offset, osc_exp, md);
}
-static int cobd_md_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
+static int cobd_md_change_cbdata(struct obd_export *exp, struct lustre_id *id,
ldlm_iterator_t it, void *data)
{
struct obd_device *obd = class_exp2obd(exp);
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_change_cbdata(cobd_exp, fid, it, data);
+ return md_change_cbdata(cobd_exp, id, it, data);
}
-static int cobd_md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
- char *filename, int namelen,
- unsigned long valid,
- unsigned int ea_size,
- struct ptlrpc_request **request)
+static int cobd_md_getattr_name(struct obd_export *exp, struct lustre_id *id,
+ char *filename, int namelen, unsigned long valid,
+ unsigned int ea_size, struct ptlrpc_request **request)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_export *cobd_exp;
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_getattr_name(cobd_exp, fid, filename, namelen, valid,
+ return md_getattr_name(cobd_exp, id, filename, namelen, valid,
ea_size, request);
}
return md_unlink(cobd_exp, data, request);
}
-static int cobd_md_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
+static int cobd_md_valid_attrs(struct obd_export *exp,
+ struct lustre_id *id)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_export *cobd_exp;
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_valid_attrs(cobd_exp, fid);
+ return md_valid_attrs(cobd_exp, id);
}
static int cobd_md_rename(struct obd_export *exp, struct mdc_op_data *data,
return md_setattr(cobd_exp, data, iattr, ea, ealen, ea2, ea2len, request);
}
-static int cobd_md_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
+static int cobd_md_readpage(struct obd_export *exp,
+ struct lustre_id *mdc_id,
__u64 offset, struct page *page,
struct ptlrpc_request **request)
{
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_readpage(cobd_exp, mdc_fid, offset, page, request);
+ return md_readpage(cobd_exp, mdc_id, offset, page, request);
}
static int cobd_md_close(struct obd_export *exp, struct obdo *obdo,
return md_done_writing(cobd_exp, obdo);
}
-static int cobd_md_sync(struct obd_export *exp, struct ll_fid *fid,
+static int cobd_md_sync(struct obd_export *exp, struct lustre_id *id,
struct ptlrpc_request **request)
{
struct obd_device *obd = class_exp2obd(exp);
}
cobd_exp = cobd_get_exp(obd);
- return md_sync(cobd_exp, fid, request);
+ return md_sync(cobd_exp, id, request);
}
static int cobd_md_set_open_replay_data(struct obd_export *exp,
cb_data);
}
-static int cobd_md_intent_lock(struct obd_export *exp,
- struct ll_fid *pfid, const char *name, int len,
- void *lmm, int lmmsize,
- struct ll_fid *cfid, struct lookup_intent *it,
+static int cobd_md_intent_lock(struct obd_export *exp, struct lustre_id *pid,
+ const char *name, int len, void *lmm, int lmmsize,
+ struct lustre_id *cid, struct lookup_intent *it,
int lookup_flags, struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking)
{
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_intent_lock(cobd_exp, pfid, name, len, lmm, lmmsize,
- cfid, it, lookup_flags, reqp, cb_blocking);
+ return md_intent_lock(cobd_exp, pid, name, len, lmm, lmmsize,
+ cid, it, lookup_flags, reqp, cb_blocking);
}
-static struct obd_device * cobd_md_get_real_obd(struct obd_export *exp,
- char *name, int len)
+static struct obd_device *cobd_md_get_real_obd(struct obd_export *exp,
+ char *name, int len)
{
struct obd_device *obd = class_exp2obd(exp);
struct obd_export *cobd_exp;
}
static int cobd_md_change_cbdata_name(struct obd_export *exp,
- struct ll_fid *fid, char *name,
- int namelen, struct ll_fid *fid2,
+ struct lustre_id *id, char *name,
+ int namelen, struct lustre_id *id2,
ldlm_iterator_t it, void *data)
{
struct obd_device *obd = class_exp2obd(exp);
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_change_cbdata_name(cobd_exp, fid, name, namelen, fid2, it,
- data);
+ return md_change_cbdata_name(cobd_exp, id, name, namelen,
+ id2, it, data);
}
static struct obd_ops cobd_obd_ops = {
.o_owner = THIS_MODULE,
rc = snprintf(page, count, "not set up\n");
} else {
struct obd_device *tgt =
- class_exp2obd(cobd->u.cobd.cobd_real_exp);
+ class_exp2obd(cobd->u.cobd.master_exp);
LASSERT(tgt != NULL);
rc = snprintf(page, count, "%s\n", tgt->obd_uuid.uuid);
}
rc = snprintf(page, count, "not set up\n");
} else {
struct obd_device *cache =
- class_exp2obd(cobd->u.cobd.cobd_cache_exp);
+ class_exp2obd(cobd->u.cobd.cache_exp);
LASSERT(cache != NULL);
rc = snprintf(page, count, "%s\n", cache->obd_uuid.uuid);
}
#define PAGE_LIST_ENTRY list
#define PAGE_LIST(page) ((page)->list)
+#define page_address(page) ((page)->addr)
#define kmap(page) (page)->addr
#define kunmap(a) do {} while (0)
struct iattr *iattr, int do_trunc);
int (* fs_iocontrol)(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
+
+ /* two methods for getting lov EA and setting it back to inode xattr. */
int (* fs_set_md)(struct inode *inode, void *handle, void *md,
int size);
int (* fs_get_md)(struct inode *inode, void *md, int size);
+ /* two methods for getting MID (master id) EA and setting it back to
+ * inode xattr. */
+ int (* fs_set_mid)(struct inode *inode, void *handle, void *fid,
+ int size);
+ int (* fs_get_mid)(struct inode *inode, void *fid, int size);
+
+ /* two methods for getting self id EA and setting it back to inode
+ * xattr. */
+ int (* fs_set_sid)(struct inode *inode, void *handle, void *sid,
+ int size);
+ int (* fs_get_sid)(struct inode *inode, void *sid, int size);
+
/* this method is needed to make IO operation fsfilt nature depend. */
int (* fs_send_bio)(int rw, struct inode *inode,struct kiobuf *bio);
int (* fs_get_op_len)(int, struct fsfilt_objinfo *, int);
int (* fs_add_dir_entry)(struct obd_device *, struct dentry *,
char *, int, unsigned long, unsigned long,
- unsigned);
+ unsigned long, unsigned long);
int (* fs_del_dir_entry)(struct obd_device *, struct dentry *);
/*snap operations*/
int (* fs_is_redirector)(struct inode *inode);
return obd->obd_fsops->fs_setup(obd, fs);
return 0;
}
+
static inline int
fsfilt_set_md(struct obd_device *obd, struct inode *inode,
void *handle, void *md, int size)
return obd->obd_fsops->fs_get_md(inode, md, size);
}
+static inline int
+fsfilt_set_mid(struct obd_device *obd, struct inode *inode,
+ void *handle, void *mid, int size)
+{
+ return obd->obd_fsops->fs_set_mid(inode, handle, mid, size);
+}
+
+static inline int
+fsfilt_get_mid(struct obd_device *obd, struct inode *inode,
+ void *mid, int size)
+{
+ return obd->obd_fsops->fs_get_mid(inode, mid, size);
+}
+
+static inline int
+fsfilt_set_sid(struct obd_device *obd, struct inode *inode,
+ void *handle, void *sid, int size)
+{
+ return obd->obd_fsops->fs_set_sid(inode, handle, sid, size);
+}
+
+static inline int
+fsfilt_get_sid(struct obd_device *obd, struct inode *inode,
+ void *sid, int size)
+{
+ return obd->obd_fsops->fs_get_sid(inode, sid, size);
+}
+
static inline int fsfilt_send_bio(int rw, struct obd_device *obd,
struct inode *inode, void *bio)
{
static inline int
fsfilt_add_journal_cb(struct obd_device *obd, struct super_block *sb,
- __u64 last_rcvd, void *handle, fsfilt_cb_t cb_func,
+ __u64 last_num, void *handle, fsfilt_cb_t cb_func,
void *cb_data)
{
- return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_rcvd, handle,
+ return obd->obd_fsops->fs_add_journal_cb(obd, sb, last_num, handle,
cb_func, cb_data);
}
static inline int
fsfilt_add_dir_entry(struct obd_device *obd, struct dentry *dir,
char *name, int namelen, unsigned long ino,
- unsigned long generation, unsigned mds)
+ unsigned long generation, unsigned long mds,
+ unsigned long fid)
{
LASSERT(obd->obd_fsops->fs_add_dir_entry);
+
return obd->obd_fsops->fs_add_dir_entry(obd, dir, name,
- namelen, ino, generation, mds);
+ namelen, ino,
+ generation, mds,
+ fid);
}
static inline int
#define OBD_FL_RECREATE_OBJS (0x00000020) // recreate missing obj
#define OBD_FL_DEBUG_CHECK (0x00000040) /* echo client/server debug check */
-#define OBD_INLINESZ 64
+/* this should be sizeof(struct lustre_handle) + sizeof(struct llog_cookie) +
+ * sizeof(struct lustre_id). */
+#define OBD_INLINESZ (80)
/* Note: 64-bit types are 64-bit aligned in structure */
struct obdo {
obd_count o_misc; /* brw: o_dropped */
__u32 o_easize; /* epoch in ost writes */
__u32 o_mds;
+ __u64 o_fid;
__u32 o_padding;
char o_inline[OBD_INLINESZ]; /* fid in ost writes */
};
#define OBD_MD_FLGRANT (0x08000000) /* ost preallocation space grant */
#define OBD_MD_MDS (0x10000000) /* where an inode lives on */
#define OBD_MD_FLDIREA (0x20000000) /* dir's extended attribute data */
-#define OBD_MD_REINT (0x40000000) /* reintegrate oa*/
-#define OBD_MD_FLNOTOBD (~(OBD_MD_FLBLOCKS | OBD_MD_LINKNAME|\
- OBD_MD_FLEASIZE | OBD_MD_FLHANDLE | OBD_MD_FLCKSUM|\
- OBD_MD_FLQOS | OBD_MD_FLOSCOPQ | OBD_MD_FLCOOKIE|\
+#define OBD_MD_REINT (0x40000000) /* reintegrate oa */
+#define OBD_MD_FID (0x80000000) /* take care about fid component */
+#define OBD_MD_FLNOTOBD (~(OBD_MD_FLBLOCKS | OBD_MD_LINKNAME | \
+ OBD_MD_FLEASIZE | OBD_MD_FLHANDLE | OBD_MD_FLCKSUM | \
+ OBD_MD_FLQOS | OBD_MD_FLOSCOPQ | OBD_MD_FLCOOKIE| \
OBD_MD_MDS))
-
static inline struct lustre_handle *obdo_handle(struct obdo *oa)
{
return (struct lustre_handle *)oa->o_inline;
return (struct llog_cookie *)(oa->o_inline +
sizeof(struct lustre_handle));
}
-/* don't forget obdo_fid which is way down at the bottom so it can
- * come after the definition of llog_cookie */
+/* don't forget obdo_fid which is way down at the bottom so it can come after
+ * the definition of llog_cookie */
struct obd_statfs {
__u64 os_type;
__u64 os_blocks;
extern void lustre_swab_ost_body (struct ost_body *b);
extern void lustre_swab_ost_last_id(obd_id *id);
+extern void lustre_swab_generic_32s(__u32 *val);
/* lock value block communicated between the filter and llite */
* Do not exceed 63
*/
-#define REINT_SETATTR 1
-#define REINT_CREATE 2
-#define REINT_LINK 3
-#define REINT_UNLINK 4
-#define REINT_RENAME 5
-#define REINT_OPEN 6
-#define REINT_CLOSE 7
-#define REINT_WRITE 8
-#define REINT_MAX 8
+#define REINT_SETATTR 1
+#define REINT_CREATE 2
+#define REINT_LINK 3
+#define REINT_UNLINK 4
+#define REINT_RENAME 5
+#define REINT_OPEN 6
+#define REINT_CLOSE 7
+#define REINT_WRITE 8
+#define REINT_MAX 8
/* the disposition of the intent outlines what was executed */
-#define DISP_IT_EXECD 0x01
-#define DISP_LOOKUP_EXECD 0x02
-#define DISP_LOOKUP_NEG 0x04
-#define DISP_LOOKUP_POS 0x08
-#define DISP_OPEN_CREATE 0x10
-#define DISP_OPEN_OPEN 0x20
-#define DISP_ENQ_COMPLETE 0x40
+#define DISP_IT_EXECD (1 << 0)
+#define DISP_LOOKUP_EXECD (1 << 1)
+#define DISP_LOOKUP_NEG (1 << 2)
+#define DISP_LOOKUP_POS (1 << 3)
+#define DISP_OPEN_CREATE (1 << 4)
+#define DISP_OPEN_OPEN (1 << 5)
+#define DISP_ENQ_COMPLETE (1 << 6)
/* INODE LOCK PARTS */
-#define MDS_INODELOCK_LOOKUP 0x000001 /* dentry, mode, owner, group */
-#define MDS_INODELOCK_UPDATE 0x000002 /* size, links, timestamps */
-//#define MDS_INODELOCK_MAXSHIFT 1
-//#define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
-
-struct ll_fid {
- __u64 id;
- __u32 generation;
- __u32 f_type;
- __u32 mds;
- __u32 padding;
+#define MDS_INODELOCK_LOOKUP 0x000001 /* dentry, mode, owner, group */
+#define MDS_INODELOCK_UPDATE 0x000002 /* size, links, timestamps */
+
+/* lustre store cookie */
+struct lustre_stc {
+ union {
+ struct {
+ __u64 l3s_ino; /* inode number on local MDS */
+ __u32 l3s_gen; /* inode generation */
+ __u32 l3s_type; /* inode type */
+ } e3s;
+ } u;
+};
+
+/* lustre file id */
+struct lustre_fid {
+ __u64 lf_id; /* fid counter maintained on per
+ group basis */
+ __u64 lf_group; /* sequence group num */
+ __u32 lf_version; /* what snapfs version of inode */
+ __u32 lf_padding;
+};
+
+struct lustre_id {
+ struct lustre_stc li_stc; /* store cookie */
+ struct lustre_fid li_fid; /* fid cookie */
};
struct mea_old {
__u32 mea_count;
__u32 mea_master;
- struct ll_fid mea_fids[0];
+ struct lustre_id mea_ids[0];
};
#define MEA_MAGIC_LAST_CHAR 0xb2221ca1
__u32 mea_magic;
__u32 mea_count;
__u32 mea_master;
- struct ll_fid mea_fids[0];
+ struct lustre_id mea_ids[0];
};
-extern void lustre_swab_ll_fid (struct ll_fid *fid);
-
#define MDS_STATUS_CONN 1
#define MDS_STATUS_LOV 2
__u32 repbuf;
};
+extern void lustre_swab_lustre_id(struct lustre_id *id);
+extern void lustre_swab_lustre_stc(struct lustre_stc *stc);
+extern void lustre_swab_lustre_fid(struct lustre_fid *fid);
extern void lustre_swab_mds_status_req (struct mds_status_req *r);
#define MDS_BFLAG_UNCOMMITTED_WRITES 0x1
struct mds_body {
- struct ll_fid fid1;
- struct ll_fid fid2;
+ struct lustre_id id1;
+ struct lustre_id id2;
struct lustre_handle handle;
__u64 size; /* Offset, in the case of MDS_READPAGE */
__u64 blocks; /* XID, in the case of MDS_READPAGE */
__u64 io_epoch;
- __u32 ino; /* make this a __u64 */
__u32 valid;
__u32 mode;
__u32 uid;
__u32 mtime;
__u32 ctime;
__u32 atime;
- __u32 flags; /* from vfs for pin/unpin, MDS_BFLAG for close */
+ __u32 flags; /* from vfs for pin/unpin, MDS_BFLAG for close */
__u32 rdev;
- __u32 nlink; /* #bytes to read in the case of MDS_READPAGE */
- __u32 generation;
+ __u32 nlink; /* #bytes to read in the case of MDS_READPAGE */
__u32 eadatasize;
- __u32 mds;
};
extern void lustre_swab_mds_body (struct mds_body *b);
};
struct mdc_op_data {
- struct ll_fid fid1;
- struct ll_fid fid2;
+ struct lustre_id id1;
+ struct lustre_id id2;
__u64 mod_time;
const char *name;
int namelen;
__u32 create_mode;
struct mea *mea1; /* mea of inode1 */
struct mea *mea2; /* mea of inode2 */
+ __u32 valid;
};
#define MDS_MODE_DONT_LOCK (1 << 30)
#define MDS_MODE_REPLAY (1 << 31)
struct mds_rec_setattr {
- __u32 sa_opcode;
- __u32 sa_valid;
- struct ll_fid sa_fid;
- __u32 sa_mode;
- __u32 sa_uid;
- __u32 sa_gid;
- __u32 sa_attr_flags;
- __u64 sa_size;
- __u64 sa_atime;
- __u64 sa_mtime;
- __u64 sa_ctime;
+ __u32 sa_opcode;
+ __u32 sa_valid;
+ struct lustre_id sa_id;
+ __u32 sa_mode;
+ __u32 sa_uid;
+ __u32 sa_gid;
+ __u32 sa_attr_flags;
+ __u64 sa_size;
+ __u64 sa_atime;
+ __u64 sa_mtime;
+ __u64 sa_ctime;
};
/* Remove this once we declare it in include/linux/fs.h (v21 kernel patch?) */
#define MDS_OPEN_SYNC 00010000
#define MDS_OPEN_DIRECTORY 00200000
-#define MDS_OPEN_DELAY_CREATE 0100000000 /* delay initial object create */
-#define MDS_OPEN_HAS_EA 010000000000 /* specify object create pattern */
-#define MDS_OPEN_HAS_OBJS 020000000000 /* Just set the EA the obj exist */
+#define MDS_OPEN_DELAY_CREATE 0100000000 /* delay initial object create */
+#define MDS_OPEN_HAS_EA 010000000000 /* specify object create pattern */
+#define MDS_OPEN_HAS_OBJS 020000000000 /* Just set the EA the obj exist */
struct mds_rec_create {
- __u32 cr_opcode;
- __u32 cr_flags; /* for use with open */
- __u32 cr_mode;
- __u32 cr_padding;
- struct ll_fid cr_fid;
- struct ll_fid cr_replayfid;
- __u64 cr_time;
- __u64 cr_rdev;
+ __u32 cr_opcode;
+ __u32 cr_flags; /* for use with open */
+ __u32 cr_mode;
+ __u32 cr_padding;
+ struct lustre_id cr_id;
+ struct lustre_id cr_replayid;
+ __u64 cr_time;
+ __u64 cr_rdev;
};
extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
struct mds_rec_link {
- __u32 lk_opcode;
- __u32 lk_padding;
- struct ll_fid lk_fid1;
- struct ll_fid lk_fid2;
- __u64 lk_time;
+ __u32 lk_opcode;
+ __u32 lk_padding;
+ struct lustre_id lk_id1;
+ struct lustre_id lk_id2;
+ __u64 lk_time;
};
extern void lustre_swab_mds_rec_link (struct mds_rec_link *lk);
struct mds_rec_unlink {
- __u32 ul_opcode;
- __u32 ul_mode;
- struct ll_fid ul_fid1;
- struct ll_fid ul_fid2;
- __u64 ul_time;
+ __u32 ul_opcode;
+ __u32 ul_mode;
+ struct lustre_id ul_id1;
+ struct lustre_id ul_id2;
+ __u64 ul_time;
};
extern void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul);
struct mds_rec_rename {
- __u32 rn_opcode;
- __u32 rn_padding;
- struct ll_fid rn_fid1;
- struct ll_fid rn_fid2;
- __u64 rn_time;
+ __u32 rn_opcode;
+ __u32 rn_padding;
+ struct lustre_id rn_id1;
+ struct lustre_id rn_id2;
+ __u64 rn_time;
};
extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn);
* ptlbd, portal block device requests
*/
typedef enum {
- PTLBD_QUERY = 200,
- PTLBD_READ = 201,
- PTLBD_WRITE = 202,
- PTLBD_FLUSH = 203,
- PTLBD_CONNECT = 204,
+ PTLBD_QUERY = 200,
+ PTLBD_READ = 201,
+ PTLBD_WRITE = 202,
+ PTLBD_FLUSH = 203,
+ PTLBD_CONNECT = 204,
PTLBD_DISCONNECT = 205,
PTLBD_LAST_OPC
} ptlbd_cmd_t;
struct llog_create_rec {
struct llog_rec_hdr lcr_hdr;
- struct ll_fid lcr_fid;
+ struct lustre_id lcr_id;
obd_id lcr_oid;
obd_count lcr_ogen;
__u32 padding;
struct llog_size_change_rec {
struct llog_rec_hdr lsc_hdr;
- struct ll_fid lsc_fid;
+ struct lustre_id lsc_id;
__u32 lsc_io_epoch;
__u32 padding;
struct llog_rec_tail lsc_tail;
struct llog_lru_rec {
struct llog_rec_hdr llr_hdr;
- struct ll_fid llr_cfid;
- struct ll_fid llr_pfid;
+ struct lustre_id llr_cid;
+ struct lustre_id llr_pid;
struct llog_rec_tail llr_tail;
} __attribute__((packed));
extern void lustre_swab_llog_hdr (struct llog_log_hdr *h);
extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);
-static inline struct ll_fid *obdo_fid(struct obdo *oa)
+static inline struct lustre_id *obdo_id(struct obdo *oa)
{
- return (struct ll_fid *)(oa->o_inline + sizeof(struct lustre_handle) +
- sizeof(struct llog_cookie));
+ void *raw_id = oa->o_inline + sizeof(struct lustre_handle) +
+ sizeof(struct llog_cookie);
+
+ return (struct lustre_id *)raw_id;
}
#endif
#endif
#endif
+/* lustre_id output helper macros */
+#define DLID4 "%lu/%lu/%lu/%lu"
+
+#define OLID4(id) \
+ (unsigned long)(id)->li_fid.lf_id, \
+ (unsigned long)(id)->li_fid.lf_group, \
+ (unsigned long)(id)->li_stc.u.e3s.l3s_ino, \
+ (unsigned long)(id)->li_stc.u.e3s.l3s_gen
+
+/*
+ * this flag is set in ->it->it_int_flags to show, that inode exists on client
+ * and no fid fetching flags needs to be set in server request.
+ */
+#define LL_IT_EXIST (1 << 0)
+
/* target.c */
struct ptlrpc_request;
struct recovd_data;
/* careful, this is easy to screw up */
#define PAGE_CACHE_MAXBYTES ((__u64)(~0UL) << PAGE_CACHE_SHIFT)
-
-/*
-struct lustre_intent_data {
- __u64 it_lock_handle[2];
- __u32 it_disposition;
- __u32 it_status;
- __u32 it_lock_mode;
- }; */
-
#define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
#define LLI_F_HAVE_OST_SIZE_LOCK 0
#define LLI_F_HAVE_MDS_SIZE_LOCK 1
#define LLI_F_PREFER_EXTENDED_SIZE 2
+
struct ll_inode_info {
int lli_inode_magic;
struct lov_stripe_md *lli_smd;
struct mea *lli_mea;
+ struct lustre_id lli_id; /* full lustre_id */
char *lli_symlink_name;
struct semaphore lli_open_sem;
__u64 lli_maxbytes;
__u64 lli_io_epoch;
unsigned long lli_flags;
- __u32 lli_mds;
/* this lock protects s_d_w and p_w_ll */
spinlock_t lli_lock;
LPROC_LL_FILE_OPCODES
};
-static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
+static inline void
+ll_inode2id(struct lustre_id *id, struct inode *inode)
{
- mdc_pack_fid(fid, inode->i_ino, inode->i_generation,
- inode->i_mode & S_IFMT);
- LASSERT(ll_i2info(inode));
- fid->mds = ll_i2info(inode)->lli_mds;
+ struct lustre_id *lid = &ll_i2info(inode)->lli_id;
+
+ mdc_pack_id(id, inode->i_ino, inode->i_generation,
+ (inode->i_mode & S_IFMT), id_group(lid),
+ id_fid(lid));
}
static inline void
-ll_prepare_mdc_op_data(struct mdc_op_data *data, struct inode *i1,
- struct inode *i2, const char *name, int namelen,
- int mode)
+ll_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+ struct inode *i2, const char *name, int namelen,
+ int mode)
{
LASSERT(i1);
- ll_inode2fid(&data->fid1, i1);
+ ll_inode2id(&data->id1, i1);
/* it could be directory with mea */
data->mea1 = ll_i2info(i1)->lli_mea;
if (i2) {
- ll_inode2fid(&data->fid2, i2);
+ ll_inode2id(&data->id2, i2);
data->mea2 = ll_i2info(i2)->lli_mea;
}
+ data->valid = 0;
data->name = name;
data->namelen = namelen;
data->create_mode = mode;
#define LUSTRE_MDC_NAME "mdc"
struct mds_update_record {
- __u32 ur_opcode;
- struct ll_fid *ur_fid1;
- struct ll_fid *ur_fid2;
- int ur_namelen;
- char *ur_name;
- int ur_tgtlen;
- char *ur_tgt;
- int ur_eadatalen;
- void *ur_eadata;
- int ur_cookielen;
+ __u32 ur_opcode;
+ struct lustre_id *ur_id1;
+ struct lustre_id *ur_id2;
+ int ur_namelen;
+ char *ur_name;
+ int ur_tgtlen;
+ char *ur_tgt;
+ int ur_eadatalen;
+ void *ur_eadata;
+ int ur_cookielen;
struct llog_cookie *ur_logcookies;
- struct iattr ur_iattr;
- struct lvfs_ucred ur_uc;
- __u64 ur_rdev;
- __u32 ur_mode;
- __u64 ur_time;
- __u32 ur_flags;
+ struct iattr ur_iattr;
+ struct lvfs_ucred ur_uc;
+ __u64 ur_rdev;
+ __u32 ur_mode;
+ __u64 ur_time;
+ __u32 ur_flags;
};
-#define _ur_fsuid ur_uc.luc_fsuid
-#define _ur_fsgid ur_uc.luc_fsgid
-#define _ur_cap ur_uc.luc_cap
-#define _ur_uid ur_uc.luc_uid
+#define ur_fsuid ur_uc.luc_fsuid
+#define ur_fsgid ur_uc.luc_fsgid
+#define ur_cap ur_uc.luc_cap
+#define ur_uid ur_uc.luc_uid
#define MDS_LR_SERVER_SIZE 512
#define MDS_INCOMPAT_SUPP (0)
-#define REAL_MDS_NUMBER 1
-#define CACHE_MDS_NUMBER 0
+#define MDS_MASTER_OBD 1
+#define MDS_CACHE_OBD 0
/*flags for indicate the record are come from cmobd reint or
mdc create */
-#define REC_REINT_CREATE 0x0001
+#define REC_REINT_CREATE 0x0001
/* Data stored per server at the head of the last_rcvd file. In le32 order.
* Try to keep this the same as fsd_server_data so we might one day merge. */
/* mds/handler.c */
#ifdef __KERNEL__
-struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid,
- struct vfsmount **mnt, int lock_mode,
- struct lustre_handle *lockh, int *pmode,
- char *name, int namelen, __u64 lockpart);
-struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
- struct vfsmount **mnt);
+struct dentry *
+mds_id2dentry(struct obd_device *obd, struct lustre_id *id,
+ struct vfsmount **mnt);
+
+struct dentry *
+mds_id2locked_dentry(struct obd_device *obd, struct lustre_id *id,
+ struct vfsmount **mnt, int lock_mode,
+ struct lustre_handle *lockh, int *pmode,
+ char *name, int namelen, __u64 lockpart);
int mds_update_server_data(struct obd_device *, int force_sync);
+int mds_update_last_fid(struct obd_device *obd, void *handle,
+ int force_sync);
/* mds/mds_fs.c */
int mds_fs_setup(struct obd_device *obddev, struct vfsmount *mnt);
void it_set_disposition(struct lookup_intent *it, int flag);
int it_open_error(int phase, struct lookup_intent *it);
int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data);
-int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
+int mdc_change_cbdata(struct obd_export *exp, struct lustre_id *id,
ldlm_iterator_t it, void *data);
-int mdc_intent_lock(struct obd_export *exp, struct ll_fid *parent,
- const char *name, int len, void *lmm, int lmmsize,
- struct ll_fid *child,
- struct lookup_intent *, int,
- struct ptlrpc_request **reqp,
+int mdc_intent_lock(struct obd_export *exp, struct lustre_id *parent,
+ const char *name, int len, void *lmm, int lmmsize,
+ struct lustre_id *child, struct lookup_intent *, int,
+ struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking);
int mdc_enqueue(struct obd_export *exp,
int lock_type,
int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req,
unsigned int offset, struct obd_export *exp_osc,
struct lustre_md *md);
-int mdc_getstatus(struct obd_export *exp, struct ll_fid *rootfid);
-int mdc_getattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getstatus(struct obd_export *exp, struct lustre_id *rootid);
+int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
unsigned long valid, unsigned int ea_size,
struct ptlrpc_request **request);
-int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getattr_name(struct obd_export *exp, struct lustre_id *id,
char *filename, int namelen, unsigned long valid,
unsigned int ea_size, struct ptlrpc_request **request);
int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
int mdc_open(struct obd_export *exp, obd_id ino, int type, int flags,
struct lov_mds_md *lmm, int lmm_size, struct lustre_handle *fh,
struct ptlrpc_request **);
+
struct obd_client_handle;
+
int mdc_set_open_replay_data(struct obd_export *exp,
struct obd_client_handle *och,
struct ptlrpc_request *open_req);
struct obd_client_handle *och);
int mdc_close(struct obd_export *, struct obdo *, struct obd_client_handle *,
struct ptlrpc_request **);
-int mdc_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
+int mdc_readpage(struct obd_export *exp, struct lustre_id *id,
__u64, struct page *, struct ptlrpc_request **);
int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
const void *data, int datalen, int mode, __u32 uid, __u32 gid,
int mdc_rename(struct obd_export *exp, struct mdc_op_data *data,
const char *old, int oldlen, const char *new, int newlen,
struct ptlrpc_request **request);
-int mdc_sync(struct obd_export *exp, struct ll_fid *fid,
+int mdc_sync(struct obd_export *exp, struct lustre_id *id,
struct ptlrpc_request **);
int mdc_create_client(struct obd_uuid uuid, struct ptlrpc_client *cl);
-/* Store the generation of a newly-created inode in |req| for replay. */
-int mdc_store_inode_generation(struct obd_export *exp, struct ptlrpc_request *req,
+/* store the generation of a newly-created inode in |req| for replay. */
+int mdc_store_inode_generation(struct obd_export *exp,
+ struct ptlrpc_request *req,
int reqoff, int repoff);
-int mdc_llog_process(struct obd_export *, char *logname, llog_cb_t, void *data);
-int mdc_done_writing(struct obd_export *exp, struct obdo *);
-int mdc_reint(struct ptlrpc_request *request, struct mdc_rpc_lock *rpc_lock,
- int level);
-static inline void mdc_pack_fid(struct ll_fid *fid, obd_id ino, __u32 gen,
- int type)
-{
- fid->id = ino;
- fid->generation = gen;
- fid->f_type = type;
-}
+
+int mdc_llog_process(struct obd_export *, char *, llog_cb_t,
+ void *);
+
+int mdc_done_writing(struct obd_export *, struct obdo *);
/* ioctls for trying requests */
-#define IOC_REQUEST_TYPE 'f'
-#define IOC_REQUEST_MIN_NR 30
+#define IOC_REQUEST_TYPE 'f'
+#define IOC_REQUEST_MIN_NR 30
#define IOC_REQUEST_GETATTR _IOWR('f', 30, long)
#define IOC_REQUEST_READPAGE _IOWR('f', 31, long)
#include <linux/lustre_ha.h>
#include <linux/lustre_import.h>
#include <linux/lprocfs_status.h>
+#include <linux/lustre_compat25.h>
/* MD flags we _always_ use */
#define PTLRPC_MD_OPTIONS (PTL_MD_EVENT_START_DISABLE | \
struct mdc_op_data *data, struct iattr *iattr,
void *ea, int ealen, void *ea2, int ea2len);
void *mdc_create_pack(struct lustre_msg *msg, int offset,
- struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
- const void *data, int datalen);
+ struct mdc_op_data *op_data, __u32 mode,
+ __u64 rdev, const void *data, int datalen);
void *mdc_unlink_pack(struct lustre_msg *msg, int offset,
struct mdc_op_data *data);
void *mdc_link_pack(struct lustre_msg *msg, int offset,
struct mdc_op_data *data);
void *mdc_rename_pack(struct lustre_msg *msg, int offset,
struct mdc_op_data *data,
- const char *old, int oldlen, const char *new, int newlen);
+ const char *old, int oldlen,
+ const char *new, int newlen);
+
+/* lustre id helper functions and macros. */
+static inline
+void mdc_pack_id(struct lustre_id *id, obd_id ino,
+ __u32 gen, int type, __u64 mds,
+ __u64 fid)
+{
+ LASSERT(id != NULL);
+
+ id->li_fid.lf_id = fid;
+ id->li_fid.lf_group = mds;
+
+ id->li_stc.u.e3s.l3s_ino = ino;
+ id->li_stc.u.e3s.l3s_gen = gen;
+ id->li_stc.u.e3s.l3s_type = type;
+}
+
+#define id_ino(id) \
+ (id)->li_stc.u.e3s.l3s_ino
+
+#define id_gen(id) \
+ (id)->li_stc.u.e3s.l3s_gen
+
+#define id_type(id) \
+ (id)->li_stc.u.e3s.l3s_type
+
+#define id_fid(id) \
+ (id)->li_fid.lf_id
+
+#define id_group(id) \
+ (id)->li_fid.lf_group
+
+#define id_assign_fid(id1, id2) \
+ ((id1)->li_fid = (id2)->li_fid)
+
+#define id_assign_stc(id1, id2) \
+ ((id1)->li_stc = (id2)->li_stc)
+
+#define id_equal(id1, id2) \
+ (id_ino((id1)) == id_ino((id2)) && \
+ id_gen((id1)) == id_gen((id2)) && \
+ id_fid((id1)) == id_fid((id2)) && \
+ id_group((id1)) == id_group(id2))
+
+#define id_equal_fid(id1, id2) \
+ (id_fid((id1)) == id_fid((id2)) && \
+ id_group((id1)) == id_group((id2)))
+
+#define id_equal_stc(id1, id2) \
+ (id_ino((id1)) == id_ino((id2)) && \
+ id_gen((id1)) == id_gen((id2)))
+
+#ifdef __KERNEL__
+static inline void
+mdc_inode2id(struct lustre_id *id, struct inode *inode)
+{
+ mdc_pack_id(id, inode->i_ino, inode->i_generation,
+ (inode->i_mode & S_IFMT), 0, 0);
+}
+
+static inline void
+mdc_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+ struct inode *i2, const char *name, int namelen,
+ int mode)
+{
+ LASSERT(i1);
+
+ mdc_inode2id(&data->id1, i1);
+ if (i2)
+ mdc_inode2id(&data->id2, i2);
+
+ data->valid = 0;
+ data->name = name;
+ data->namelen = namelen;
+ data->create_mode = mode;
+ data->mod_time = LTIME_S(CURRENT_TIME);
+}
+#endif
/* ldlm/ldlm_lib.c */
int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf);
ino_t sn_root_ino; /*the root ino of this snap*/
};
struct smfs_inode_info {
+ /* this first part of struct should be the same as in mds_info_info */
+ struct lustre_id smi_id;
+
+ /* smfs part. */
struct inode *smi_inode;
__u32 smi_flags;
struct snap_inode_info sm_sninfo;
};
#define I2SMI(inode) ((struct smfs_inode_info *) ((inode->u.generic_ip)))
+#define I2FSI(inode) (((inode->u.generic_ip)))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+#define S2FSI(sb) (((sb->u.generic_sbp)))
#define S2SMI(sb) ((struct smfs_super_info *) ((sb->u.generic_sbp)))
#define S2CSB(sb) (((struct smfs_super_info *)((sb->u.generic_sbp)))->smsi_sb)
#else
+#define S2FSI(sb) ((sb->s_fs_info))
#define S2SMI(sb) ((struct smfs_super_info *) (sb->s_fs_info))
#define S2CSB(sb) (((struct smfs_super_info *) (sb->s_fs_info))->smsi_sb)
#endif
{
if (inode && cache_inode) {
duplicate_inode(inode, cache_inode);
- /*Here we must release the cache_inode,
- *Otherwise we will have no chance to
- *do it
+
+ /*
+ * here we must release the cache_inode, otherwise we will have
+ * no chance to do it later.
*/
cache_inode->i_state &=~I_LOCK;
inode->i_blocks = cache_inode->i_blocks;
{
if (!cache_dentry)
return;
+
+ /*
+ * this is needed because d_unalloc() calls dput(), which in turn calls
+ * iput() on dentry inode.
+ */
if (cache_dentry->d_inode)
igrab(cache_dentry->d_inode);
d_unalloc(cache_dentry);
(v & 0xFF)
-#define EXT3_EA_TRANS_BLOCKS EXT3_DATA_TRANS_BLOCKS
-#define EXT3_SETMETA_TRANS_BLOCKS EXT3_DATA_TRANS_BLOCKS
-#define EXT3_NEWINODE_TRANS_BLOCKS 10
-#define SNAP_INSERTLIST_TRANS_BLOCKS (2 * EXT3_EA_TRANS_BLOCKS + 1)
-#define SNAP_DELETELIST_TRANS_BLOCKS (2 * EXT3_EA_TRANS_BLOCKS + 2)
-#define SNAP_COPYBLOCK_TRANS_BLOCKS (EXT3_DATA_TRANS_BLOCKS)
-#define SNAP_MIGRATEDATA_TRANS_BLOCKS 2
-#define SNAP_SETIND_TRANS_BLOCKS (SNAP_INSERTLIST_TRANS_BLOCKS + 1)
-#define SNAP_ADDORPHAN_TRANS_BLOCKS 2
-#define SNAP_REMOVEORPHAN_TRANS_BLOCKS 1
-#define SNAP_RESTOREORPHAN_TRANS_BLOCKS (EXT3_EA_TRANS_BLOCKS + \
- SNAP_DELETELIST_TRANS_BLOCKS + \
- EXT3_NEWINODE_TRANS_BLOCKS + \
- 2 * SNAP_MIGRATEDATA_TRANS_BLOCKS)
-#define SNAP_BIGCOPY_TRANS_BLOCKS (2 * EXT3_DATA_TRANS_BLOCKS)
-#define SNAP_CREATEIND_TRANS_BLOCKS (EXT3_NEWINODE_TRANS_BLOCKS + \
- SNAP_MIGRATEDATA_TRANS_BLOCKS + \
- SNAP_SETIND_TRANS_BLOCKS + \
- SNAP_BIGCOPY_TRANS_BLOCKS + 3)
-#define SNAP_MIGRATEBLK_TRANS_BLOCKS 2
-#define SNAP_DESTROY_TRANS_BLOCKS (SNAP_DELETELIST_TRANS_BLOCKS + \
- EXT3_EA_TRANS_BLOCKS + 2)
-#define SNAP_RESTORE_TRANS_BLOCKS (EXT3_NEWINODE_TRANS_BLOCKS + \
- 2 * SNAP_MIGRATEDATA_TRANS_BLOCKS + 1)
/*Snap Table*/
#define SNAP_MAX 32
#define SNAP_MAX_TABLES 32
struct fsfilt_operations *snap_cache_fsfilt;
struct list_head snap_list;
int snap_table_size;
+ int snap_count;
};
extern int smfs_add_snap_item(struct super_block *sb, char *path_name,
#include <linux/kp30.h>
-#define LL_FID_NAMELEN (16 + 1 + 8 + 1)
+#define LL_ID_NAMELEN (16 + 1 + 8 + 1)
#if defined __KERNEL__
#include <linux/lustre_compat25.h>
};
struct lvfs_callback_ops {
- struct dentry *(*l_fid2dentry)(__u64 id_ino, __u32 gen, __u64 gr, void *data);
+ struct dentry *(*l_id2dentry)(__u64 ino, __u32 gen,
+ __u64 gr, void *data);
};
#define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA
#endif
/* lvfs_common.c */
-struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *, __u64, __u32, __u64 ,void *data);
+struct dentry *lvfs_id2dentry(struct lvfs_run_ctxt *, __u64,
+ __u32, __u64 ,void *data);
void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
struct lvfs_ucred *cred);
void unlock_dir(struct inode *dir, void *lock);
#endif
-/* We need to hold the inode semaphore over the dcache lookup itself, or we
- * run the risk of entering the filesystem lookup path concurrently on SMP
- * systems, and instantiating two inodes for the same entry. We still
- * protect against concurrent addition/removal races with the DLM locking.
- */
-static inline struct dentry *ll_lookup_one_len(const char *fid_name,
- struct dentry *dparent,
- int fid_namelen)
+/* We need to hold the inode semaphore over the dcache lookup itself, or we run
+ * the risk of entering the filesystem lookup path concurrently on SMP systems,
+ * and instantiating two inodes for the same entry. We still protect against
+ * concurrent addition/removal races with the DLM locking. */
+static inline struct dentry *
+ll_lookup_one_len(const char *name, struct dentry *dparent, int namelen)
{
struct dentry *dchild;
#ifdef S_PDIROPS
struct qstr qstr;
void *lock;
- qstr.name = fid_name;
- qstr.len = fid_namelen;
+ qstr.name = name;
+ qstr.len = namelen;
lock = lock_dir(dparent->d_inode, &qstr);
#else
down(&dparent->d_inode->i_sem);
#endif
- dchild = lookup_one_len(fid_name, dparent, fid_namelen);
+ dchild = lookup_one_len(name, dparent, namelen);
#ifdef S_PDIROPS
unlock_dir(dparent->d_inode, lock);
}
#endif
-static inline int ll_fid2str(char *str, __u64 id, __u32 generation)
+static inline int ll_id2str(char *str, __u64 id, __u32 generation)
{
- return sprintf(str, "%llx:%08x", (unsigned long long)id, generation);
+ return sprintf(str, "%llx:%08x", (unsigned long long)id,
+ generation);
}
#endif
struct list_head lld_list;
ino_t lld_ino;
unsigned long lld_off;
- char lld_name[LL_FID_NAMELEN];
+ char lld_name[LL_ID_NAMELEN];
};
struct l_readdir_callback {
struct l_linux_dirent *lrc_dirent;
struct semaphore fo_init_lock; /* group initialization lock */
int fo_committed_group;
- spinlock_t fo_objidlock; /* protect fo_lastobjid increment */
- spinlock_t fo_translock; /* protect fsd_last_rcvd increment */
+ spinlock_t fo_objidlock; /* protect fo_lastobjid increment */
+ spinlock_t fo_translock; /* protect fsd_last_rcvd increment */
struct file *fo_rcvd_filp;
struct filter_server_data *fo_fsd;
unsigned long *fo_last_rcvd_slots;
struct ptlrpc_service *mds_readpage_service;
struct super_block *mds_sb;
struct vfsmount *mds_vfsmnt;
- struct dentry *mds_fid_de;
+ struct dentry *mds_id_de;
int mds_max_mdsize;
int mds_max_cookiesize;
struct file *mds_rcvd_filp;
+ struct file *mds_fid_filp;
spinlock_t mds_transno_lock;
__u64 mds_last_transno;
__u64 mds_mount_count;
__u64 mds_io_epoch;
+
+ __u64 mds_last_fid;
+ struct semaphore mds_last_fid_sem;
+ int mds_last_fid_changed;
+
struct semaphore mds_epoch_sem;
- struct ll_fid mds_rootfid;
+ struct lustre_id mds_rootid;
struct mds_server_data *mds_server_data;
struct dentry *mds_pending_dir;
struct dentry *mds_logs_dir;
struct dentry *mds_objects_dir;
struct llog_handle *mds_cfg_llh;
-// struct llog_handle *mds_catalog;
- struct obd_device *mds_osc_obd; /* XXX lov_obd */
+ struct obd_device *mds_lov_obd;
struct obd_uuid mds_lov_uuid;
char *mds_profile;
- struct obd_export *mds_osc_exp; /* XXX lov_exp */
+ struct obd_export *mds_lov_exp;
int mds_has_lov_desc;
struct lov_desc mds_lov_desc;
obd_id *mds_lov_objids;
int mds_lov_objids_valid;
int mds_lov_nextid_set;
struct file *mds_lov_objid_filp;
- spinlock_t mds_lov_lock;
+ spinlock_t mds_lov_lock;
unsigned long *mds_client_bitmap;
struct semaphore mds_orphan_recovery_sem;
- /*add mds num here for real mds and cache mds create
- FIXME later will be totally fixed by b_cmd*/
+
int mds_num;
struct lprocfs_stats *mds_counters;
int mds_config_version;
char *mds_lmv_name;
- struct obd_device *mds_lmv_obd; /* XXX lmv_obd */
- struct obd_export *mds_lmv_exp; /* XXX lov_exp */
+ struct obd_device *mds_lmv_obd;
+ struct obd_export *mds_lmv_exp;
+
struct ptlrpc_service *mds_create_service;
struct semaphore mds_lmv_sem;
uid_t mds_squash_uid;
ptl_nid_t mds_nosquash_nid;
atomic_t mds_real_clients;
struct obd_uuid mds_lmv_uuid;
- struct dentry *mds_fids_dir;
+ struct dentry *mds_id_dir;
+ int mds_obd_type;
int mds_lmv_connected;
struct dentry *mds_unnamed_dir; /* for mdt_obd_create only */
};
};
struct echo_client_obd {
- struct obd_export *ec_exp; /* the local connection to osc/lov */
- spinlock_t ec_lock;
- struct list_head ec_objects;
- int ec_nstripes;
- __u64 ec_unique;
+ struct obd_export *ec_exp; /* the local connection to osc/lov */
+ spinlock_t ec_lock;
+ struct list_head ec_objects;
+ int ec_nstripes;
+ __u64 ec_unique;
};
struct cache_obd {
- struct obd_export *cobd_real_exp;/* local connection to target obd */
- struct obd_export *cobd_cache_exp; /* local connection to cache obd */
- char *cobd_real_name;
- char *cobd_cache_name;
- int refcount;
- int cache_on;
+ struct obd_export *master_exp; /* local connection to master obd */
+ struct obd_export *cache_exp; /* local connection to cache obd */
+ char *master_name;
+ char *cache_name;
+ int refcount;
+ int cache_on;
};
struct lov_tgt_desc {
- struct obd_uuid uuid;
- __u32 ltd_gen;
- struct obd_export *ltd_exp;
- int active; /* is this target up for requests */
+ struct obd_uuid uuid;
+ __u32 ltd_gen;
+ struct obd_export *ltd_exp;
+ int active; /* is this target up for requests */
};
struct lov_obd {
- spinlock_t lov_lock;
- struct lov_desc desc;
- struct semaphore lov_llog_sem;
- int bufsize;
- int refcount;
- int lo_catalog_loaded:1;
- unsigned long lov_connect_flags;
- struct lov_tgt_desc *tgts;
+ spinlock_t lov_lock;
+ struct lov_desc desc;
+ int bufsize;
+ int refcount;
+ int lo_catalog_loaded:1;
+ struct semaphore lov_llog_sem;
+ unsigned long lov_connect_flags;
+ struct lov_tgt_desc *tgts;
};
struct lmv_tgt_desc {
struct obd_uuid uuid;
- struct obd_export *ltd_exp;
- int active; /* is this target up for requests */
+ struct obd_export *ltd_exp;
+ int active; /* is this target up for requests */
};
struct lmv_obd {
+ int refcount;
spinlock_t lmv_lock;
struct lmv_desc desc;
- int bufsize;
- int refcount;
struct lmv_tgt_desc *tgts;
struct obd_uuid cluuid;
struct obd_export *exp;
+
+ int tgts_size;
int connected;
int max_easize;
int max_cookiesize;
int rc;
};
-struct cache_manager_obd {
- struct obd_device *cm_master_obd; /* master lov */
- struct obd_export *cm_master_exp;
- struct obd_device *cm_cache_obd; /* cache obdfilter */
- struct obd_export *cm_cache_exp;
- int cm_master_group; /* master group*/
- struct cmobd_write_service *cm_write_srv;
+struct cm_obd {
+ struct obd_device *master_obd; /* master lov */
+ struct obd_export *master_exp;
+ struct obd_device *cache_obd; /* cache obdfilter */
+ struct obd_export *cache_exp;
+ int master_group; /* master group*/
+ struct cmobd_write_service *write_srv;
};
union {
- struct filter_obd filter;
- struct mds_obd mds;
- struct client_obd cli;
- struct ost_obd ost;
- struct echo_client_obd echo_client;
- struct echo_obd echo;
- struct recovd_obd recovd;
- struct lov_obd lov;
- struct cache_obd cobd;
- struct ptlbd_obd ptlbd;
- struct mgmtcli_obd mgmtcli;
- struct lmv_obd lmv;
- struct cache_manager_obd cmobd;
+ struct filter_obd filter;
+ struct mds_obd mds;
+ struct client_obd cli;
+ struct ost_obd ost;
+ struct echo_client_obd echo_client;
+ struct echo_obd echo;
+ struct recovd_obd recovd;
+ struct lov_obd lov;
+ struct cache_obd cobd;
+ struct ptlbd_obd ptlbd;
+ struct mgmtcli_obd mgmtcli;
+ struct lmv_obd lmv;
+ struct cm_obd cm;
} u;
- /* Fields used by LProcFS */
+
+ /* fields used by LProcFS */
unsigned int obd_cntr_base;
struct lprocfs_stats *obd_stats;
struct proc_dir_entry *obd_svc_procroot;
struct lprocfs_stats *obd_svc_stats;
};
-#define OBD_OPT_FORCE 0x0001
-#define OBD_OPT_FAILOVER 0x0002
-#define OBD_OPT_REAL_CLIENT 0x0004
-#define OBD_OPT_MDS_CONNECTION 0x0008
+#define OBD_OPT_FORCE (1 << 0)
+#define OBD_OPT_FAILOVER (1 << 1)
+#define OBD_OPT_REAL_CLIENT (1 << 2)
+#define OBD_OPT_MDS_CONNECTION (1 << 3)
-#define OBD_LLOG_FL_SENDNOW 0x0001
-#define OBD_LLOG_FL_CREATE 0x0002
+#define OBD_LLOG_FL_SENDNOW (1 << 0)
+#define OBD_LLOG_FL_CREATE (1 << 1)
struct mdc_op_data;
int (*o_notify)(struct obd_device *obd, struct obd_device *watched,
int active, void *data);
+
+ /* this method is needed for cmobd to make say to LMV "get ready" when
+ * master obd is LMV. This is needed, because LMV is initialized in
+ * "defered" manner to let all MDSs to be set up first. */
+ int (*o_getready)(struct obd_export *exp);
int (*o_init_ea_size)(struct obd_export *, int, int);
/*
};
struct md_ops {
- int (*m_getstatus)(struct obd_export *, struct ll_fid *);
- int (*m_change_cbdata)(struct obd_export *, struct ll_fid *,
+ int (*m_getstatus)(struct obd_export *, struct lustre_id *);
+ int (*m_change_cbdata)(struct obd_export *, struct lustre_id *,
ldlm_iterator_t, void *);
- int (*m_change_cbdata_name)(struct obd_export *, struct ll_fid *,
- char *, int, struct ll_fid *,
+ int (*m_change_cbdata_name)(struct obd_export *, struct lustre_id *,
+ char *, int, struct lustre_id *,
ldlm_iterator_t, void *);
int (*m_close)(struct obd_export *, struct obdo *,
struct obd_client_handle *,
int, struct mdc_op_data *, struct lustre_handle *,
void *, int, ldlm_completion_callback,
ldlm_blocking_callback, void *);
- int (*m_getattr)(struct obd_export *, struct ll_fid *,
+ int (*m_getattr)(struct obd_export *, struct lustre_id *,
unsigned long, unsigned int,
struct ptlrpc_request **);
- int (*m_getattr_name)(struct obd_export *, struct ll_fid *,
+ int (*m_getattr_name)(struct obd_export *, struct lustre_id *,
char *, int, unsigned long,
unsigned int, struct ptlrpc_request **);
int (*m_intent_lock)(struct obd_export *,
- struct ll_fid *, const char *, int,
- void *, int, struct ll_fid *,
+ struct lustre_id *, const char *, int,
+ void *, int, struct lustre_id *,
struct lookup_intent *, int,
struct ptlrpc_request **,
ldlm_blocking_callback);
int (*m_setattr)(struct obd_export *, struct mdc_op_data *,
struct iattr *, void *, int , void *, int,
struct ptlrpc_request **);
- int (*m_sync)(struct obd_export *, struct ll_fid *,
+ int (*m_sync)(struct obd_export *, struct lustre_id *,
struct ptlrpc_request **);
- int (*m_readpage)(struct obd_export *, struct ll_fid *,
+ int (*m_readpage)(struct obd_export *, struct lustre_id *,
__u64, struct page *, struct ptlrpc_request **);
int (*m_unlink)(struct obd_export *, struct mdc_op_data *,
struct ptlrpc_request **);
- int (*m_valid_attrs)(struct obd_export *, struct ll_fid *);
- struct obd_device * (*m_get_real_obd)(struct obd_export *,
- char *name, int len);
+ int (*m_valid_attrs)(struct obd_export *, struct lustre_id *);
+
+ struct obd_device *(*m_get_real_obd)(struct obd_export *,
+ char *name, int len);
int (*m_req2lustre_md)(struct obd_export *exp,
struct ptlrpc_request *req, unsigned int offset,
int repoff);
int (*m_set_lock_data)(struct obd_export *exp, __u64 *l, void *data);
- int (*m_delete_object)(struct obd_export *, struct ll_fid *);
- /*
- * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line
- * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c.
- * Also, add a wrapper function in include/linux/obd_class.h.
+ int (*m_delete_object)(struct obd_export *, struct lustre_id *);
+
+ /* NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line to
+ * lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c. Also, add a
+ * wrapper function in include/linux/obd_class.h.
*/
};
-static inline void obd_transno_commit_cb(struct obd_device *obd, __u64 transno,
- int error)
+static inline void obd_transno_commit_cb(struct obd_device *obd,
+ __u64 transno, int error)
{
if (error) {
CERROR("%s: transno "LPD64" commit error: %d\n",
obd->obd_name, transno, error);
return;
}
+
CDEBUG(D_HA, "%s: transno "LPD64" committed\n",
obd->obd_name, transno);
+
if (transno > obd->obd_last_committed) {
obd->obd_last_committed = transno;
ptlrpc_commit_replies (obd);
struct lustre_profile {
struct list_head lp_list;
- char * lp_profile;
- char * lp_osc;
- char * lp_mdc;
+ char *lp_profile;
+ char *lp_lov;
+ char *lp_lmv;
};
struct lustre_profile *class_get_profile(char * prof);
LASSERT(atomic_read(&(exp)->exp_refcount) < 0x5a5a5a); \
__class_export_put(exp); \
} while (0)
+
void __class_export_put(struct obd_export *);
struct obd_export *class_new_export(struct obd_device *obddev);
void class_unlink_export(struct obd_export *exp);
void class_put_type(struct obd_type *type);
int class_connect(struct lustre_handle *conn, struct obd_device *obd,
struct obd_uuid *cluuid);
-int class_disconnect(struct obd_export *exp, int failover);
-void class_disconnect_exports(struct obd_device *obddev, int failover);
-void class_disconnect_stale_exports(struct obd_device *obddev, int failover);
+int class_disconnect(struct obd_export *exp, int flags);
+void class_disconnect_exports(struct obd_device *obddev, int flags);
+void class_disconnect_stale_exports(struct obd_device *obddev, int flags);
+
/* generic operations shared by various OBD types */
int class_multi_setup(struct obd_device *obddev, uint32_t len, void *data);
int class_multi_cleanup(struct obd_device *obddev);
RETURN(rc);
}
+static inline int obd_getready(struct obd_export *exp)
+{
+ int rc;
+ ENTRY;
+
+ if (!OBP(exp->exp_obd, getready))
+ RETURN(0);
+ rc = OBP(exp->exp_obd, getready)(exp);
+ RETURN(rc);
+}
+
static inline int obd_init_export(struct obd_export *exp)
{
int rc = 0;
}
static inline struct dentry *
-obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr)
+obd_lvfs_id2dentry(struct obd_export *exp, __u64 ino,
+ __u32 gen, __u64 gr)
{
LASSERT(exp->exp_obd);
- return lvfs_fid2dentry(&exp->exp_obd->obd_lvfs_ctxt, id_ino, gen, gr,
- exp->exp_obd);
+ return lvfs_id2dentry(&exp->exp_obd->obd_lvfs_ctxt,
+ ino, gen, gr, exp->exp_obd);
}
#ifndef time_before
rc = OBP(exp->exp_obd, init_ea_size)(exp, size, size2);
RETURN(rc);
}
-static inline int md_getstatus(struct obd_export *exp, struct ll_fid *fid)
+
+static inline int md_getstatus(struct obd_export *exp, struct lustre_id *id)
{
int rc;
EXP_CHECK_MD_OP(exp, getstatus);
MD_COUNTER_INCREMENT(exp->exp_obd, getstatus);
- rc = MDP(exp->exp_obd, getstatus)(exp, fid);
+ rc = MDP(exp->exp_obd, getstatus)(exp, id);
RETURN(rc);
}
-/* this function notifies MDC, that inode described by @fid gets removed from
+/* this function notifies MDC, that inode described by @id gets removed from
* memory.*/
static inline int md_delete_object(struct obd_export *exp,
- struct ll_fid *fid)
+ struct lustre_id *id)
{
int rc;
ENTRY;
RETURN(0);
MD_COUNTER_INCREMENT(exp->exp_obd, delete_object);
- rc = MDP(exp->exp_obd, delete_object)(exp, fid);
+ rc = MDP(exp->exp_obd, delete_object)(exp, id);
RETURN(rc);
}
-static inline int md_getattr(struct obd_export *exp, struct ll_fid *fid,
+static inline int md_getattr(struct obd_export *exp, struct lustre_id *id,
unsigned long valid, unsigned int ea_size,
struct ptlrpc_request **request)
{
ENTRY;
EXP_CHECK_MD_OP(exp, getattr);
MD_COUNTER_INCREMENT(exp->exp_obd, getattr);
- rc = MDP(exp->exp_obd, getattr)(exp, fid, valid, ea_size, request);
+ rc = MDP(exp->exp_obd, getattr)(exp, id, valid, ea_size, request);
RETURN(rc);
}
-static inline int md_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
+static inline int md_change_cbdata(struct obd_export *exp, struct lustre_id *id,
ldlm_iterator_t it, void *data)
{
int rc;
ENTRY;
EXP_CHECK_MD_OP(exp, change_cbdata);
MD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata);
- rc = MDP(exp->exp_obd, change_cbdata)(exp, fid, it, data);
+ rc = MDP(exp->exp_obd, change_cbdata)(exp, id, it, data);
RETURN(rc);
}
static inline int md_change_cbdata_name(struct obd_export *exp,
- struct ll_fid *fid, char *name,
- int namelen, struct ll_fid *fid2,
+ struct lustre_id *id, char *name,
+ int namelen, struct lustre_id *id2,
ldlm_iterator_t it, void *data)
{
int rc;
ENTRY;
MD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata_name);
- rc = MDP(exp->exp_obd, change_cbdata_name)(exp, fid, name, namelen,
- fid2, it, data);
+ rc = MDP(exp->exp_obd, change_cbdata_name)(exp, id, name, namelen,
+ id2, it, data);
RETURN(rc);
}
RETURN(rc);
}
-static inline int md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+static inline int md_getattr_name(struct obd_export *exp, struct lustre_id *id,
char *filename, int namelen,
unsigned long valid, unsigned int ea_size,
struct ptlrpc_request **request)
ENTRY;
EXP_CHECK_MD_OP(exp, getattr_name);
MD_COUNTER_INCREMENT(exp->exp_obd, getattr_name);
- rc = MDP(exp->exp_obd, getattr_name)(exp, fid, filename, namelen,
+ rc = MDP(exp->exp_obd, getattr_name)(exp, id, filename, namelen,
valid, ea_size, request);
RETURN(rc);
}
static inline int md_intent_lock(struct obd_export *exp,
- struct ll_fid *pfid, const char *name,
+ struct lustre_id *pid, const char *name,
int len, void *lmm, int lmmsize,
- struct ll_fid *cfid, struct lookup_intent *it,
+ struct lustre_id *cid, struct lookup_intent *it,
int flags, struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking)
{
ENTRY;
EXP_CHECK_MD_OP(exp, intent_lock);
MD_COUNTER_INCREMENT(exp->exp_obd, intent_lock);
- rc = MDP(exp->exp_obd, intent_lock)(exp, pfid, name, len,
- lmm, lmmsize, cfid, it, flags,
+ rc = MDP(exp->exp_obd, intent_lock)(exp, pid, name, len,
+ lmm, lmmsize, cid, it, flags,
reqp, cb_blocking);
RETURN(rc);
}
RETURN(rc);
}
-static inline int md_sync(struct obd_export *exp, struct ll_fid *fid,
+static inline int md_sync(struct obd_export *exp, struct lustre_id *id,
struct ptlrpc_request **request)
{
int rc;
ENTRY;
EXP_CHECK_MD_OP(exp, sync);
MD_COUNTER_INCREMENT(exp->exp_obd, sync);
- rc = MDP(exp->exp_obd, sync)(exp, fid, request);
+ rc = MDP(exp->exp_obd, sync)(exp, id, request);
RETURN(rc);
}
-static inline int md_readpage(struct obd_export *exp, struct ll_fid *fid,
+static inline int md_readpage(struct obd_export *exp, struct lustre_id *id,
__u64 offset, struct page *page,
struct ptlrpc_request **request)
{
ENTRY;
EXP_CHECK_MD_OP(exp, readpage);
MD_COUNTER_INCREMENT(exp->exp_obd, readpage);
- rc = MDP(exp->exp_obd, readpage)(exp, fid, offset, page, request);
+ rc = MDP(exp->exp_obd, readpage)(exp, id, offset, page, request);
RETURN(rc);
}
return MDP(exp->exp_obd, get_real_obd)(exp, name, len);
}
-static inline int md_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
+static inline int md_valid_attrs(struct obd_export *exp,
+ struct lustre_id *id)
{
ENTRY;
EXP_CHECK_MD_OP(exp, valid_attrs);
MD_COUNTER_INCREMENT(exp->exp_obd, valid_attrs);
- return MDP(exp->exp_obd, valid_attrs)(exp, fid);
+ return MDP(exp->exp_obd, valid_attrs)(exp, id);
}
static inline int md_req2lustre_md(struct obd_export *exp,
reqoff, repoff);
}
-static inline int md_set_lock_data(struct obd_export *exp, __u64 *l, void *data)
+static inline int md_set_lock_data(struct obd_export *exp, __u64 *l,
+ void *data)
{
ENTRY;
EXP_CHECK_MD_OP(exp, set_lock_data);
#define OBD_LMV_DEVICENAME "lmv"
-
#endif
int stripe_count, int stripe_pattern);
extern int llapi_file_get_stripe(char *path, struct lov_user_md *lum);
extern int llapi_find(char *path, struct obd_uuid *obduuid, int recursive,
- int verbose, int quiet);
+ int verbose, int quiet, int showfid);
extern int llapi_target_check(int num_types, char **obd_types, char *dir);
extern int llapi_catinfo(char *dir, char *keyword, char *node_name);
extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
#define IOC_MDC_TYPE 'i'
#define IOC_MDC_GETSTRIPE _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *)
+#define IOC_MDC_SHOWFID _IOWR(IOC_MDC_TYPE, 23, struct lustre_id *)
#ifndef EXT3_IOC_GETFLAGS
#define EXT3_IOC_GETFLAGS _IOR('f', 1, long)
--- /dev/null
+diff -rupN linux-2.6.7.old/include/linux/dcache.h linux-2.6.7/include/linux/dcache.h
+--- linux-2.6.7.old/include/linux/dcache.h 2004-11-05 16:48:26.224926856 +0200
++++ linux-2.6.7/include/linux/dcache.h 2004-11-04 09:21:03.000000000 +0200
+@@ -97,6 +97,7 @@ struct dentry {
+ unsigned d_inum; /* for cross-fs references (Lustre) */
+ unsigned d_mdsnum; /* for cross-fs references (Lustre) */
+ unsigned d_generation; /* for cross-fs references (Lustre) */
++ unsigned d_fid; /* for cross-fs references (Lustre) */
+ /*
+ * The next three fields are touched by __d_lookup. Place them here
+ * so they all fit in a 16-byte range, with 16-byte alignment.
--- /dev/null
+diff -rupN linux-2.4.24.orig/fs/ext3/namei.c linux-2.4.24/fs/ext3/namei.c
+--- linux-2.4.24.orig/fs/ext3/namei.c Tue Oct 5 10:34:28 2004
++++ linux-2.4.24/fs/ext3/namei.c Tue Oct 5 10:43:12 2004
+@@ -1112,6 +1112,7 @@ static struct dentry *ext3_lookup(struct
+ dentry->d_flags |= DCACHE_CROSS_REF;
+ dentry->d_generation = mds[1];
+ dentry->d_mdsnum = mds[0];
++ dentry->d_fid = mds[2];
+ dentry->d_inum = ino;
+ d_add(dentry, NULL);
+ return NULL;
+@@ -1334,7 +1335,8 @@ static int add_dirent_to_buf(handle_t *h
+ if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_MDSNUM)
+ && (dentry->d_flags & DCACHE_CROSS_REF)
+ && (dentry->d_mdsnum != EXT3_SB(sb)->s_mdsnum))
+- reclen += 8; /* we need space to store mds num */
++ reclen += 12; /* we need space to store mds num,
++ * inode num and fid num. */
+ if (!de) {
+ de = (struct ext3_dir_entry_2 *)bh->b_data;
+ top = bh->b_data + dir->i_sb->s_blocksize - reclen;
+@@ -1387,6 +1389,7 @@ static int add_dirent_to_buf(handle_t *h
+ mds = (__u32 *)((char *)de + EXT3_DIR_REC_LEN(namelen));
+ mds[0] = cpu_to_le32(dentry->d_mdsnum);
+ mds[1] = cpu_to_le32(dentry->d_generation);
++ mds[2] = cpu_to_le32(dentry->d_fid);
+ de->inode = cpu_to_le32(dentry->d_inum);
+ de->file_type = 128;
+ } else {
+diff -rupN linux-2.4.24.orig/include/linux/dcache.h linux-2.4.24/include/linux/dcache.h
+--- linux-2.4.24.orig/include/linux/dcache.h Tue Oct 5 10:34:28 2004
++++ linux-2.4.24/include/linux/dcache.h Tue Oct 5 10:43:45 2004
+@@ -123,6 +123,7 @@ struct dentry {
+ unsigned d_inum; /* for cross-fs references (Lustre) */
+ unsigned d_mdsnum; /* for cross-fs references (Lustre) */
+ unsigned d_generation; /* for cross-fs references (Lustre) */
++ unsigned d_fid; /* for cross-fs references (Lustre) */
+ struct dentry * d_parent; /* parent directory */
+ struct list_head d_hash; /* lookup hash list */
+ struct list_head d_lru; /* d_count = 0 LRU list */
+diff -rupN linux-2.4.24.orig/include/linux/ext3_fs.h linux-2.4.24/include/linux/ext3_fs.h
+--- linux-2.4.24.orig/include/linux/ext3_fs.h Tue Oct 5 10:34:28 2004
++++ linux-2.4.24/include/linux/ext3_fs.h Tue Oct 5 10:44:29 2004
+@@ -589,7 +589,7 @@ struct ext3_dir_entry_2 {
+ #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \
+ ~EXT3_DIR_ROUND)
+ #define EXT3_DIR_REC_LEN_DE(de) (EXT3_DIR_REC_LEN((de)->name_len) + \
+- (((de)->file_type & 128) ? 8 : 0))
++ (((de)->file_type & 128) ? 12 : 0))
+
+ /*
+ * Hash Tree Directory indexing
--- /dev/null
+diff -rupN linux-2.6.7.old/fs/ext3/namei.c linux-2.6.7/fs/ext3/namei.c
+--- linux-2.6.7.old/fs/ext3/namei.c 2004-11-05 16:44:21.000000000 +0200
++++ linux-2.6.7/fs/ext3/namei.c 2004-11-05 16:57:12.858866328 +0200
+@@ -1163,6 +1163,7 @@ static struct dentry *ext3_lookup(struct
+ dentry->d_flags |= DCACHE_CROSS_REF;
+ dentry->d_generation = mds[1];
+ dentry->d_mdsnum = mds[0];
++ dentry->d_fid = mds[2];
+ dentry->d_inum = ino;
+ ext3_unlock_htree(dir, lock);
+ d_add(dentry, NULL);
+@@ -1391,7 +1392,7 @@ static int add_dirent_to_buf(handle_t *h
+ if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_MDSNUM)
+ && (dentry->d_flags & DCACHE_CROSS_REF)
+ && (dentry->d_mdsnum != EXT3_SB(sb)->s_mdsnum))
+- reclen += 8; /* we need space to store mds num */
++ reclen += 12; /* we need space to store mds num */
+ if (!de) {
+ de = (struct ext3_dir_entry_2 *)bh->b_data;
+ top = bh->b_data + dir->i_sb->s_blocksize - reclen;
+@@ -1444,6 +1445,7 @@ static int add_dirent_to_buf(handle_t *h
+ mds = (__u32 *)((char *)de + EXT3_DIR_REC_LEN(namelen));
+ mds[0] = cpu_to_le32(dentry->d_mdsnum);
+ mds[1] = cpu_to_le32(dentry->d_generation);
++ mds[2] = cpu_to_le32(dentry->d_fid);
+ de->inode = cpu_to_le32(dentry->d_inum);
+ de->file_type = 128;
+ } else {
+diff -rupN linux-2.6.7.old/include/linux/ext3_fs.h linux-2.6.7/include/linux/ext3_fs.h
+--- linux-2.6.7.old/include/linux/ext3_fs.h 2004-11-05 16:44:21.000000000 +0200
++++ linux-2.6.7/include/linux/ext3_fs.h 2004-11-05 16:56:17.183330296 +0200
+@@ -616,7 +616,7 @@ struct ext3_dir_entry_2 {
+ #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \
+ ~EXT3_DIR_ROUND)
+ #define EXT3_DIR_REC_LEN_DE(de) (EXT3_DIR_REC_LEN((de)->name_len) + \
+- (((de)->file_type & 128) ? 8 : 0))
++ (((de)->file_type & 128) ? 12 : 0))
+
+ /*
+ * Hash Tree Directory indexing
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
-+#ident "$Id: kksymoops-2.4.24.vanilla.patch,v 1.10 2004/10/29 15:04:35 eeb Exp $"
++#ident "$Id: kksymoops-2.4.24.vanilla.patch,v 1.11 2004/11/11 11:34:26 yury Exp $"
+
+#ifndef MODUTILS_KALLSYMS_H
+#define MODUTILS_KALLSYMS_H 1
dcache-mds-num-2.6.7.patch
dynamic-locks-2.6.7.patch
vfs-pdirops-2.6.7.patch
+dcache-fid-2.6.7.patch
ext3-extents-in-ea-exports-symbol-2.6.7.patch
ext3-mds-num-2.6.7.patch
ext3-inode-reuse-2.6.7.patch
+ext3-fid-2.6.7.patch
export-zap-page-range-2.4.24.patch
export_num_siblings-2.4.24.patch
ext3-nlinks-2.4.24.patch
+ext3-dentry-fid-2.4.24.patch
return rc;
}
-int client_disconnect_export(struct obd_export *exp, int failover)
+int client_disconnect_export(struct obd_export *exp, int flags)
{
struct obd_device *obd = class_exp2obd(exp);
struct client_obd *cli = &obd->u.cli;
OBD_FREE(req, sizeof *req);
}
+#ifdef __KERNEL__
static void target_finish_recovery(struct obd_device *obd)
{
struct list_head *tmp, *n;
target_release_saved_req(req);
}
}
+#endif
+
/* Called from a cleanup function if the device is being cleaned up
forcefully. The exports should all have been disconnected already,
the only thing left to do is
}
}
+#ifdef __KERNEL__
static void target_abort_recovery(void *data)
{
struct obd_device *obd = data;
target_finish_recovery(obd);
ptlrpc_run_recovery_over_upcall(obd);
}
+#endif
static void target_recovery_expired(unsigned long castmeharder)
{
del_timer(&obd->obd_recovery_timer);
}
+#ifdef __KERNEL__
static void reset_recovery_timer(struct obd_device *obd)
{
spin_lock_bh(&obd->obd_processing_task_lock);
mod_timer(&obd->obd_recovery_timer, jiffies + OBD_RECOVERY_TIMEOUT);
spin_unlock_bh(&obd->obd_processing_task_lock);
}
-
+#endif
/* Only start it the first time called */
void target_start_recovery_timer(struct obd_device *obd)
spin_unlock_bh(&obd->obd_processing_task_lock);
}
+#ifdef __KERNEL__
static int check_for_next_transno(struct obd_device *obd)
{
struct ptlrpc_request *req = NULL;
return req;
}
-#ifdef __KERNEL__
static int target_recovery_thread(void *arg)
{
struct obd_device *obd = arg;
}
}
#endif
+
int target_queue_recovery_request(struct ptlrpc_request *req,
struct obd_device *obd)
{
struct ldlm_resource *res;
struct ldlm_namespace *ns;
int granted = 0;
+ int old_mode, rc;
+ ldlm_error_t err;
ENTRY;
- LBUG();
+ if (new_mode == lock->l_granted_mode) { // No changes? Just return.
+ *flags |= LDLM_FL_BLOCK_GRANTED;
+ RETURN(lock->l_resource);
+ }
+
+ LASSERTF(new_mode == LCK_PW && lock->l_granted_mode == LCK_PR,
+ "new_mode %u, granted %u\n", new_mode, lock->l_granted_mode);
res = lock->l_resource;
ns = res->lr_namespace;
l_lock(&ns->ns_lock);
+ old_mode = lock->l_req_mode;
lock->l_req_mode = new_mode;
ldlm_resource_unlink_lock(lock);
} else {
/* This should never happen, because of the way the
* server handles conversions. */
+ LDLM_ERROR(lock, "Erroneous flags %d on local lock\n",
+ *flags);
LBUG();
res->lr_tmp = &rpc_list;
lock->l_completion_ast(lock, 0, NULL);
}
} else {
- /* FIXME: We should try the conversion right away and possibly
- * return success without the need for an extra AST */
- ldlm_resource_add_lock(res, &res->lr_converting, lock);
- *flags |= LDLM_FL_BLOCK_CONV;
+ int pflags = 0;
+ ldlm_processing_policy policy;
+ policy = ldlm_processing_policy_table[res->lr_type];
+ res->lr_tmp = &rpc_list;
+ rc = policy(lock, &pflags, 0, &err);
+ res->lr_tmp = NULL;
+ if (rc == LDLM_ITER_STOP) {
+ lock->l_req_mode = old_mode;
+ ldlm_resource_add_lock(res, &res->lr_granted, lock);
+ res = NULL;
+ } else {
+ *flags |= LDLM_FL_BLOCK_GRANTED;
+ granted = 1;
+ }
}
l_unlock(&ns->ns_lock);
int rc, size = sizeof(*dlm_rep);
ENTRY;
- dlm_req = lustre_swab_reqbuf (req, 0, sizeof (*dlm_req),
- lustre_swab_ldlm_request);
+ dlm_req = lustre_swab_reqbuf(req, 0, sizeof (*dlm_req),
+ lustre_swab_ldlm_request);
if (dlm_req == NULL) {
CERROR ("Can't unpack dlm_req\n");
RETURN (-EFAULT);
if (!lock) {
req->rq_status = EINVAL;
} else {
+ void *res = NULL;
+
LDLM_DEBUG(lock, "server-side convert handler START");
- ldlm_lock_convert(lock, dlm_req->lock_desc.l_req_mode,
- &dlm_rep->lock_flags);
- if (ldlm_del_waiting_lock(lock))
- CDEBUG(D_DLMTRACE, "converted waiting lock %p\n", lock);
- req->rq_status = 0;
+ res = ldlm_lock_convert(lock, dlm_req->lock_desc.l_req_mode,
+ &dlm_rep->lock_flags);
+
+ if (res) {
+ if (ldlm_del_waiting_lock(lock))
+ CDEBUG(D_DLMTRACE, "converted waiting lock %p\n", lock);
+ req->rq_status = 0;
+ } else {
+ req->rq_status = EDEADLOCK;
+ }
}
if (lock) {
{
struct llu_inode_info *lli = llu_i2info(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct ll_fid mdc_fid;
+ struct lustre_id id;
__u64 offset;
int rc = 0;
struct ptlrpc_request *request;
struct mds_body *body;
struct lookup_intent it = { .it_op = IT_READDIR };
struct mdc_op_data data;
- struct obd_device *obddev = class_exp2obd(sbi->ll_mdc_exp);
+ struct obd_device *obddev = class_exp2obd(sbi->ll_lmv_exp);
struct ldlm_res_id res_id =
- { .name = {lli->lli_st_ino, (__u64)lli->lli_st_generation} };
+ { .name = {id_fid(&lli->lli_id), id_group(&lli->lli_id)} };
ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_UPDATE } };
ENTRY;
rc = ldlm_lock_match(obddev->obd_namespace, LDLM_FL_BLOCK_GRANTED,
&res_id, LDLM_IBITS, &policy, LCK_PR, &lockh);
if (!rc) {
- llu_prepare_mdc_op_data(&data, inode, NULL, NULL, 0, 0);
+ llu_prepare_mdc_data(&data, inode, NULL, NULL, 0, 0);
- rc = mdc_enqueue(sbi->ll_mdc_exp, LDLM_IBITS, &it, LCK_PR,
+ rc = mdc_enqueue(sbi->ll_lmv_exp, LDLM_IBITS, &it, LCK_PR,
&data, &lockh, NULL, 0,
ldlm_completion_ast, llu_mdc_blocking_ast,
inode);
}
ldlm_lock_dump_handle(D_OTHER, &lockh);
- mdc_pack_fid(&mdc_fid, lli->lli_st_ino, lli->lli_st_generation, S_IFDIR);
+ /* FIXME-UMKA: should be here some mds num and mds id? */
+ mdc_pack_id(&id, lli->lli_st_ino, lli->lli_st_generation,
+ S_IFDIR, 0, 0);
offset = page->index << PAGE_SHIFT;
- rc = mdc_readpage(sbi->ll_mdc_exp, &mdc_fid,
- offset, page, &request);
+ rc = mdc_readpage(sbi->ll_lmv_exp, &id, offset, page, &request);
if (!rc) {
body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body));
LASSERT (body != NULL); /* checked by mdc_readpage() */
#include "llite_lib.h"
-void llu_prepare_mdc_op_data(struct mdc_op_data *data,
- struct inode *i1,
- struct inode *i2,
- const char *name,
- int namelen,
- int mode)
+void llu_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+ struct inode *i2, const char *name,
+ int namelen, int mode)
{
LASSERT(i1);
- ll_i2uctxt(&data->ctxt, i1, i2);
- ll_inode2fid(&data->fid1, i1);
-
- if (i2) {
- ll_inode2fid(&data->fid2, i2);
- }
+ ll_inode2id(&data->id1, i1);
+ if (i2)
+ ll_inode2id(&data->id2, i2);
+ data->valid = 0;
data->name = name;
data->namelen = namelen;
data->create_mode = mode;
if (!fd) /* no process opened the file after an mcreate */
RETURN(0);
- rc2 = llu_mdc_close(sbi->ll_mdc_exp, inode);
+ rc2 = llu_mdc_close(sbi->ll_lmv_exp, inode);
if (rc2 && !rc)
rc = rc2;
CERROR("Can't parse NAL %s\n", LIBLUSTRE_NAL_NAME);
RETURN(-EINVAL);
}
- LCFG_INIT(lcfg, LCFG_ADD_UUID, NULL);
+ LCFG_INIT(lcfg, LCFG_ADD_UUID, name);
lcfg.lcfg_nid = nid;
lcfg.lcfg_inllen1 = strlen(peer) + 1;
lcfg.lcfg_inlbuf1 = peer;
ctxt = exp->exp_obd->obd_llog_ctxt[LLOG_CONFIG_REPL_CTXT];
rc = class_config_process_llog(ctxt, g_zconf_profile, cfg);
- if (rc) {
- CERROR("class_config_parse_llog failed: rc = %d\n", rc);
- }
+ if (rc)
+ CERROR("class_config_process_llog failed: rc = %d\n", rc);
err = obd_disconnect(exp, 0);
struct llu_sb_info
{
struct obd_uuid ll_sb_uuid;
- struct obd_export *ll_mdc_exp;
- struct obd_export *ll_osc_exp;
+ struct obd_export *ll_lmv_exp;
+ struct obd_export *ll_lov_exp;
obd_id ll_rootino;
int ll_flags;
struct list_head ll_conn_chain;
struct llu_inode_info {
struct llu_sb_info *lli_sbi;
- struct ll_fid lli_fid;
+ struct lustre_id lli_id;
struct lov_stripe_md *lli_smd;
char *lli_symlink_name;
/* XXX workaround for libsysio readdir */
loff_t lli_dir_pos;
- /* in libsysio we have no chance to store data in file,
- * so place it here. since it's possible that an file
- * was opened several times without close, we track an
- * open_count here */
+ /* in libsysio we have no chance to store data in file, so place it
+ * here. since it's possible that an file was opened several times
+ * without close, we track an open_count here */
struct ll_file_data *lli_file_data;
int lli_open_flags;
int lli_open_count;
static inline struct obd_export *llu_i2obdexp(struct inode *inode)
{
- return llu_i2info(inode)->lli_sbi->ll_osc_exp;
+ return llu_i2info(inode)->lli_sbi->ll_lov_exp;
}
static inline struct obd_export *llu_i2mdcexp(struct inode *inode)
{
- return llu_i2info(inode)->lli_sbi->ll_mdc_exp;
+ return llu_i2info(inode)->lli_sbi->ll_lmv_exp;
}
static inline int llu_is_root_inode(struct inode *inode)
{
- return (llu_i2info(inode)->lli_fid.id ==
+ return (llu_i2info(inode)->lli_id.li_stc.u.e3s.l3s_ino ==
llu_i2info(inode)->lli_sbi->ll_rootino);
}
#define LL_LOOKUP_POSITIVE 1
#define LL_LOOKUP_NEGATIVE 2
-static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
-{
- *fid = llu_i2info(inode)->lli_fid;
-}
-
struct it_cb_data {
struct inode *icbd_parent;
struct pnode *icbd_child;
obd_id hash;
};
+static inline void ll_inode2id(struct lustre_id *id,
+ struct inode *inode)
+{
+ *id = llu_i2info(inode)->lli_id;
+}
+
typedef int (*intent_finish_cb)(struct ptlrpc_request *,
struct inode *parent, struct pnode *pnode,
struct lookup_intent *, int offset, obd_id ino);
extern struct fssw_ops llu_fssw_ops;
/* file.c */
-void llu_prepare_mdc_op_data(struct mdc_op_data *data,
- struct inode *i1,
- struct inode *i2,
- const char *name,
- int namelen,
- int mode);
+void llu_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+ struct inode *i2, const char *name, int namelen,
+ int mode);
+
int llu_create(struct inode *dir, struct pnode_base *pnode, int mode);
int llu_iop_open(struct pnode *pnode, int flags, mode_t mode);
int llu_mdc_close(struct obd_export *mdc_exp, struct inode *inode);
if (inode == NULL)
break;
- lli = llu_i2info(inode);
+ lli = llu_i2info(inode);
if (bits & MDS_INODELOCK_UPDATE)
clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags);
- if (lock->l_resource->lr_name.name[0] != lli->lli_st_ino ||
- lock->l_resource->lr_name.name[1] != lli->lli_st_generation) {
- LDLM_ERROR(lock, "data mismatch with ino %lu/%lu",
- lli->lli_st_ino, lli->lli_st_generation);
+ if (lock->l_resource->lr_name.name[0] != id_fid(&lli->lli_id) ||
+ lock->l_resource->lr_name.name[1] != id_group(&lli->lli_id)) {
+ LDLM_ERROR(lock, "data mismatch with object "DLID4,
+ OLID4(&lli->lli_id));
}
if (S_ISDIR(lli->lli_st_mode) &&
(bits & MDS_INODELOCK_UPDATE)) {
llu_invalidate_inode_pages(inode);
}
-/*
- if (inode->i_sb->s_root &&
- inode != inode->i_sb->s_root->d_inode)
- ll_unhash_aliases(inode);
-*/
I_RELE(inode);
break;
}
if (it_disposition(it, DISP_LOOKUP_NEG))
RETURN(-ENOENT);
- rc = mdc_req2lustre_md(llu_i2sbi(inode)->ll_mdc_exp, req, offset,
- llu_i2sbi(inode)->ll_osc_exp, &md);
+ rc = mdc_req2lustre_md(llu_i2sbi(inode)->ll_lmv_exp, req, offset,
+ llu_i2sbi(inode)->ll_lov_exp, &md);
if (rc)
RETURN(rc);
int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
{
struct pnode_base *pb = pnode->p_base;
- struct ll_fid pfid, cfid;
+ struct lustre_id pid, cid;
struct it_cb_data icbd;
- struct ll_uctxt ctxt;
struct ptlrpc_request *req = NULL;
struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
struct obd_export *exp;
}
exp = llu_i2mdcexp(pb->pb_ino);
- ll_inode2fid(&pfid, pnode->p_parent->p_base->pb_ino);
- ll_inode2fid(&cfid, pb->pb_ino);
+ ll_inode2id(&pid, pnode->p_parent->p_base->pb_ino);
+ ll_inode2id(&cid, pb->pb_ino);
icbd.icbd_parent = pnode->p_parent->p_base->pb_ino;
icbd.icbd_child = pnode;
it->it_op_release = ll_intent_release;
}
- ll_i2uctxt(&ctxt, pnode->p_parent->p_base->pb_ino, pb->pb_ino);
-
- rc = mdc_intent_lock(exp, &ctxt, &pfid,
- pb->pb_name.name, pb->pb_name.len,
- NULL, 0, &cfid, it, flags, &req,
- llu_mdc_blocking_ast);
+ rc = mdc_intent_lock(exp, &pid, pb->pb_name.name, pb->pb_name.len,
+ NULL, 0, &cid, it, flags, &req, llu_mdc_blocking_ast);
/* If req is NULL, then mdc_intent_lock only tried to do a lock match;
* if all was well, it will return 1 if it found locks, 0 otherwise. */
if (req == NULL && rc >= 0)
struct llu_inode_info *lli;
ENTRY;
- rc = mdc_req2lustre_md(sbi->ll_mdc_exp, request, offset,
- sbi->ll_osc_exp, &md);
+ rc = mdc_req2lustre_md(sbi->ll_lmv_exp, request, offset,
+ sbi->ll_lov_exp, &md);
if (rc)
RETURN(rc);
if (!inode || IS_ERR(inode)) {
/* free the lsm if we allocated one above */
if (md.lsm != NULL)
- obd_free_memmd(sbi->ll_osc_exp, &md.lsm);
+ obd_free_memmd(sbi->ll_lov_exp, &md.lsm);
RETURN(inode ? PTR_ERR(inode) : -ENOMEM);
} else if (md.lsm != NULL &&
llu_i2info(inode)->lli_smd != md.lsm) {
- obd_free_memmd(sbi->ll_osc_exp, &md.lsm);
+ obd_free_memmd(sbi->ll_lov_exp, &md.lsm);
}
lli = llu_i2info(inode);
static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
struct lookup_intent *it, int flags)
{
- struct ll_fid pfid;
- struct ll_uctxt ctxt;
+ struct lustre_id pid;
struct it_cb_data icbd;
struct ptlrpc_request *req = NULL;
struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
icbd.icbd_child = pnode;
icbd.icbd_parent = parent;
icbd.icbd_child = pnode;
- ll_inode2fid(&pfid, parent);
- ll_i2uctxt(&ctxt, parent, NULL);
+ ll_inode2id(&pid, parent);
- rc = mdc_intent_lock(llu_i2mdcexp(parent), &ctxt, &pfid,
+ rc = mdc_intent_lock(llu_i2mdcexp(parent), &pid,
pnode->p_base->pb_name.name,
pnode->p_base->pb_name.len,
NULL, 0, NULL, it, flags, &req,
#include <fcntl.h>
#include <sys/uio.h>
-#include <xtio.h>
-#include <sysio.h>
#include <fs.h>
+#include <sysio.h>
#include <mount.h>
#include <inode.h>
#include <file.h>
CDEBUG(D_DLMTRACE, "Glimpsing inode %lu\n", lli->lli_st_ino);
- rc = obd_enqueue(sbi->ll_osc_exp, lli->lli_smd, LDLM_EXTENT, &policy,
+ rc = obd_enqueue(sbi->ll_lov_exp, lli->lli_smd, LDLM_EXTENT, &policy,
LCK_PR, &flags, llu_extent_lock_callback,
ldlm_completion_ast, llu_glimpse_callback, inode,
sizeof(struct ost_lvb), lustre_swab_ost_lvb, &lockh);
CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n",
lli->lli_st_size, lli->lli_st_blocks);
- obd_cancel(sbi->ll_osc_exp, lli->lli_smd, LCK_PR, &lockh);
+ obd_cancel(sbi->ll_lov_exp, lli->lli_smd, LCK_PR, &lockh);
RETURN(rc);
}
CDEBUG(D_DLMTRACE, "Locking inode %lu, start "LPU64" end "LPU64"\n",
lli->lli_st_ino, policy->l_extent.start, policy->l_extent.end);
- rc = obd_enqueue(sbi->ll_osc_exp, lsm, LDLM_EXTENT, policy, mode,
+ rc = obd_enqueue(sbi->ll_lov_exp, lsm, LDLM_EXTENT, policy, mode,
&ast_flags, llu_extent_lock_callback,
ldlm_completion_ast, llu_glimpse_callback, inode,
sizeof(struct ost_lvb), lustre_swab_ost_lvb, lockh);
(sbi->ll_flags & LL_SBI_NOLCK))
RETURN(0);
- rc = obd_cancel(sbi->ll_osc_exp, lsm, mode, lockh);
+ rc = obd_cancel(sbi->ll_lov_exp, lsm, mode, lockh);
RETURN(rc);
}
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <sys/queue.h>
+
#ifndef __CYGWIN__
# include <sys/statvfs.h>
#else
# include <sys/statfs.h>
#endif
-#include <sysio.h>
#include <fs.h>
+#include <sysio.h>
#include <mount.h>
#include <inode.h>
#include <file.h>
#undef LIST_HEAD
-
#include "llite_lib.h"
#ifndef MAY_EXEC
-#define MAY_EXEC 1
-#define MAY_WRITE 2
-#define MAY_READ 4
+# define MAY_EXEC 1
+# define MAY_WRITE 2
+# define MAY_READ 4
#endif
#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
static void llu_fsop_gone(struct filesys *fs)
{
struct llu_sb_info *sbi = (struct llu_sb_info *) fs->fs_private;
- struct obd_device *obd = class_exp2obd(sbi->ll_mdc_exp);
+ struct obd_device *obd = class_exp2obd(sbi->ll_lmv_exp);
struct lustre_cfg lcfg;
int next = 0;
ENTRY;
list_del(&sbi->ll_conn_chain);
- obd_disconnect(sbi->ll_osc_exp, 0);
- obd_disconnect(sbi->ll_mdc_exp, 0);
+ obd_disconnect(sbi->ll_lov_exp, 0);
+ obd_disconnect(sbi->ll_lmv_exp, 0);
while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)) != NULL)
{
}
}
+ obd_disconnect(sbi->ll_lmv_exp, 0);
OBD_FREE(sbi, sizeof(*sbi));
-
EXIT;
}
-static struct inode_ops llu_inode_ops;
+struct inode_ops llu_inode_ops;
void llu_update_inode(struct inode *inode, struct mds_body *body,
struct lov_stripe_md *lsm)
}
}
+ /*
+ * updating inode lustre id. We try optimize things a little bit here,
+ * thus do not do it all the time.
+ */
+ if (body->valid & OBD_MD_FID)
+ id_assign_fid(&lli->lli_id, &body->id1);
+ if ((body->valid & OBD_MD_FLID) || (body->valid & OBD_MD_FLGENER))
+ id_assign_stc(&lli->lli_id, &body->id1);
if (body->valid & OBD_MD_FLID)
- lli->lli_st_ino = body->ino;
+ lli->lli_st_ino = id_ino(&body->id1);
+ if (body->valid & OBD_MD_FLGENER)
+ lli->lli_st_generation = id_gen(&body->id1);
+
if (body->valid & OBD_MD_FLATIME)
LTIME_S(lli->lli_st_atime) = body->atime;
if (body->valid & OBD_MD_FLMTIME)
lli->lli_st_flags = body->flags;
if (body->valid & OBD_MD_FLNLINK)
lli->lli_st_nlink = body->nlink;
- if (body->valid & OBD_MD_FLGENER)
- lli->lli_st_generation = body->generation;
if (body->valid & OBD_MD_FLRDEV)
lli->lli_st_rdev = body->rdev;
if (body->valid & OBD_MD_FLSIZE)
lli->lli_st_size = body->size;
if (body->valid & OBD_MD_FLBLOCKS)
lli->lli_st_blocks = body->blocks;
-
- /* fillin fid */
- if (body->valid & OBD_MD_FLID)
- lli->lli_fid.id = body->ino;
- if (body->valid & OBD_MD_FLGENER)
- lli->lli_fid.generation = body->generation;
- if (body->valid & OBD_MD_FLTYPE)
- lli->lli_fid.f_type = body->mode & S_IFMT;
}
void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
}
static struct inode* llu_new_inode(struct filesys *fs,
- struct ll_fid *fid)
+ struct lustre_id *id)
{
struct inode *inode;
struct llu_inode_info *lli;
lli->lli_maxbytes = (__u64)(~0UL);
lli->lli_file_data = NULL;
- lli->lli_sysio_fid.fid_data = &lli->lli_fid;
- lli->lli_sysio_fid.fid_len = sizeof(lli->lli_fid);
+ lli->lli_sysio_fid.fid_data = &lli->lli_id;
+ lli->lli_sysio_fid.fid_len = sizeof(lli->lli_id);
- memcpy(&lli->lli_fid, fid, sizeof(*fid));
+ memcpy(&lli->lli_id, id, sizeof(*id));
/* file identifier is needed by functions like _sysio_i_find() */
inode = _sysio_i_new(fs, &lli->lli_sysio_fid,
#ifndef AUTOMOUNT_FILE_NAME
- fid->f_type & S_IFMT,
+ id->li_stc.u.e3s.l3s_type & S_IFMT,
#else
- fid->f_type, /* all of the bits! */
+ id->li_stc.u.e3s.l3s_type, /* all of the bits! */
#endif
0, 0,
&llu_inode_ops, lli);
LASSERT(inode);
- obddev = sbi->ll_mdc_exp->exp_obd;
- res_id.name[0] = lli->lli_st_ino;
- res_id.name[1] = lli->lli_st_generation;
+ obddev = sbi->ll_lmv_exp->exp_obd;
+ res_id.name[0] = id_fid(&lli->lli_id);
+ res_id.name[1] = id_group(&lli->lli_id);
CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]);
struct lustre_md md;
struct ptlrpc_request *req = NULL;
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct ll_fid fid;
+ struct lustre_id id;
unsigned long valid = 0;
int rc, ealen = 0;
- /* Why don't we update all valid MDS fields here, if we're
- * doing an RPC anyways? -phil */
+ /* Why don't we update all valid MDS fields here, if we're doing
+ * an RPC anyways? -phil */
if (S_ISREG(lli->lli_st_mode)) {
- ealen = obd_size_diskmd(sbi->ll_osc_exp, NULL);
+ ealen = obd_size_diskmd(sbi->ll_lov_exp, NULL);
valid |= OBD_MD_FLEASIZE;
}
- ll_inode2fid(&fid, inode);
- rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, ealen, &req);
+ ll_inode2id(&id, inode);
+ rc = mdc_getattr(sbi->ll_lmv_exp, &id, valid, ealen, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, lli->lli_st_ino);
RETURN(-abs(rc));
}
- rc = mdc_req2lustre_md(sbi->ll_mdc_exp, req, 0, sbi->ll_osc_exp,
- &md);
+ rc = mdc_req2lustre_md(sbi->ll_lmv_exp, req, 0,
+ sbi->ll_lov_exp, &md);
/* XXX Too paranoid? */
if (((md.body->valid ^ valid) & OBD_MD_FLEASIZE) &&
llu_update_inode(inode, md.body, md.lsm);
if (md.lsm != NULL && llu_i2info(inode)->lli_smd != md.lsm)
- obd_free_memmd(sbi->ll_osc_exp, &md.lsm);
+ obd_free_memmd(sbi->ll_lov_exp, &md.lsm);
if (md.body->valid & OBD_MD_FLSIZE)
set_bit(LLI_F_HAVE_MDS_SIZE_LOCK,
void llu_clear_inode(struct inode *inode)
{
- struct ll_fid fid;
+ struct lustre_id id;
struct llu_inode_info *lli = llu_i2info(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%lu(%p)\n", lli->lli_st_ino,
lli->lli_st_generation, inode);
- ll_inode2fid(&fid, inode);
+ ll_inode2id(&id, inode);
clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(lli->lli_flags));
- mdc_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode);
+ mdc_change_cbdata(sbi->ll_lmv_exp, &id, null_if_equal, inode);
if (lli->lli_smd)
- obd_change_cbdata(sbi->ll_osc_exp, lli->lli_smd,
+ obd_change_cbdata(sbi->ll_lov_exp, lli->lli_smd,
null_if_equal, inode);
if (lli->lli_smd) {
- obd_free_memmd(sbi->ll_osc_exp, &lli->lli_smd);
+ obd_free_memmd(sbi->ll_lov_exp, &lli->lli_smd);
lli->lli_smd = NULL;
}
* inode ourselves so we can call obdo_from_inode() always. */
if (ia_valid & (lsm ? ~(ATTR_SIZE | ATTR_FROM_OPEN | ATTR_RAW) : ~0)) {
struct lustre_md md;
- llu_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
-
- rc = mdc_setattr(sbi->ll_mdc_exp, &op_data,
- attr, NULL, 0, NULL, 0, &request);
+ llu_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
+ rc = mdc_setattr(sbi->ll_lmv_exp, &op_data,
+ attr, NULL, 0, NULL, 0, &request);
+
if (rc) {
ptlrpc_req_finished(request);
if (rc != -EPERM && rc != -EACCES)
RETURN(rc);
}
- rc = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0,
- sbi->ll_osc_exp, &md);
+ rc = mdc_req2lustre_md(sbi->ll_lmv_exp, request, 0,
+ sbi->ll_lov_exp, &md);
if (rc) {
ptlrpc_req_finished(request);
RETURN(rc);
oa.o_valid = OBD_MD_FLID;
obdo_from_inode(&oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
OBD_MD_FLMTIME | OBD_MD_FLCTIME);
- rc = obd_setattr(sbi->ll_osc_exp, &oa, lsm, NULL);
+ rc = obd_setattr(sbi->ll_lov_exp, &oa, lsm, NULL);
if (rc)
CERROR("obd_setattr fails: rc=%d\n", rc);
}
if (llu_i2info(dir)->lli_st_nlink >= EXT2_LINK_MAX)
RETURN(err);
- llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- err = mdc_create(sbi->ll_mdc_exp, &op_data,
+ llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ err = mdc_create(sbi->ll_lmv_exp, &op_data,
tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
current->fsuid, current->fsgid, 0, &request);
ptlrpc_req_finished(request);
{
struct llu_inode_info *lli = llu_i2info(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct ll_fid fid;
+ struct lustre_id id;
struct mds_body *body;
int rc, symlen = lli->lli_st_size + 1;
ENTRY;
RETURN(0);
}
- ll_inode2fid(&fid, inode);
- rc = mdc_getattr(sbi->ll_mdc_exp, &fid,
+ ll_inode2id(&id, inode);
+ rc = mdc_getattr(sbi->ll_lmv_exp, &id,
OBD_MD_LINKNAME, symlen, request);
if (rc) {
CERROR("inode %lu: rc = %d\n", lli->lli_st_ino, rc);
case S_IFBLK:
case S_IFIFO:
case S_IFSOCK:
- llu_prepare_mdc_op_data(&op_data, dir, NULL,
- pno->p_base->pb_name.name,
- pno->p_base->pb_name.len,
- 0);
- err = mdc_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
+ llu_prepare_mdc_data(&op_data, dir, NULL,
+ pno->p_base->pb_name.name,
+ pno->p_base->pb_name.len,
+ 0);
+ err = mdc_create(sbi->ll_lmv_exp, &op_data, NULL, 0, mode,
current->fsuid, current->fsgid, dev, &request);
ptlrpc_req_finished(request);
break;
LASSERT(dir);
liblustre_wait_event(0);
- llu_prepare_mdc_op_data(&op_data, src, dir, name, namelen, 0);
- rc = mdc_link(llu_i2sbi(src)->ll_mdc_exp, &op_data, &request);
+ llu_prepare_mdc_data(&op_data, src, dir, name, namelen, 0);
+ rc = mdc_link(llu_i2sbi(src)->ll_lmv_exp, &op_data, &request);
ptlrpc_req_finished(request);
liblustre_wait_event(0);
LASSERT(target);
liblustre_wait_event(0);
- llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- rc = mdc_unlink(llu_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
+ llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ rc = mdc_unlink(llu_i2sbi(dir)->ll_lmv_exp, &op_data, &request);
if (!rc)
rc = llu_objects_destroy(request, dir);
ptlrpc_req_finished(request);
liblustre_wait_event(0);
-
RETURN(rc);
}
LASSERT(src);
LASSERT(tgt);
- llu_prepare_mdc_op_data(&op_data, src, tgt, NULL, 0, 0);
- rc = mdc_rename(llu_i2sbi(src)->ll_mdc_exp, &op_data,
+ llu_prepare_mdc_data(&op_data, src, tgt, NULL, 0, 0);
+ rc = mdc_rename(llu_i2sbi(src)->ll_lmv_exp, &op_data,
oldname, oldnamelen, newname, newnamelen,
&request);
if (!rc) {
int rc;
ENTRY;
- rc = obd_statfs(class_exp2obd(sbi->ll_mdc_exp), osfs, max_age);
+ rc = obd_statfs(class_exp2obd(sbi->ll_lmv_exp), osfs, max_age);
if (rc) {
CERROR("mdc_statfs fails: rc = %d\n", rc);
RETURN(rc);
CDEBUG(D_SUPER, "MDC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
- rc = obd_statfs(class_exp2obd(sbi->ll_osc_exp), &obd_osfs, max_age);
+ rc = obd_statfs(class_exp2obd(sbi->ll_lov_exp), &obd_osfs, max_age);
if (rc) {
CERROR("obd_statfs fails: rc = %d\n", rc);
RETURN(rc);
buf->f_files = fs.f_files; /* Total number serial numbers */
buf->f_ffree = fs.f_ffree; /* Number free serial numbers */
buf->f_favail = fs.f_ffree; /* Number free ser num for non-privileged*/
- buf->f_fsid = fs.f_fsid.__val[1];
+ buf->f_fsid = fs.f_fstc.__val[1];
buf->f_flag = 0; /* No equiv in statfs; maybe use type? */
buf->f_namemax = fs.f_namelen;
#endif
RETURN(err);
mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
- llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- err = mdc_create(llu_i2sbi(dir)->ll_mdc_exp, &op_data, NULL, 0, mode,
+ llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ err = mdc_create(llu_i2sbi(dir)->ll_lmv_exp, &op_data, NULL, 0, mode,
current->fsuid, current->fsgid, 0, &request);
ptlrpc_req_finished(request);
RETURN(err);
CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%lu(%p)\n",
name, lli->lli_st_ino, lli->lli_st_generation, dir);
- llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, S_IFDIR);
- rc = mdc_unlink(llu_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
+ llu_prepare_mdc_data(&op_data, dir, NULL, name, len, S_IFDIR);
+ rc = mdc_unlink(llu_i2sbi(dir)->ll_lmv_exp, &op_data, &request);
ptlrpc_req_finished(request);
RETURN(rc);
flags = va_arg(ap, long);
flags &= FCNTL_FLMASK;
if (flags & FCNTL_FLMASK_INVALID) {
- CERROR("liblustre don't support O_NONBLOCK, O_ASYNC, "
+ CERROR("liblustre does not support O_NONBLOCK, O_ASYNC, "
"and O_DIRECT on file descriptor\n");
*rtn = -1;
return EINVAL;
struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
{
struct inode *inode;
- struct ll_fid fid;
- struct file_identifier fileid = {&fid, sizeof(fid)};
+ struct lustre_id id;
+ struct file_identifier fileid = {&id, sizeof(id)};
if ((md->body->valid &
(OBD_MD_FLGENER | OBD_MD_FLID | OBD_MD_FLTYPE)) !=
return ERR_PTR(-EPERM);
}
- /* try to find existing inode */
- fid.id = md->body->ino;
- fid.generation = md->body->generation;
- fid.f_type = md->body->mode & S_IFMT;
+ id = md->body->id1;
+ /* try to find existing inode */
inode = _sysio_i_find(fs, &fileid);
if (inode) {
struct llu_inode_info *lli = llu_i2info(inode);
if (inode->i_zombie ||
- lli->lli_st_generation != md->body->generation) {
+ lli->lli_st_generation != id_gen(&md->body->id1)) {
I_RELE(inode);
}
else {
}
}
- inode = llu_new_inode(fs, &fid);
+ inode = llu_new_inode(fs, &id);
if (inode)
llu_update_inode(inode, md->body, md->lsm);
return inode;
}
-extern struct list_head lustre_profile_list;
-
static int
llu_fsswop_mount(const char *source,
unsigned flags,
struct inode *root;
struct pnode_base *rootpb;
struct obd_device *obd;
- struct ll_fid rootfid;
+ struct lustre_id rootid;
struct llu_sb_info *sbi;
struct obd_statfs osfs;
static struct qstr noname = { NULL, 0, 0 };
struct ptlrpc_request *request = NULL;
- struct lustre_handle mdc_conn = {0, };
- struct lustre_handle osc_conn = {0, };
+ struct lustre_handle lmv_conn = {0, };
+ struct lustre_handle lov_conn = {0, };
struct lustre_md md;
class_uuid_t uuid;
struct config_llog_instance cfg;
struct lustre_profile *lprof;
- char *osc = NULL, *mdc = NULL;
+ char *lov = NULL, *lmv = NULL;
int async = 1, err = -EINVAL;
ENTRY;
CERROR("No profile found: %s\n", g_zconf_profile);
GOTO(out_free, err = -EINVAL);
}
- if (osc)
- OBD_FREE(osc, strlen(osc) + 1);
- OBD_ALLOC(osc, strlen(lprof->lp_osc) +
+ if (lov)
+ OBD_FREE(lov, strlen(lov) + 1);
+ OBD_ALLOC(lov, strlen(lprof->lp_lov) +
strlen(sbi->ll_instance) + 2);
- sprintf(osc, "%s-%s", lprof->lp_osc, sbi->ll_instance);
+ sprintf(lov, "%s-%s", lprof->lp_lov, sbi->ll_instance);
- if (mdc)
- OBD_FREE(mdc, strlen(mdc) + 1);
- OBD_ALLOC(mdc, strlen(lprof->lp_mdc) +
+ if (lmv)
+ OBD_FREE(lmv, strlen(lmv) + 1);
+ OBD_ALLOC(lmv, strlen(lprof->lp_lmv) +
strlen(sbi->ll_instance) + 2);
- sprintf(mdc, "%s-%s", lprof->lp_mdc, sbi->ll_instance);
+ sprintf(lmv, "%s-%s", lprof->lp_lmv, sbi->ll_instance);
- if (!osc) {
+ if (!lov) {
CERROR("no osc\n");
GOTO(out_free, err = -EINVAL);
}
- if (!mdc) {
+ if (!lmv) {
CERROR("no mdc\n");
GOTO(out_free, err = -EINVAL);
}
goto out_free;
}
- obd = class_name2obd(mdc);
+ obd = class_name2obd(lmv);
if (!obd) {
- CERROR("MDC %s: not setup or attached\n", mdc);
+ CERROR("MDC %s: not setup or attached\n", lmv);
GOTO(out_free, err = -EINVAL);
}
obd_set_info(obd->obd_self_export, strlen("async"), "async",
sizeof(async), &async);
#warning "FIXME ASAP!"
#if 0
- if (mdc_init_ea_size(obd, osc))
+ if (mdc_init_ea_size(obd, lov))
GOTO(out_free, err = -EINVAL);
#endif
/* setup mdc */
- err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, 0);
+ err = obd_connect(&lmv_conn, obd, &sbi->ll_sb_uuid, 0);
if (err) {
- CERROR("cannot connect to %s: rc = %d\n", mdc, err);
+ CERROR("cannot connect to %s: rc = %d\n", lmv, err);
GOTO(out_free, err);
}
- sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
+ sbi->ll_lmv_exp = class_conn2export(&lmv_conn);
err = obd_statfs(obd, &osfs, 100000000);
if (err)
- GOTO(out_mdc, err);
+ GOTO(out_lmv, err);
/*
* FIXME fill fs stat data into sbi here!!! FIXME
*/
- /* setup osc */
- obd = class_name2obd(osc);
+ /* setup lov */
+ obd = class_name2obd(lov);
if (!obd) {
- CERROR("OSC %s: not setup or attached\n", osc);
- GOTO(out_mdc, err = -EINVAL);
+ CERROR("OSC %s: not setup or attached\n", lov);
+ GOTO(out_lmv, err = -EINVAL);
}
obd_set_info(obd->obd_self_export, strlen("async"), "async",
sizeof(async), &async);
- err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, 0);
+ err = obd_connect(&lov_conn, obd, &sbi->ll_sb_uuid, 0);
if (err) {
- CERROR("cannot connect to %s: rc = %d\n", osc, err);
- GOTO(out_mdc, err);
+ CERROR("cannot connect to %s: rc = %d\n", lov, err);
+ GOTO(out_lmv, err);
}
- sbi->ll_osc_exp = class_conn2export(&osc_conn);
+ sbi->ll_lov_exp = class_conn2export(&lov_conn);
- err = mdc_getstatus(sbi->ll_mdc_exp, &rootfid);
+ err = mdc_getstatus(sbi->ll_lmv_exp, &rootid);
if (err) {
CERROR("cannot mds_connect: rc = %d\n", err);
- GOTO(out_osc, err);
+ GOTO(out_lov, err);
}
- CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
- sbi->ll_rootino = rootfid.id;
+ CDEBUG(D_SUPER, "rootid "LPU64"\n", rootid.li_stc.u.e3s.l3s_ino);
+ sbi->ll_rootino = rootid.li_stc.u.e3s.l3s_ino;
/* fetch attr of root inode */
- err = mdc_getattr(sbi->ll_mdc_exp, &rootfid,
+ err = mdc_getattr(sbi->ll_lmv_exp, &rootid,
OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
if (err) {
CERROR("mdc_getattr failed for root: rc = %d\n", err);
- GOTO(out_osc, err);
+ GOTO(out_lov, err);
}
- err = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0, sbi->ll_osc_exp,
- &md);
+ err = mdc_req2lustre_md(sbi->ll_lmv_exp, request, 0,
+ sbi->ll_lov_exp, &md);
if (err) {
CERROR("failed to understand root inode md: rc = %d\n",err);
GOTO(out_request, err);
_sysio_i_gone(root);
out_request:
ptlrpc_req_finished(request);
-out_osc:
- obd_disconnect(sbi->ll_osc_exp, 0);
-out_mdc:
- obd_disconnect(sbi->ll_mdc_exp, 0);
+out_lov:
+ obd_disconnect(sbi->ll_lov_exp, 0);
+out_lmv:
+ obd_disconnect(sbi->ll_lmv_exp, 0);
out_free:
OBD_FREE(sbi, sizeof(*sbi));
return err;
llu_fsswop_mount
};
-static struct inode_ops llu_inode_ops = {
- inop_lookup: llu_iop_lookup,
- inop_getattr: llu_iop_getattr,
- inop_setattr: llu_iop_setattr,
- inop_getdirentries: llu_iop_getdirentries,
- inop_mkdir: llu_iop_mkdir_raw,
- inop_rmdir: llu_iop_rmdir_raw,
- inop_symlink: llu_iop_symlink_raw,
- inop_readlink: llu_iop_readlink,
- inop_open: llu_iop_open,
- inop_close: llu_iop_close,
- inop_link: llu_iop_link_raw,
- inop_unlink: llu_iop_unlink_raw,
- inop_rename: llu_iop_rename_raw,
- inop_pos: llu_iop_pos,
- inop_read: llu_iop_read,
- inop_write: llu_iop_write,
- inop_iodone: llu_iop_iodone,
- inop_fcntl: llu_iop_fcntl,
- inop_sync: llu_iop_sync,
- inop_datasync: llu_iop_datasync,
- inop_ioctl: llu_iop_ioctl,
- inop_mknod: llu_iop_mknod_raw,
+struct inode_ops llu_inode_ops = {
+ .inop_lookup = llu_iop_lookup,
+ .inop_getattr = llu_iop_getattr,
+ .inop_setattr = llu_iop_setattr,
+ .inop_getdirentries = llu_iop_getdirentries,
+ .inop_mkdir = llu_iop_mkdir_raw,
+ .inop_rmdir = llu_iop_rmdir_raw,
+ .inop_symlink = llu_iop_symlink_raw,
+ .inop_readlink = llu_iop_readlink,
+ .inop_open = llu_iop_open,
+ .inop_close = llu_iop_close,
+ .inop_link = llu_iop_link_raw,
+ .inop_unlink = llu_iop_unlink_raw,
+ .inop_rename = llu_iop_rename_raw,
+ .inop_iodone = llu_iop_iodone,
+ .inop_fcntl = llu_iop_fcntl,
+ .inop_sync = llu_iop_sync,
+ .inop_read = llu_iop_read,
+ .inop_write = llu_iop_write,
+ .inop_datasync = llu_iop_datasync,
+ .inop_ioctl = llu_iop_ioctl,
+ .inop_mknod = llu_iop_mknod_raw,
#ifdef _HAVE_STATVFS
- inop_statvfs: llu_iop_statvfs,
+ .inop_statvfs = llu_iop_statvfs,
#endif
- inop_gone: llu_iop_gone,
+ .inop_gone = llu_iop_gone,
};
RETURN(-ENOENT);
sbi = ll_i2sbi(de->d_inode);
- rc = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
+ rc = ll_prep_inode(sbi->ll_lov_exp, sbi->ll_lmv_exp,
&de->d_inode, request, offset, NULL);
RETURN(rc);
}
/* drop lookup or getattr locks immediately */
- if (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR || it->it_op == IT_CHDIR) {
+ if (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR ||
+ it->it_op == IT_CHDIR) {
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
- /* on 2.6 there are situation when several lookups and
+ /*
+ * on 2.6 there are situations when several lookups and
* revalidations may be requested during single operation.
- * therefore, we don't release intent here -bzzz */
+ * Therefore, we don't release intent here -bzzz
+ */
ll_intent_drop_lock(it);
#else
ll_intent_release(it);
void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
{
struct lookup_intent *it = *itp;
+
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
if (it) {
LASSERTF(it->it_magic == INTENT_MAGIC, "bad intent magic: %x\n",
int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
struct lookup_intent *it)
{
- int rc;
- struct ll_fid pfid, cfid;
- struct it_cb_data icbd;
- struct ptlrpc_request *req = NULL;
struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
+ struct ptlrpc_request *req = NULL;
+ struct it_cb_data icbd;
struct obd_export *exp;
-
+ struct lustre_id pid;
+ struct lustre_id cid;
+ int rc;
ENTRY;
- CDEBUG(D_VFSTRACE, "VFS Op:name=%s,intent=%s\n", de->d_name.name,
+
+ CDEBUG(D_VFSTRACE, "VFS Op:name=%s, intent=%s\n", de->d_name.name,
LL_IT2STR(it));
/* Cached negative dentries are unsafe for now - look them up again */
RETURN(0);
CDEBUG(D_INODE, "revalidate 0x%p: %*s -> %lu/%lu\n",
- de, de->d_name.len, de->d_name.name,
- (unsigned long) de->d_inode->i_ino,
- (unsigned long) de->d_inode->i_generation);
+ de, de->d_name.len, de->d_name.name,
+ (unsigned long) de->d_inode->i_ino,
+ (unsigned long) de->d_inode->i_generation);
+
+ exp = ll_i2lmvexp(de->d_inode);
+ ll_inode2id(&pid, de->d_parent->d_inode);
+ ll_inode2id(&cid, de->d_inode);
+ LASSERT(id_fid(&cid) != 0);
- exp = ll_i2mdcexp(de->d_inode);
- ll_inode2fid(&pfid, de->d_parent->d_inode);
- ll_inode2fid(&cfid, de->d_inode);
icbd.icbd_parent = de->d_parent->d_inode;
icbd.icbd_childp = &de;
- /* Never execute intents for mount points.
- * Attributes will be fixed up in ll_inode_revalidate_it */
+ /*
+ * never execute intents for mount points. Attributes will be fixed up
+ * in ll_inode_revalidate_it().
+ */
if (d_mountpoint(de))
RETURN(1);
nd->mnt->mnt_last_used = jiffies;
ll_frob_intent(&it, &lookup_it);
- LASSERT(it);
+ LASSERT(it != NULL);
- if (it->it_op == IT_GETATTR) { /* We need to check for LOOKUP lock
- as well */
- rc = md_intent_lock(exp, &pfid, de->d_name.name,
- de->d_name.len, NULL, 0, &cfid, &lookup_it,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ /*
+ * to show, that client already has inode and it needs to revalidate,
+ * all fields but fid. mdc_intent_lock() will use this flag.
+ */
+ it->d.lustre.it_int_flags |= LL_IT_EXIST;
+#endif
+
+ if (it->it_op == IT_GETATTR) { /* We need to check for LOOKUP lock as
+ well */
+ rc = md_intent_lock(exp, &pid, de->d_name.name,
+ de->d_name.len, NULL, 0, &cid, &lookup_it,
flags, &req, ll_mdc_blocking_ast);
/* If there was no lookup lock, no point in even checking for
UPDATE lock */
ll_lookup_finish_locks(&lookup_it, de);
}
- rc = md_intent_lock(exp, &pfid, de->d_name.name, de->d_name.len,
- NULL, 0, &cfid, it, flags, &req,
+ rc = md_intent_lock(exp, &pid, de->d_name.name, de->d_name.len,
+ NULL, 0, &cid, it, flags, &req,
ll_mdc_blocking_ast);
+
/* If req is NULL, then mdc_intent_lock only tried to do a lock match;
* if all was well, it will return 1 if it found locks, 0 otherwise. */
if (req == NULL && rc >= 0)
if (rc < 0) {
if (rc != -ESTALE) {
- CDEBUG(D_INFO, "ll_intent_lock: rc %d : it->it_status "
+ CDEBUG(D_INFO, "ll_intent_lock(): rc %d : it->it_status "
"%d\n", rc, it->d.lustre.it_status);
}
GOTO(out, rc = 0);
spin_unlock(&dcache_lock);
GOTO(out, rc);
- out:
+out:
if (req != NULL && rc == 1)
ptlrpc_req_finished(req);
if (rc == 0) {
unlock_kernel();
handle = (flag) ? &ldd->lld_mnt_och : &ldd->lld_cwd_och;
- rc = obd_pin(sbi->ll_mdc_exp, inode->i_ino, inode->i_generation,
+ rc = obd_pin(sbi->ll_lmv_exp, inode->i_ino, inode->i_generation,
inode->i_mode & S_IFMT, handle, flag);
if (rc) {
return;
}
- rc = obd_unpin(sbi->ll_mdc_exp, &handle, flag);
+ rc = obd_unpin(sbi->ll_lmv_exp, &handle, flag);
EXIT;
- return;
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
static void ll_dentry_iput(struct dentry *dentry, struct inode *inode)
{
struct ll_sb_info *sbi = ll_i2sbi(inode);
- struct ll_fid parent, child;
+ struct lustre_id parent, child;
LASSERT(dentry->d_parent && dentry->d_parent->d_inode);
- ll_inode2fid(&parent, dentry->d_parent->d_inode);
- ll_inode2fid(&child, inode);
- md_change_cbdata_name(sbi->ll_mdc_exp, &parent,
+ ll_inode2id(&parent, dentry->d_parent->d_inode);
+ ll_inode2id(&child, inode);
+ md_change_cbdata_name(sbi->ll_lmv_exp, &parent,
(char *)dentry->d_name.name,
dentry->d_name.len, &child,
null_if_equal, inode);
static void ll_dentry_iput(struct dentry *dentry, struct inode *inode)
{
struct ll_sb_info *sbi = ll_i2sbi(inode);
- struct ll_fid parent, child;
+ struct lustre_id parent, child;
LASSERT(dentry->d_parent && dentry->d_parent->d_inode);
- ll_inode2fid(&parent, dentry->d_parent->d_inode);
- ll_inode2fid(&child, inode);
- md_change_cbdata_name(sbi->ll_mdc_exp, &parent,
+ ll_inode2id(&parent, dentry->d_parent->d_inode);
+ ll_inode2id(&child, inode);
+ md_change_cbdata_name(sbi->ll_lmv_exp, &parent,
(char *)dentry->d_name.name,
dentry->d_name.len, &child,
null_if_equal, inode);
static int ll_dir_readpage(struct file *file, struct page *page)
{
struct inode *inode = page->mapping->host;
- struct ll_fid mdc_fid;
- __u64 offset;
struct ptlrpc_request *request;
struct mds_body *body;
+ struct lustre_id id;
+ __u64 offset;
int rc = 0;
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
inode->i_generation, inode);
- mdc_pack_fid(&mdc_fid, inode->i_ino, inode->i_generation, S_IFDIR);
- mdc_fid.mds = ll_i2info(inode)->lli_mds;
+ mdc_pack_id(&id, inode->i_ino, inode->i_generation,
+ S_IFDIR, id_group(&ll_i2info(inode)->lli_id),
+ id_fid(&ll_i2info(inode)->lli_id));
+
offset = page->index << PAGE_SHIFT;
- rc = md_readpage(ll_i2sbi(inode)->ll_mdc_exp, &mdc_fid,
- offset, page, &request);
+ rc = md_readpage(ll_i2sbi(inode)->ll_lmv_exp, &id, offset,
+ page, &request);
if (!rc) {
- body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body));
- LASSERT (body != NULL); /* checked by md_readpage() */
+ body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*body));
+ LASSERT (body != NULL); /* checked by md_readpage() */
LASSERT_REPSWABBED (request, 0); /* swabbed by md_readpage() */
#warning "FIXME ASAP!"
ptlrpc_req_finished(request);
unlock_page(page);
- EXIT;
- return rc;
+ RETURN(rc);
}
struct address_space_operations ll_dir_aops = {
return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
}
-
static void ext2_check_page(struct page *page)
{
struct inode *dir = page->mapping->host;
static struct page *ll_get_dir_page(struct inode *dir, unsigned long n)
{
+ struct ll_inode_info *li = ll_i2info(dir);
struct ldlm_res_id res_id =
- { .name = { dir->i_ino, (__u64)dir->i_generation} };
+ { .name = { id_fid(&li->lli_id), id_group(&li->lli_id)} };
struct lustre_handle lockh;
- struct obd_device *obddev = class_exp2obd(ll_i2sbi(dir)->ll_mdc_exp);
+ struct obd_device *obddev = class_exp2obd(ll_i2sbi(dir)->ll_lmv_exp);
struct address_space *mapping = dir->i_mapping;
struct page *page;
ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_UPDATE } };
int rc;
- obddev = md_get_real_obd(ll_i2sbi(dir)->ll_mdc_exp, NULL, 0);
+ obddev = md_get_real_obd(ll_i2sbi(dir)->ll_lmv_exp, NULL, 0);
rc = ldlm_lock_match(obddev->obd_namespace, LDLM_FL_BLOCK_GRANTED,
&res_id, LDLM_IBITS, &policy, LCK_PR, &lockh);
if (!rc) {
struct ptlrpc_request *request;
struct mdc_op_data data;
- ll_prepare_mdc_op_data(&data, dir, NULL, NULL, 0, 0);
+ ll_prepare_mdc_data(&data, dir, NULL, NULL, 0, 0);
- rc = md_enqueue(ll_i2sbi(dir)->ll_mdc_exp, LDLM_IBITS, &it,
+ rc = md_enqueue(ll_i2sbi(dir)->ll_lmv_exp, LDLM_IBITS, &it,
LCK_PR, &data, &lockh, NULL, 0,
ldlm_completion_ast, ll_mdc_blocking_ast, dir);
mode = lums.lums_mode;
mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
- ll_prepare_mdc_op_data(&op_data, inode, NULL, name,lums.lums_namelen,0);
- err = md_create(sbi->ll_mdc_exp, &op_data, &nstripes, sizeof(nstripes),
+ ll_prepare_mdc_data(&op_data, inode, NULL, name,lums.lums_namelen,0);
+ err = md_create(sbi->ll_lmv_exp, &op_data, &nstripes, sizeof(nstripes),
mode, current->fsuid, current->fsgid, 0, &request);
ptlrpc_req_finished(request);
RETURN(ll_iocontrol(inode, file, cmd, arg));
case IOC_MDC_LOOKUP: {
struct ptlrpc_request *request = NULL;
- struct ll_fid fid;
+ struct lustre_id id;
char *buf = NULL;
char *filename;
int namelen, rc, len = 0;
}
valid = OBD_MD_FLID;
- ll_inode2fid(&fid, inode);
- rc = md_getattr_name(sbi->ll_mdc_exp, &fid,
+ ll_inode2id(&id, inode);
+ rc = md_getattr_name(sbi->ll_lmv_exp, &id,
filename, namelen, valid, 0, &request);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr_name: %d\n", rc);
struct lov_user_md lum, *lump = (struct lov_user_md *)arg;
int rc = 0;
- ll_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
+ ll_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
LASSERT(sizeof(lum) == sizeof(*lump));
LASSERT(sizeof(lum.lmm_objects[0]) ==
if (lum.lmm_magic != LOV_USER_MAGIC)
RETURN(-EINVAL);
- rc = md_setattr(sbi->ll_mdc_exp, &op_data,
+ rc = md_setattr(sbi->ll_lmv_exp, &op_data,
&attr, &lum, sizeof(lum), NULL, 0, &request);
if (rc) {
ptlrpc_req_finished(request);
struct ptlrpc_request *request = NULL;
struct lov_user_md *lump = (struct lov_user_md *)arg;
struct lov_mds_md *lmm;
- struct ll_fid fid;
+ struct lustre_id id;
struct mds_body *body;
unsigned long valid = 0;
int rc, lmmsize;
valid |= OBD_MD_FLDIREA;
- ll_inode2fid(&fid, inode);
- rc = md_getattr(sbi->ll_mdc_exp, &fid, valid,
- obd_size_diskmd(sbi->ll_osc_exp, NULL),
+ ll_inode2id(&id, inode);
+ rc = md_getattr(sbi->ll_lmv_exp, &id, valid,
+ obd_size_diskmd(sbi->ll_lov_exp, NULL),
&request);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr failed: rc = %d\n", rc);
ptlrpc_req_finished(request);
RETURN(rc);
}
+ case IOC_MDC_SHOWFID: {
+ struct lustre_id *idp = (struct lustre_id *)arg;
+ struct lustre_id id;
+ char *filename;
+ int rc;
+
+ filename = getname((const char *)arg);
+ if (IS_ERR(filename))
+ RETURN(PTR_ERR(filename));
+
+ ll_inode2id(&id, inode);
+
+ rc = ll_get_fid(sbi->ll_lmv_exp, &id, filename, &id);
+ if (rc < 0)
+ GOTO(out_filename, rc);
+
+ rc = copy_to_user(idp, &id, sizeof(*idp));
+ if (rc)
+ GOTO(out_filename, rc = -EFAULT);
+
+ EXIT;
+ out_filename:
+ putname(filename);
+ return rc;
+ }
case IOC_MDC_GETSTRIPE: {
- struct ptlrpc_request *request = NULL;
- struct ll_fid fid;
- struct mds_body *body;
struct lov_user_md *lump = (struct lov_user_md *)arg;
+ struct ptlrpc_request *request = NULL;
struct lov_mds_md *lmm;
+ struct mds_body *body;
+ struct lustre_id id;
char *filename;
int rc, lmmsize;
if (IS_ERR(filename))
RETURN(PTR_ERR(filename));
- ll_inode2fid(&fid, inode);
- rc = md_getattr_name(sbi->ll_mdc_exp, &fid, filename,
+ ll_inode2id(&id, inode);
+ rc = md_getattr_name(sbi->ll_lmv_exp, &id, filename,
strlen(filename) + 1, OBD_MD_FLEASIZE,
- obd_size_diskmd(sbi->ll_osc_exp, NULL),
+ obd_size_diskmd(sbi->ll_lov_exp, NULL),
&request);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr_name failed on %s: rc %d\n",
bufs[1] = NULL;
}
size = data->ioc_plen1;
- req = ptlrpc_prep_req(sbi2mdc(sbi)->cl_import,
+ req = ptlrpc_prep_req(sbi2lmv(sbi)->cl_import,
LUSTRE_LOG_VERSION, LLOG_CATINFO,
2, lens, bufs);
if (!req)
RETURN(rc);
}
default:
- return obd_iocontrol(cmd, sbi->ll_osc_exp,0,NULL,(void *)arg);
+ return obd_iocontrol(cmd, sbi->ll_lov_exp, 0,
+ NULL, (void *)arg);
}
}
#include "llite_internal.h"
#include <linux/obd_lov.h>
-int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode,
+int ll_mdc_close(struct obd_export *lmv_exp, struct inode *inode,
struct file *file)
{
struct ll_file_data *fd = file->private_data;
obdo.o_id = inode->i_ino;
obdo.o_valid = OBD_MD_FLID;
- obdo_from_inode(&obdo, inode, OBD_MD_FLTYPE | OBD_MD_FLMODE |
- OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
- OBD_MD_FLATIME | OBD_MD_FLMTIME |
- OBD_MD_FLCTIME);
+ obdo_from_inode(&obdo, inode, (OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME |
+ OBD_MD_FLCTIME));
if (0 /* ll_is_inode_dirty(inode) */) {
obdo.o_flags = MDS_BFLAG_UNCOMMITTED_WRITES;
obdo.o_valid |= OBD_MD_FLFLAGS;
}
- obdo.o_mds = ll_i2info(inode)->lli_mds;
- rc = md_close(mdc_exp, &obdo, och, &req);
+ obdo.o_mds = id_group(&ll_i2info(inode)->lli_id);
+ rc = md_close(lmv_exp, &obdo, och, &req);
if (rc == EAGAIN) {
/* We are the last writer, so the MDS has instructed us to get
inode->i_ino, rc);
}
- mdc_clear_open_replay_data(mdc_exp, och);
+ mdc_clear_open_replay_data(lmv_exp, och);
ptlrpc_req_finished(req);
och->och_fh.cookie = DEAD_HANDLE_MAGIC;
file->private_data = NULL;
int rc;
ENTRY;
- CDEBUG(D_VFSTRACE, "VFS Op:inode=%u/%lu/%u(%p)\n",
- ll_i2info(inode)->lli_mds, inode->i_ino,
- inode->i_generation, inode);
+ CDEBUG(D_VFSTRACE, "VFS Op:inode="DLID4"(%p)\n",
+ OLID4(&ll_i2info(inode)->lli_id), inode);
/* don't do anything for / */
if (inode->i_sb->s_root == file->f_dentry)
fd = (struct ll_file_data *)file->private_data;
LASSERT(fd != NULL);
- rc = ll_mdc_close(sbi->ll_mdc_exp, inode, file);
+ rc = ll_mdc_close(sbi->ll_lmv_exp, inode, file);
RETURN(rc);
}
int lmmsize, struct lookup_intent *itp)
{
struct ll_sb_info *sbi = ll_i2sbi(file->f_dentry->d_inode);
- struct lustre_handle lockh;
- struct mdc_op_data data;
struct dentry *parent = file->f_dentry->d_parent;
const char *name = file->f_dentry->d_name.name;
const int len = file->f_dentry->d_name.len;
+ struct lustre_handle lockh;
+ struct mdc_op_data data;
int rc;
if (!parent)
RETURN(-ENOENT);
- ll_prepare_mdc_op_data(&data, parent->d_inode, NULL, name, len, O_RDWR);
+ ll_prepare_mdc_data(&data, parent->d_inode, NULL, name, len, O_RDWR);
- rc = md_enqueue(sbi->ll_mdc_exp, LDLM_IBITS, itp, LCK_PR, &data,
+ rc = md_enqueue(sbi->ll_lmv_exp, LDLM_IBITS, itp, LCK_PR, &data,
&lockh, lmm, lmmsize, ldlm_completion_ast,
ll_mdc_blocking_ast, NULL);
if (rc == 0) {
{
struct ptlrpc_request *req = it->d.lustre.it_data;
struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode);
- struct obd_export *mdc_exp = ll_i2mdcexp(file->f_dentry->d_inode);
+ struct obd_export *lmv_exp = ll_i2lmvexp(file->f_dentry->d_inode);
struct ll_file_data *fd;
struct mds_body *body;
ENTRY;
OBD_SLAB_ALLOC(fd, ll_file_data_slab, SLAB_KERNEL, sizeof *fd);
+
/* We can't handle this well without reorganizing ll_file_open and
* ll_mdc_close, so don't even try right now. */
LASSERT(fd != NULL);
lli->lli_io_epoch = body->io_epoch;
- mdc_set_open_replay_data(mdc_exp, &fd->fd_mds_och, it->d.lustre.it_data);
+ mdc_set_open_replay_data(lmv_exp, &fd->fd_mds_och, it->d.lustre.it_data);
RETURN(0);
}
CDEBUG(D_DLMTRACE, "Glimpsing inode %lu\n", inode->i_ino);
- rc = obd_enqueue(sbi->ll_osc_exp, lli->lli_smd, LDLM_EXTENT, &policy,
+ rc = obd_enqueue(sbi->ll_lov_exp, lli->lli_smd, LDLM_EXTENT, &policy,
LCK_PR, &flags, ll_extent_lock_callback,
ldlm_completion_ast, ll_glimpse_callback, inode,
sizeof(struct ost_lvb), lustre_swab_ost_lvb, &lockh);
inode->i_blocks = lov_merge_blocks(lli->lli_smd);
//inode->i_mtime = lov_merge_mtime(lli->lli_smd, inode->i_mtime);
- CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n",
- inode->i_size, inode->i_blocks);
- obd_cancel(sbi->ll_osc_exp, lli->lli_smd, LCK_PR, &lockh);
-
+ CDEBUG(D_DLMTRACE, "glimpse: size: "LPU64", blocks: "LPU64"\n",
+ (__u64)inode->i_size, (__u64)inode->i_blocks);
+ obd_cancel(sbi->ll_lov_exp, lli->lli_smd, LCK_PR, &lockh);
RETURN(rc);
}
inode->i_ino, policy->l_extent.start, policy->l_extent.end);
do_gettimeofday(&start);
-
- rc = obd_enqueue(sbi->ll_osc_exp, lsm, LDLM_EXTENT, policy, mode,
+ rc = obd_enqueue(sbi->ll_lov_exp, lsm, LDLM_EXTENT, policy, mode,
&ast_flags, ll_extent_lock_callback,
ldlm_completion_ast, ll_glimpse_callback, inode,
sizeof(struct ost_lvb), lustre_swab_ost_lvb, lockh);
(sbi->ll_flags & LL_SBI_NOLCK))
RETURN(0);
- rc = obd_cancel(sbi->ll_osc_exp, lsm, mode, lockh);
+ rc = obd_cancel(sbi->ll_lov_exp, lsm, mode, lockh);
RETURN(rc);
}
rc = ll_tree_lock(&tree, node, inode, buf, count,
file->f_flags & O_NONBLOCK ? LDLM_FL_BLOCK_NOWAIT :0);
-
if (rc != 0)
RETURN(rc);
RETURN(retval);
}
-static ssize_t ll_file_write(struct file *file, const char *buf, size_t count,
- loff_t *ppos)
+/*
+ * Write to a file (through the page cache).
+ */
+static ssize_t ll_file_write(struct file *file, const char *buf,
+ size_t count, loff_t *ppos)
{
struct inode *inode = file->f_dentry->d_inode;
loff_t maxbytes = ll_file_maxbytes(inode);
oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLFLAGS;
oa->o_flags |= OBD_FL_RECREATE_OBJS;
obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
- OBD_MD_FLMTIME | OBD_MD_FLCTIME);
+ OBD_MD_FLMTIME | OBD_MD_FLCTIME);
oti.oti_objid = NULL;
memcpy(lsm2, lsm, lsm_size);
if (rc < 0)
GOTO(out, rc);
- rc = mdc_req2lustre_md(ll_i2mdcexp(inode), req, 1, exp, &md);
+ rc = mdc_req2lustre_md(ll_i2lmvexp(inode), req, 1, exp, &md);
if (rc)
GOTO(out, rc);
ll_update_inode(f->f_dentry->d_inode, &md);
unsigned long arg)
{
struct ll_file_data *fd = file->private_data;
+ struct ll_sb_info *sbi = ll_i2sbi(inode);
int flags;
ENTRY;
RETURN(ll_lov_setstripe(inode, file, arg));
case LL_IOC_LOV_SETEA:
RETURN(ll_lov_setea(inode, file, arg));
+ case IOC_MDC_SHOWFID: {
+ struct lustre_id *idp = (struct lustre_id *)arg;
+ struct lustre_id id;
+ char *filename;
+ int rc;
+
+ filename = getname((const char *)arg);
+ if (IS_ERR(filename))
+ RETURN(PTR_ERR(filename));
+
+ ll_inode2id(&id, inode);
+
+ rc = ll_get_fid(sbi->ll_lmv_exp, &id, filename, &id);
+ if (rc < 0)
+ GOTO(out_filename, rc);
+
+ rc = copy_to_user(idp, &id, sizeof(*idp));
+ if (rc)
+ GOTO(out_filename, rc = -EFAULT);
+
+ EXIT;
+ out_filename:
+ putname(filename);
+ return rc;
+ }
case LL_IOC_LOV_GETSTRIPE:
RETURN(ll_lov_getstripe(inode, arg));
case LL_IOC_RECREATE_OBJ:
{
struct inode *inode = dentry->d_inode;
struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
- struct ll_fid fid;
+ struct lustre_id id;
struct ptlrpc_request *req;
int rc, err;
ENTRY;
* that IO to finish before calling the osc and mdc sync methods */
rc = filemap_fdatawait(inode->i_mapping);
- ll_inode2fid(&fid, inode);
- err = md_sync(ll_i2sbi(inode)->ll_mdc_exp, &fid, &req);
+ ll_inode2id(&id, inode);
+ err = md_sync(ll_i2sbi(inode)->ll_lmv_exp, &id, &req);
if (!rc)
rc = err;
if (!err)
oa->o_id = lsm->lsm_object_id;
oa->o_gr = lsm->lsm_object_gr;
oa->o_valid = OBD_MD_FLID;
- obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
- OBD_MD_FLMTIME | OBD_MD_FLCTIME |
- OBD_MD_FLGROUP);
+ obdo_from_inode(oa, inode, (OBD_MD_FLTYPE | OBD_MD_FLATIME |
+ OBD_MD_FLMTIME | OBD_MD_FLCTIME |
+ OBD_MD_FLGROUP));
- err = obd_sync(ll_i2sbi(inode)->ll_osc_exp, oa, lsm,
+ err = obd_sync(ll_i2sbi(inode)->ll_lov_exp, oa, lsm,
0, OBD_OBJECT_EOF);
if (!rc)
rc = err;
int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
{
struct inode *inode = file->f_dentry->d_inode;
+ struct ll_inode_info *li = ll_i2info(inode);
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct obd_device *obddev;
struct ldlm_res_id res_id =
- { .name = {inode->i_ino, inode->i_generation, LDLM_FLOCK} };
+ { .name = {id_fid(&li->lli_id), id_group(&li->lli_id), LDLM_FLOCK} };
struct lustre_handle lockh = {0};
ldlm_policy_data_t flock;
ldlm_mode_t mode = 0;
"start="LPU64", end="LPU64"\n", inode->i_ino, flock.l_flock.pid,
flags, mode, flock.l_flock.start, flock.l_flock.end);
- obddev = md_get_real_obd(sbi->ll_mdc_exp, NULL, 0);
+ obddev = md_get_real_obd(sbi->ll_lmv_exp, NULL, 0);
rc = ldlm_cli_enqueue(obddev->obd_self_export, NULL,
obddev->obd_namespace,
res_id, LDLM_FLOCK, &flock, mode, &flags,
int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
{
+ struct lookup_intent oit = { .it_op = IT_GETATTR };
struct inode *inode = dentry->d_inode;
+ struct ptlrpc_request *req = NULL;
struct ll_inode_info *lli;
struct lov_stripe_md *lsm;
- struct ptlrpc_request *req = NULL;
- struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
- struct lookup_intent oit = { .it_op = IT_GETATTR };
- struct ll_fid cfid;
+ struct ll_sb_info *sbi;
+ struct lustre_id id;
int rc;
ENTRY;
CERROR("REPORT THIS LINE TO PETER\n");
RETURN(0);
}
+
+ sbi = ll_i2sbi(inode);
+
+ ll_inode2id(&id, inode);
lli = ll_i2info(inode);
- CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s,intent=%s\n",
+ LASSERT(id_fid(&id) != 0);
+
+ CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), name=%s, intent=%s\n",
inode->i_ino, inode->i_generation, inode, dentry->d_name.name,
LL_IT2STR(it));
+
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0))
lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_REVALIDATE);
#endif
- ll_inode2fid(&cfid, dentry->d_inode);
- rc = md_intent_lock(sbi->ll_mdc_exp, &cfid,
- NULL, 0, NULL, 0, &cfid, &oit, 0, &req,
- ll_mdc_blocking_ast);
+ rc = md_intent_lock(sbi->ll_lmv_exp, &id, NULL, 0, NULL, 0, &id,
+ &oit, 0, &req, ll_mdc_blocking_ast);
if (rc < 0)
GOTO(out, rc);
if (lsm == NULL) /* object not yet allocated, don't validate size */
GOTO(out, rc = 0);
- /* ll_glimpse_size will prefer locally cached writes if they extend
- * the file */
+ /*
+ * ll_glimpse_size() will prefer locally cached writes if they extend
+ * the file.
+ */
rc = ll_glimpse_size(inode);
out:
if (req)
if (res)
return res;
- stat->dev = ll_i2info(inode)->lli_mds;
stat->ino = inode->i_ino;
stat->mode = inode->i_mode;
stat->nlink = inode->i_nlink;
stat->uid = inode->i_uid;
stat->gid = inode->i_gid;
- stat->rdev = kdev_t_to_nr(inode->i_rdev);
stat->atime = inode->i_atime;
stat->mtime = inode->i_mtime;
stat->ctime = inode->i_ctime;
stat->size = inode->i_size;
stat->blksize = inode->i_blksize;
stat->blocks = inode->i_blocks;
+ stat->rdev = kdev_t_to_nr(inode->i_rdev);
+ stat->dev = id_group(&ll_i2info(inode)->lli_id);
return 0;
}
#endif
};
struct ll_sb_info {
- /* this protects pglist and ra_info. It isn't safe to
- * grab from interrupt contexts */
+ /* this protects pglist and max_r_a_pages. It isn't safe to grab from
+ * interrupt contexts. */
spinlock_t ll_lock;
+
struct obd_uuid ll_sb_uuid;
- struct obd_export *ll_mdc_exp;
- struct obd_export *ll_osc_exp;
- struct proc_dir_entry* ll_proc_root;
- obd_id ll_rootino; /* number of root inode */
+ struct obd_export *ll_lmv_exp;
+ struct lmv_desc ll_lmv_desc;
+ struct obd_export *ll_lov_exp;
+ struct lov_desc ll_lov_desc;
+ struct proc_dir_entry *ll_proc_root;
+ struct lustre_id ll_rootid; /* root lustre id */
struct lustre_mount_data *ll_lmd;
char *ll_instance;
struct hlist_head ll_orphan_dentry_list; /*please don't ask -p*/
struct ll_close_queue *ll_lcq;
- struct lprocfs_stats *ll_stats; /* lprocfs stats counter */
+ struct lprocfs_stats *ll_stats; /* lprocfs stats counter */
unsigned long ll_pglist_gen;
struct list_head ll_pglist;
/* llite/lproc_llite.c */
int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
- struct super_block *sb, char *osc, char *mdc);
+ struct super_block *sb, char *lov,
+ char *lmv);
void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
/* llite/dir.c */
int ll_lsm_getattr(struct obd_export *, struct lov_stripe_md *, struct obdo *);
int ll_glimpse_size(struct inode *inode);
int ll_local_open(struct file *file, struct lookup_intent *it);
-int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode,
+int ll_mdc_close(struct obd_export *lmv_exp, struct inode *inode,
struct file *file);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
int ll_getattr(struct vfsmount *mnt, struct dentry *de,
const char *buf, size_t count, int ast_flags);
int ll_tree_unlock(struct ll_lock_tree *tree, struct inode *inode);
-
-
-
+int ll_get_fid(struct obd_export *exp, struct lustre_id *idp,
+ char *filename, struct lustre_id *ret);
/* generic */
#define LL_SBI_NOLCK 0x1
/* don't need an addref as the sb_info should be holding one */
static inline struct obd_export *ll_s2obdexp(struct super_block *sb)
{
- return ll_s2sbi(sb)->ll_osc_exp;
+ return ll_s2sbi(sb)->ll_lov_exp;
}
/* don't need an addref as the sb_info should be holding one */
-static inline struct obd_export *ll_s2mdcexp(struct super_block *sb)
+static inline struct obd_export *ll_s2lmvexp(struct super_block *sb)
{
- return ll_s2sbi(sb)->ll_mdc_exp;
+ return ll_s2sbi(sb)->ll_lmv_exp;
}
-static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi)
+static inline struct client_obd *sbi2lmv(struct ll_sb_info *sbi)
{
- struct obd_device *obd = sbi->ll_mdc_exp->exp_obd;
+ struct obd_device *obd = sbi->ll_lmv_exp->exp_obd;
if (obd == NULL)
LBUG();
return &obd->u.cli;
return ll_s2obdexp(inode->i_sb);
}
-static inline struct obd_export *ll_i2mdcexp(struct inode *inode)
+static inline struct obd_export *ll_i2lmvexp(struct inode *inode)
{
- return ll_s2mdcexp(inode->i_sb);
+ return ll_s2lmvexp(inode->i_sb);
}
static inline int ll_mds_max_easize(struct super_block *sb)
{
- return sbi2mdc(ll_s2sbi(sb))->cl_max_mds_easize;
+ return sbi2lmv(ll_s2sbi(sb))->cl_max_mds_easize;
}
static inline __u64 ll_file_maxbytes(struct inode *inode)
EXIT;
}
-int lustre_init_ea_size(struct ll_sb_info *sbi)
+int lustre_init_lov_desc(struct ll_sb_info *sbi)
{
- struct lov_desc desc;
- int rc, valsize;
+ int valsize, rc;
+ ENTRY;
- /* OSC may have larger ea size */
- valsize = sizeof(desc);
- rc = obd_get_info(sbi->ll_osc_exp, strlen("lovdesc") + 1, "lovdesc",
- &valsize, &desc);
- if (rc)
- RETURN(rc);
- obd_init_ea_size(sbi->ll_mdc_exp, obd_size_diskmd(sbi->ll_osc_exp, NULL),
- desc.ld_tgt_count*sizeof(struct llog_cookie));
+ valsize = sizeof(sbi->ll_lov_desc);
+ memset(&sbi->ll_lov_desc, 0, sizeof(sbi->ll_lov_desc));
+ rc = obd_get_info(sbi->ll_lov_exp, strlen("lovdesc") + 1,
+ "lovdesc", &valsize, &sbi->ll_lov_desc);
+ RETURN(rc);
+}
+int lustre_init_lmv_desc(struct ll_sb_info *sbi)
+{
+ int valsize, rc;
+ ENTRY;
+
+ valsize = sizeof(sbi->ll_lmv_desc);
+ memset(&sbi->ll_lmv_desc, 0, sizeof(sbi->ll_lmv_desc));
+ rc = obd_get_info(sbi->ll_lmv_exp, strlen("lmvdesc") + 1,
+ "lmvdesc", &valsize, &sbi->ll_lmv_desc);
RETURN(rc);
}
-int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc)
+int lustre_common_fill_super(struct super_block *sb, char *lmv, char *lov)
{
- struct inode *root = 0;
struct ll_sb_info *sbi = ll_s2sbi(sb);
+ struct ptlrpc_request *request = NULL;
+ struct lustre_handle lov_conn = {0, };
+ struct lustre_handle lmv_conn = {0, };
+ struct inode *root = NULL;
struct obd_device *obd;
- struct ll_fid rootfid;
struct obd_statfs osfs;
- struct ptlrpc_request *request = NULL;
- struct lustre_handle osc_conn = {0, };
- struct lustre_handle mdc_conn = {0, };
struct lustre_md md;
kdev_t devno;
int err;
- obd = class_name2obd(mdc);
+ obd = class_name2obd(lmv);
if (!obd) {
- CERROR("MDC %s: not setup or attached\n", mdc);
+ CERROR("MDC %s: not setup or attached\n", lmv);
RETURN(-EINVAL);
}
if (proc_lustre_fs_root) {
err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
- osc, mdc);
+ lov, lmv);
if (err < 0)
CERROR("could not register mount in /proc/lustre");
}
- err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, 0);
+ err = obd_connect(&lmv_conn, obd, &sbi->ll_sb_uuid, OBD_OPT_REAL_CLIENT);
if (err == -EBUSY) {
CERROR("An MDS (mdc %s) is performing recovery, of which this"
" client is not a part. Please wait for recovery to "
- "complete, abort, or time out.\n", mdc);
+ "complete, abort, or time out.\n", lmv);
GOTO(out, err);
} else if (err) {
- CERROR("cannot connect to %s: rc = %d\n", mdc, err);
+ CERROR("cannot connect to %s: rc = %d\n", lmv, err);
GOTO(out, err);
}
- sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
+ sbi->ll_lmv_exp = class_conn2export(&lmv_conn);
+ lustre_init_lmv_desc(sbi);
+
err = obd_statfs(obd, &osfs, jiffies - HZ);
if (err)
- GOTO(out_mdc, err);
+ GOTO(out_lmv, err);
+
+ if (!osfs.os_bsize) {
+ CERROR("Invalid block size is detected.");
+ GOTO(out_lmv, err);
+ }
- LASSERT(osfs.os_bsize);
+ sb->s_magic = LL_SUPER_MAGIC;
sb->s_blocksize = osfs.os_bsize;
sb->s_blocksize_bits = log2(osfs.os_bsize);
- sb->s_magic = LL_SUPER_MAGIC;
sb->s_maxbytes = PAGE_CACHE_MAXBYTES;
- devno = get_uuid2int(sbi->ll_mdc_exp->exp_obd->obd_uuid.uuid,
- strlen(sbi->ll_mdc_exp->exp_obd->obd_uuid.uuid));
+ devno = get_uuid2int(sbi->ll_lmv_exp->exp_obd->obd_uuid.uuid,
+ strlen(sbi->ll_lmv_exp->exp_obd->obd_uuid.uuid));
sb->s_dev = devno;
- obd = class_name2obd(osc);
+ obd = class_name2obd(lov);
if (!obd) {
- CERROR("OSC %s: not setup or attached\n", osc);
- GOTO(out_mdc, err);
+ CERROR("OSC %s: not setup or attached\n", lov);
+ GOTO(out_lmv, err);
}
- err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, 0);
+ err = obd_connect(&lov_conn, obd, &sbi->ll_sb_uuid, OBD_OPT_REAL_CLIENT);
if (err == -EBUSY) {
CERROR("An OST (osc %s) is performing recovery, of which this"
" client is not a part. Please wait for recovery to "
- "complete, abort, or time out.\n", osc);
+ "complete, abort, or time out.\n", lov);
GOTO(out, err);
} else if (err) {
- CERROR("cannot connect to %s: rc = %d\n", osc, err);
- GOTO(out_mdc, err);
+ CERROR("cannot connect to %s: rc = %d\n", lov, err);
+ GOTO(out_lmv, err);
}
- sbi->ll_osc_exp = class_conn2export(&osc_conn);
-
- lustre_init_ea_size(sbi);
- err = md_getstatus(sbi->ll_mdc_exp, &rootfid);
+ sbi->ll_lov_exp = class_conn2export(&lov_conn);
+
+ err = lustre_init_lov_desc(sbi);
+ if (err == 0) {
+ int mdsize = obd_size_diskmd(sbi->ll_lov_exp, NULL);
+ obd_init_ea_size(sbi->ll_lmv_exp, mdsize,
+ sbi->ll_lov_desc.ld_tgt_count *
+ sizeof(struct llog_cookie));
+ }
+
+ err = md_getstatus(sbi->ll_lmv_exp, &sbi->ll_rootid);
if (err) {
CERROR("cannot mds_connect: rc = %d\n", err);
- GOTO(out_osc, err);
+ GOTO(out_lov, err);
}
- CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
- sbi->ll_rootino = rootfid.id;
+ CDEBUG(D_SUPER, "rootid "DLID4"\n", OLID4(&sbi->ll_rootid));
sb->s_op = &lustre_super_operations;
/* make root inode
* XXX: move this to after cbd setup? */
- err = md_getattr(sbi->ll_mdc_exp, &rootfid,
- OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS, 0, &request);
+ err = md_getattr(sbi->ll_lmv_exp, &sbi->ll_rootid,
+ OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS | OBD_MD_FID,
+ 0, &request);
if (err) {
CERROR("md_getattr failed for root: rc = %d\n", err);
- GOTO(out_osc, err);
+ GOTO(out_lov, err);
}
- err = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0,
- sbi->ll_osc_exp, &md);
+ err = mdc_req2lustre_md(sbi->ll_lmv_exp, request, 0,
+ sbi->ll_lov_exp, &md);
if (err) {
- CERROR("failed to understand root inode md: rc = %d\n",err);
- ptlrpc_req_finished (request);
- GOTO(out_osc, err);
+ CERROR("failed to understand root inode md: rc = %d\n", err);
+ ptlrpc_req_finished(request);
+ GOTO(out_lov, err);
}
- LASSERT(sbi->ll_rootino != 0);
- root = ll_iget(sb, sbi->ll_rootino, &md);
+ LASSERT(id_ino(&sbi->ll_rootid) != 0);
+ root = ll_iget(sb, id_ino(&sbi->ll_rootid), &md);
ptlrpc_req_finished(request);
if (root == NULL || is_bad_inode(root)) {
- /* XXX might need iput() for bad inode */
CERROR("lustre_lite: bad iget4 for root\n");
GOTO(out_root, err = -EBADF);
}
ll_gns_add_timer(sbi);
- /* making vm readahead 0 for 2.4.x. In the case of 2.6.x,
- backing dev info assigned to inode mapping is used for
- determining maximal readahead. */
+ /* making vm readahead 0 for 2.4.x. In the case of 2.6.x, backing dev
+ info assigned to inode mapping is used for determining maximal
+ readahead. */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
/* bug 2805 - set VM readahead to zero */
vm_max_readahead = vm_min_readahead = 0;
out_root:
if (root)
iput(root);
-out_osc:
- obd_disconnect(sbi->ll_osc_exp, 0);
-out_mdc:
- obd_disconnect(sbi->ll_mdc_exp, 0);
+out_lov:
+ obd_disconnect(sbi->ll_lov_exp, 0);
+out_lmv:
+ obd_disconnect(sbi->ll_lmv_exp, 0);
out:
lprocfs_unregister_mountpoint(sbi);
RETURN(err);
ENTRY;
ll_gns_del_timer(sbi);
-
ll_close_thread_shutdown(sbi->ll_lcq);
list_del(&sbi->ll_conn_chain);
- obd_disconnect(sbi->ll_osc_exp, 0);
+ obd_disconnect(sbi->ll_lov_exp, 0);
lprocfs_unregister_mountpoint(sbi);
if (sbi->ll_proc_root) {
sbi->ll_proc_root = NULL;
}
- obd_disconnect(sbi->ll_mdc_exp, 0);
+ obd_disconnect(sbi->ll_lmv_exp, 0);
// We do this to get rid of orphaned dentries. That is not really trw.
spin_lock(&dcache_lock);
EXIT;
}
-
char *ll_read_opt(const char *opt, char *data)
{
char *value;
RETURN(fl);
}
-void ll_options(char *options, char **ost, char **mdc, int *flags)
+void ll_options(char *options, char **lov, char **lmv, int *flags)
{
char *this_char;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
while ((this_char = strsep (&opt_ptr, ",")) != NULL) {
#endif
CDEBUG(D_SUPER, "this_char %s\n", this_char);
- if (!*ost && (*ost = ll_read_opt("osc", this_char)))
+ if (!*lov && (*lov = ll_read_opt("osc", this_char)))
continue;
- if (!*mdc && (*mdc = ll_read_opt("mdc", this_char)))
+ if (!*lmv && (*lmv = ll_read_opt("mdc", this_char)))
continue;
if (!(*flags & LL_SBI_NOLCK) &&
((*flags) = (*flags) |
spin_lock_init(&lli->lli_lock);
INIT_LIST_HEAD(&lli->lli_pending_write_llaps);
lli->lli_inode_magic = LLI_INODE_MAGIC;
+ memset(&lli->lli_id, 0, sizeof(lli->lli_id));
}
int ll_fill_super(struct super_block *sb, void *data, int silent)
{
struct ll_sb_info *sbi;
- char *osc = NULL;
- char *mdc = NULL;
+ char *lov = NULL;
+ char *lmv = NULL;
int err;
ENTRY;
RETURN(-ENOMEM);
sbi->ll_flags |= LL_SBI_READAHEAD;
- ll_options(data, &osc, &mdc, &sbi->ll_flags);
+ ll_options(data, &lov, &lmv, &sbi->ll_flags);
- if (!osc) {
+ if (!lov) {
CERROR("no osc\n");
GOTO(out, err = -EINVAL);
}
- if (!mdc) {
+ if (!lmv) {
CERROR("no mdc\n");
GOTO(out, err = -EINVAL);
}
- err = lustre_common_fill_super(sb, mdc, osc);
+ err = lustre_common_fill_super(sb, lmv, lov);
out:
if (err)
lustre_free_sbi(sb);
- if (mdc)
- OBD_FREE(mdc, strlen(mdc) + 1);
- if (osc)
- OBD_FREE(osc, strlen(osc) + 1);
-
+ if (lmv)
+ OBD_FREE(lmv, strlen(lmv) + 1);
+ if (lov)
+ OBD_FREE(lov, strlen(lov) + 1);
RETURN(err);
} /* ll_read_super */
{
struct lustre_cfg lcfg;
struct portals_cfg pcfg;
- char * peer = "MDS_PEER_UUID";
+ char *peer = "MDS_PEER_UUID";
struct obd_device *obd;
- struct lustre_handle mdc_conn = {0, };
+ struct lustre_handle lmv_conn = {0, };
struct obd_export *exp;
- char * name = "mdc_dev";
+ char *name = "mdc_dev";
class_uuid_t uuid;
- struct obd_uuid mdc_uuid;
+ struct obd_uuid lmv_uuid;
struct llog_ctxt *ctxt;
int rc = 0;
int err;
RETURN(-EINVAL);
generate_random_uuid(uuid);
- class_uuid_unparse(uuid, &mdc_uuid);
+ class_uuid_unparse(uuid, &lmv_uuid);
if (lmd->lmd_local_nid) {
PCFG_INIT(pcfg, NAL_CMD_REGISTER_MYNID);
LCFG_INIT(lcfg, LCFG_ATTACH, name);
lcfg.lcfg_inlbuf1 = "mdc";
lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1;
- lcfg.lcfg_inlbuf2 = mdc_uuid.uuid;
+ lcfg.lcfg_inlbuf2 = lmv_uuid.uuid;
lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1;
err = class_process_config(&lcfg);
if (err < 0)
if (err)
GOTO(out_cleanup, err);
- err = obd_connect(&mdc_conn, obd, &mdc_uuid, 0);
+ err = obd_connect(&lmv_conn, obd, &lmv_uuid, 0);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", lmd->lmd_mds, err);
GOTO(out_cleanup, err);
}
- exp = class_conn2export(&mdc_conn);
+ exp = class_conn2export(&lmv_conn);
ctxt = llog_get_context(&exp->exp_obd->obd_llogs,LLOG_CONFIG_REPL_CTXT);
rc = class_config_process_llog(ctxt, profile, cfg);
int lustre_fill_super(struct super_block *sb, void *data, int silent)
{
struct lustre_mount_data * lmd = data;
+ char *lov = NULL, *lmv = NULL;
struct ll_sb_info *sbi;
- char *osc = NULL;
- char *mdc = NULL;
int err;
ENTRY;
CERROR("No profile found: %s\n", lmd->lmd_profile);
GOTO(out_free, err = -EINVAL);
}
- if (osc)
- OBD_FREE(osc, strlen(osc) + 1);
- OBD_ALLOC(osc, strlen(lprof->lp_osc) +
+ if (lov)
+ OBD_FREE(lov, strlen(lov) + 1);
+ OBD_ALLOC(lov, strlen(lprof->lp_lov) +
strlen(sbi->ll_instance) + 2);
- sprintf(osc, "%s-%s", lprof->lp_osc, sbi->ll_instance);
+ sprintf(lov, "%s-%s", lprof->lp_lov, sbi->ll_instance);
- if (mdc)
- OBD_FREE(mdc, strlen(mdc) + 1);
- OBD_ALLOC(mdc, strlen(lprof->lp_mdc) +
+ if (lmv)
+ OBD_FREE(lmv, strlen(lmv) + 1);
+ OBD_ALLOC(lmv, strlen(lprof->lp_lmv) +
strlen(sbi->ll_instance) + 2);
- sprintf(mdc, "%s-%s", lprof->lp_mdc, sbi->ll_instance);
+ sprintf(lmv, "%s-%s", lprof->lp_lmv, sbi->ll_instance);
}
- if (!osc) {
+ if (!lov) {
CERROR("no osc\n");
GOTO(out_free, err = -EINVAL);
}
- if (!mdc) {
+ if (!lmv) {
CERROR("no mdc\n");
GOTO(out_free, err = -EINVAL);
}
- err = lustre_common_fill_super(sb, mdc, osc);
+ err = lustre_common_fill_super(sb, lmv, lov);
if (err)
GOTO(out_free, err);
out_dev:
- if (mdc)
- OBD_FREE(mdc, strlen(mdc) + 1);
- if (osc)
- OBD_FREE(osc, strlen(osc) + 1);
+ if (lmv)
+ OBD_FREE(lmv, strlen(lmv) + 1);
+ if (lov)
+ OBD_FREE(lov, strlen(lov) + 1);
RETURN(err);
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
- obd = class_exp2obd(sbi->ll_mdc_exp);
+ obd = class_exp2obd(sbi->ll_lmv_exp);
if (obd)
force_umount = obd->obd_no_recov;
obd = NULL;
int ll_process_config_update(struct ll_sb_info *sbi, int clean)
{
- struct obd_export *mdc_exp = sbi->ll_mdc_exp;
+ struct obd_export *lmv_exp = sbi->ll_lmv_exp;
struct lustre_mount_data *lmd = sbi->ll_lmd;
struct llog_ctxt *ctxt;
struct config_llog_instance cfg;
RETURN(0);
}
- rc = ldlm_cli_cancel_unused(mdc_exp->exp_obd->obd_namespace, NULL,
+ rc = ldlm_cli_cancel_unused(lmv_exp->exp_obd->obd_namespace, NULL,
LDLM_FL_CONFIG_CHANGE, NULL);
if (rc != 0)
CWARN("ldlm_cli_cancel_unused(mdc): %d\n", rc);
- rc = obd_cancel_unused(sbi->ll_osc_exp, NULL, LDLM_FL_CONFIG_CHANGE,
+ rc = obd_cancel_unused(sbi->ll_lov_exp, NULL, LDLM_FL_CONFIG_CHANGE,
NULL);
if (rc != 0)
CWARN("obd_cancel_unused(lov): %d\n", rc);
CWARN("Applying configuration log %s\n", name);
- ctxt = llog_get_context(&mdc_exp->exp_obd->obd_llogs,
+ ctxt = llog_get_context(&lmv_exp->exp_obd->obd_llogs,
LLOG_CONFIG_REPL_CTXT);
rc = class_config_process_llog(ctxt, name, &cfg);
if (rc == 0)
struct lov_desc desc;
int rc, valsize;
valsize = sizeof(desc);
- rc = obd_get_info(sbi->ll_osc_exp, strlen("lovdesc") + 1,
+ rc = obd_get_info(sbi->ll_lov_exp, strlen("lovdesc") + 1,
"lovdesc", &valsize, &desc);
- rc = obd_init_ea_size(mdc_exp,
- obd_size_diskmd(sbi->ll_osc_exp, NULL),
+ rc = obd_init_ea_size(lmv_exp,
+ obd_size_diskmd(sbi->ll_lov_exp, NULL),
(desc.ld_tgt_count *
sizeof(struct llog_cookie)));
}
void ll_clear_inode(struct inode *inode)
{
- struct ll_fid fid;
+ struct lustre_id id;
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_sb_info *sbi = ll_i2sbi(inode);
ENTRY;
inode->i_generation, inode);
lli->lli_inode_magic = LLI_INODE_DEAD;
- ll_inode2fid(&fid, inode);
+ ll_inode2id(&id, inode);
+
clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(ll_i2info(inode)->lli_flags));
- md_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode);
+ md_change_cbdata(sbi->ll_lmv_exp, &id, null_if_equal, inode);
if (lli->lli_smd)
- obd_change_cbdata(sbi->ll_osc_exp, lli->lli_smd,
+ obd_change_cbdata(sbi->ll_lov_exp, lli->lli_smd,
null_if_equal, inode);
if (lli->lli_smd) {
- obd_free_memmd(sbi->ll_osc_exp, &lli->lli_smd);
+ obd_free_memmd(sbi->ll_lov_exp, &lli->lli_smd);
lli->lli_smd = NULL;
}
if (lli->lli_mea) {
- /* FIXME: change cbdata for mea here */
- obd_free_memmd(sbi->ll_mdc_exp,
+ obd_free_memmd(sbi->ll_lmv_exp,
(struct lov_stripe_md **) &lli->lli_mea);
lli->lli_mea = NULL;
}
* inode ourselves so we can call obdo_from_inode() always. */
if (ia_valid & (lsm ? ~(ATTR_SIZE | ATTR_FROM_OPEN | ATTR_RAW) : ~0)) {
struct lustre_md md;
- ll_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
+ ll_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
- rc = md_setattr(sbi->ll_mdc_exp, &op_data,
+ rc = md_setattr(sbi->ll_lmv_exp, &op_data,
attr, NULL, 0, NULL, 0, &request);
if (rc) {
ptlrpc_req_finished(request);
RETURN(rc);
}
- rc = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0,
- sbi->ll_osc_exp, &md);
+ rc = mdc_req2lustre_md(sbi->ll_lmv_exp, request, 0,
+ sbi->ll_lov_exp, &md);
if (rc) {
ptlrpc_req_finished(request);
RETURN(rc);
oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
obdo_from_inode(&oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
OBD_MD_FLMTIME | OBD_MD_FLCTIME);
- rc = obd_setattr(sbi->ll_osc_exp, &oa, lsm, NULL);
+ rc = obd_setattr(sbi->ll_lov_exp, &oa, lsm, NULL);
if (rc)
CERROR("obd_setattr fails: rc=%d\n", rc);
}
int rc;
ENTRY;
- rc = obd_statfs(class_exp2obd(sbi->ll_mdc_exp), osfs, max_age);
+ rc = obd_statfs(class_exp2obd(sbi->ll_lmv_exp), osfs, max_age);
if (rc) {
CERROR("mdc_statfs fails: rc = %d\n", rc);
RETURN(rc);
CDEBUG(D_SUPER, "MDC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
- rc = obd_statfs(class_exp2obd(sbi->ll_osc_exp), &obd_osfs, max_age);
+ rc = obd_statfs(class_exp2obd(sbi->ll_lov_exp), &obd_osfs, max_age);
if (rc) {
CERROR("obd_statfs fails: rc = %d\n", rc);
RETURN(rc);
void ll_update_inode(struct inode *inode, struct lustre_md *md)
{
+ struct ll_sb_info *sbi = ll_s2sbi(inode->i_sb);
struct ll_inode_info *lli = ll_i2info(inode);
- struct mds_body *body = md->body;
struct lov_stripe_md *lsm = md->lsm;
+ struct mds_body *body = md->body;
struct mea *mea = md->mea;
ENTRY;
}
}
if (lli->lli_mea != mea)
- obd_free_memmd(ll_i2mdcexp(inode),
- (struct lov_stripe_md **) &mea);
-
+ obd_free_memmd(ll_i2lmvexp(inode),
+ (struct lov_stripe_md **) &mea);
}
+ /*
+ * updating inode lustre id. We try optimize things a little bit here,
+ * thus do not do it all the time.
+ */
+ if (body->valid & OBD_MD_FID) {
+ LASSERT(id_fid(&body->id1) != 0);
+ id_assign_fid(&lli->lli_id, &body->id1);
+ }
+
+ if ((body->valid & OBD_MD_FLID) || (body->valid & OBD_MD_FLGENER))
+ id_assign_stc(&lli->lli_id, &body->id1);
+
if (body->valid & OBD_MD_FLID)
- inode->i_ino = body->ino;
+ inode->i_ino = id_ino(&body->id1);
+ if (body->valid & OBD_MD_FLGENER)
+ inode->i_generation = id_gen(&body->id1);
if (body->valid & OBD_MD_FLATIME)
LTIME_S(inode->i_atime) = body->atime;
if (body->valid & OBD_MD_FLMTIME &&
if (body->valid & OBD_MD_FLCTIME &&
body->ctime > LTIME_S(inode->i_ctime))
LTIME_S(inode->i_ctime) = body->ctime;
- if (body->valid & OBD_MD_FLMODE)
- inode->i_mode = (inode->i_mode & S_IFMT)|(body->mode & ~S_IFMT);
- if (body->valid & OBD_MD_FLTYPE)
- inode->i_mode = (inode->i_mode & ~S_IFMT)|(body->mode & S_IFMT);
+ if (body->valid & OBD_MD_FLMODE) {
+ inode->i_mode = (inode->i_mode & S_IFMT) |
+ (body->mode & ~S_IFMT);
+ }
+ if (body->valid & OBD_MD_FLTYPE) {
+ inode->i_mode = (inode->i_mode & ~S_IFMT) |
+ (body->mode & S_IFMT);
+ }
if (body->valid & OBD_MD_FLUID)
inode->i_uid = body->uid;
if (body->valid & OBD_MD_FLGID)
inode->i_flags = body->flags;
if (body->valid & OBD_MD_FLNLINK)
inode->i_nlink = body->nlink;
- if (body->valid & OBD_MD_FLGENER)
- inode->i_generation = body->generation;
if (body->valid & OBD_MD_FLRDEV)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
inode->i_rdev = body->rdev;
if (body->valid & OBD_MD_FLSIZE)
set_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags);
-
- lli->lli_mds = body->mds;
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- inode->i_dev = (kdev_t) body->mds;
+ inode->i_dev = (kdev_t)id_group(&lli->lli_id);
#endif
- LASSERT(body->mds < 1000);
+ LASSERT(id_fid(&lli->lli_id) != 0);
+
+ LASSERT(!sbi->ll_lmv_desc.ld_tgt_count ||
+ id_group(&lli->lli_id) < sbi->ll_lmv_desc.ld_tgt_count);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
void ll_delete_inode(struct inode *inode)
{
int rc;
- struct ll_fid fid;
+ struct lustre_id id;
struct ll_sb_info *sbi = ll_i2sbi(inode);
ENTRY;
- ll_inode2fid(&fid, inode);
+ ll_inode2id(&id, inode);
- rc = md_delete_object(sbi->ll_mdc_exp, &fid);
+ rc = md_delete_object(sbi->ll_lmv_exp, &id);
if (rc) {
CERROR("md_delete_object() failed, error %d.\n",
rc);
switch(cmd) {
case EXT3_IOC_GETFLAGS: {
- struct ll_fid fid;
+ struct lustre_id id;
unsigned long valid = OBD_MD_FLFLAGS;
struct mds_body *body;
- ll_inode2fid(&fid, inode);
- rc = md_getattr(sbi->ll_mdc_exp, &fid, valid, 0, &req);
+ ll_inode2id(&id, inode);
+ rc = md_getattr(sbi->ll_lmv_exp, &id, valid, 0, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, inode->i_ino);
RETURN(-abs(rc));
if (!oa)
RETURN(-ENOMEM);
- ll_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
+ ll_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
memset(&attr, 0x0, sizeof(attr));
attr.ia_attr_flags = flags;
attr.ia_valid |= ATTR_ATTR_FLAG;
- rc = md_setattr(sbi->ll_mdc_exp, &op_data,
+ rc = md_setattr(sbi->ll_lmv_exp, &op_data,
&attr, NULL, 0, NULL, 0, &req);
if (rc) {
ptlrpc_req_finished(req);
oa->o_flags = flags;
oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
- rc = obd_setattr(sbi->ll_osc_exp, oa, lsm, NULL);
+ rc = obd_setattr(sbi->ll_lov_exp, oa, lsm, NULL);
obdo_free(oa);
if (rc) {
if (rc != -EPERM && rc != -EACCES)
RETURN(0);
}
+/* this is only called in the case of forced umount. */
void ll_umount_begin(struct super_block *sb)
{
struct ll_sb_info *sbi = ll_s2sbi(sb);
CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb,
sb->s_count, atomic_read(&sb->s_active));
- obd = class_exp2obd(sbi->ll_mdc_exp);
+ obd = class_exp2obd(sbi->ll_lmv_exp);
if (obd == NULL) {
CERROR("Invalid MDC connection handle "LPX64"\n",
- sbi->ll_mdc_exp->exp_handle.h_cookie);
+ sbi->ll_lmv_exp->exp_handle.h_cookie);
EXIT;
return;
}
obd->obd_no_recov = 1;
- obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_mdc_exp, sizeof ioc_data,
- &ioc_data, NULL);
+ obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_lmv_exp,
+ sizeof(ioc_data), &ioc_data, NULL);
- obd = class_exp2obd(sbi->ll_osc_exp);
+ obd = class_exp2obd(sbi->ll_lov_exp);
if (obd == NULL) {
CERROR("Invalid LOV connection handle "LPX64"\n",
- sbi->ll_osc_exp->exp_handle.h_cookie);
+ sbi->ll_lov_exp->exp_handle.h_cookie);
EXIT;
return;
}
obd->obd_no_recov = 1;
- obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_osc_exp, sizeof ioc_data,
- &ioc_data, NULL);
+ obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_lov_exp,
+ sizeof(ioc_data), &ioc_data, NULL);
- /* Really, we'd like to wait until there are no requests outstanding,
+ /*
+ * really, we'd like to wait until there are no requests outstanding,
* and then continue. For now, we just invalidate the requests,
* schedule, and hope.
*/
EXIT;
}
-int ll_prep_inode(struct obd_export *osc_exp, struct obd_export *mdc_exp,
+int ll_prep_inode(struct obd_export *lov_exp, struct obd_export *lmv_exp,
struct inode **inode, struct ptlrpc_request *req,
int offset, struct super_block *sb)
{
struct lustre_md md;
int rc = 0;
- rc = mdc_req2lustre_md(mdc_exp, req, offset, osc_exp, &md);
+ rc = mdc_req2lustre_md(lmv_exp, req, offset, lov_exp, &md);
if (rc)
RETURN(rc);
ll_update_inode(*inode, &md);
} else {
LASSERT(sb);
- *inode = ll_iget(sb, md.body->ino, &md);
+ *inode = ll_iget(sb, id_ino(&md.body->id1), &md);
if (*inode == NULL || is_bad_inode(*inode)) {
/* free the lsm if we allocated one above */
if (md.lsm != NULL)
- obd_free_memmd(osc_exp, &md.lsm);
+ obd_free_memmd(lov_exp, &md.lsm);
if (md.mea != NULL)
- obd_free_memmd(mdc_exp,
+ obd_free_memmd(lmv_exp,
(struct lov_stripe_md**)&md.mea);
rc = -ENOMEM;
CERROR("new_inode -fatal: rc %d\n", rc);
RETURN(rc);
}
+
+int ll_get_fid(struct obd_export *exp, struct lustre_id *idp,
+ char *filename, struct lustre_id *ret)
+{
+ struct ptlrpc_request *request = NULL;
+ struct mds_body *body;
+ int valid = 0;
+ int rc;
+
+ valid |= OBD_MD_FID;
+
+ rc = md_getattr_name(exp, idp, filename, strlen(filename) + 1,
+ valid, 0, &request);
+ if (rc < 0) {
+ CDEBUG(D_INFO, "md_getattr_name failed on %s: rc %d\n",
+ filename, rc);
+ return rc;
+ }
+
+ body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*body));
+ LASSERT(body != NULL);
+ LASSERT_REPSWABBED(request, 0);
+
+ *ret = body->id1;
+ ptlrpc_req_finished(request);
+
+ return rc;
+}
{
struct ptlrpc_request *req = NULL;
struct ll_sb_info *sbi = ll_s2sbi(sb);
- struct ll_fid fid;
+ struct lustre_id id;
unsigned long valid = 0;
int eadatalen = 0, rc;
struct inode *inode = NULL;
if (inode)
return inode;
if (S_ISREG(mode)) {
- eadatalen = obd_size_diskmd(sbi->ll_osc_exp, NULL);
+ eadatalen = obd_size_diskmd(sbi->ll_lov_exp, NULL);
valid |= OBD_MD_FLEASIZE;
}
- fid.id = (__u64)ino;
- fid.generation = generation;
- fid.f_type = mode;
+ id.li_stc.u.e3s.l3s_type = mode;
+ id.li_stc.u.e3s.l3s_ino = (__u64)ino;
+ id.li_stc.u.e3s.l3s_gen = generation;
- rc = md_getattr(sbi->ll_mdc_exp, &fid, valid, eadatalen, &req);
+ rc = md_getattr(sbi->ll_lmv_exp, &id, valid, eadatalen, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, ino);
return ERR_PTR(rc);
}
- rc = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
+ rc = ll_prep_inode(sbi->ll_lov_exp, sbi->ll_lmv_exp,
&inode, req, 0, sb);
if (rc) {
ptlrpc_req_finished(req);
return 0;
}
- if (last_ino == md->body->ino && last_gen == md->body->generation &&
+ if (last_ino == id_ino(&md->body->id1) &&
+ last_gen == id_gen(&md->body->id1) &&
last_count < 500) {
last_count++;
} else {
CDEBUG(D_VFSTRACE, "compared %u/%u %u times\n",
last_ino, last_gen, last_count);
last_count = 0;
- last_ino = md->body->ino;
- last_gen = md->body->generation;
+ last_ino = id_ino(&md->body->id1);
+ last_gen = id_gen(&md->body->id1);
CDEBUG(D_VFSTRACE,
- "comparing inode %p ino %lu/%u/%u to body %u/%u/%u\n",
- inode, inode->i_ino, inode->i_generation,
- ll_i2info(inode)->lli_mds,
- md->body->ino, md->body->generation,
- md->body->mds);
+ "comparing inode %p ino "DLID4" to body "DLID4"\n",
+ inode, OLID4(&ll_i2info(inode)->lli_id),
+ OLID4(&md->body->id1));
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
- if (inode->i_ino != md->body->ino)
+ if (inode->i_ino != id_ino(&md->body->id1))
return 0;
#endif
- if (inode->i_generation != md->body->generation)
+ if (inode->i_generation != id_gen(&md->body->id1))
return 0;
- if (ll_i2info(inode)->lli_mds != md->body->mds)
+ if (id_group(&ll_i2info(inode)->lli_id) != id_group(&md->body->id1))
return 0;
- /* Apply the attributes in 'opaque' to this inode */
+
+ /* apply the attributes in 'opaque' to this inode. */
ll_update_inode(inode, md);
return 1;
}
RETURN(0);
}
-/* Get an inode by inode number (already instantiated by the intent lookup).
- * Returns inode or NULL
+/*
+ * get an inode by inode number (already instantiated by the intent lookup).
+ * Returns inode or NULL.
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
int ll_set_inode(struct inode *inode, void *opaque)
break;
case LDLM_CB_CANCELING: {
struct inode *inode = ll_inode_from_lock(lock);
+ struct ll_inode_info *li = ll_i2info(inode);
__u64 bits = lock->l_policy_data.l_inodebits.bits;
/* For lookup locks: Invalidate all dentries associated with
&(ll_i2info(inode)->lli_flags));
- if (lock->l_resource->lr_name.name[0] != inode->i_ino ||
- lock->l_resource->lr_name.name[1] != inode->i_generation) {
- LDLM_ERROR(lock, "data mismatch with ino %lu/%u(%p)",
- inode->i_ino, inode->i_generation, inode);
+ if (lock->l_resource->lr_name.name[0] != id_fid(&li->lli_id) ||
+ lock->l_resource->lr_name.name[1] != id_group(&li->lli_id)) {
+ LDLM_ERROR(lock, "data mismatch with object %lu/%lu",
+ (unsigned long)id_fid(&li->lli_id),
+ (unsigned long)id_group(&li->lli_id));
}
/* If lookup lock is cancelled, we just drop the dentry and
int ll_mdc_cancel_unused(struct lustre_handle *conn, struct inode *inode,
int flags, void *opaque)
{
+ struct ll_inode_info *li = ll_i2info(inode);
struct ldlm_res_id res_id =
- { .name = {inode->i_ino, inode->i_generation} };
+ { .name = {id_fid(&li->lli_id), id_group(&li->lli_id)} };
struct obd_device *obddev = class_conn2obd(conn);
ENTRY;
if (!it_disposition(it, DISP_LOOKUP_NEG)) {
ENTRY;
- rc = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
+ rc = ll_prep_inode(sbi->ll_lov_exp, sbi->ll_lmv_exp,
&inode, request, offset, dentry->d_sb);
if (rc)
RETURN(rc);
CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n",
inode, inode->i_ino, inode->i_generation);
+
mdc_set_lock_data(NULL, &it->d.lustre.it_lock_handle, inode);
-
+
/* If this is a stat, get the authoritative file size */
if (it->it_op == IT_GETATTR && S_ISREG(inode->i_mode) &&
ll_i2info(inode)->lli_smd != NULL) {
dentry->d_op = &ll_d_ops;
ll_set_dd(dentry);
- if (dentry == saved) {
+ if (dentry == saved)
d_add(dentry, inode);
- }
RETURN(0);
}
-
static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
- struct nameidata *nd,
- struct lookup_intent *it, int flags)
+ struct nameidata *nd, struct lookup_intent *it,
+ int flags)
{
struct dentry *save = dentry, *retval;
- struct ll_fid pfid;
+ struct lustre_id pid;
struct it_cb_data icbd;
struct ptlrpc_request *req = NULL;
struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
icbd.icbd_childp = &dentry;
icbd.icbd_parent = parent;
- ll_inode2fid(&pfid, parent);
+ ll_inode2id(&pid, parent);
- rc = md_intent_lock(ll_i2mdcexp(parent), &pfid,
+ rc = md_intent_lock(ll_i2lmvexp(parent), &pid,
dentry->d_name.name, dentry->d_name.len, NULL, 0,
NULL, it, flags, &req, ll_mdc_blocking_ast);
if (rc < 0)
ptlrpc_req_finished(req);
if (dentry->d_inode)
CDEBUG(D_INODE, "lookup 0x%p in %lu/%lu: %*s -> %lu/%lu\n",
- dentry,
- (unsigned long) parent->i_ino,
- (unsigned long) parent->i_generation,
- dentry->d_name.len, dentry->d_name.name,
- (unsigned long) dentry->d_inode->i_ino,
- (unsigned long) dentry->d_inode->i_generation);
+ dentry,
+ (unsigned long) parent->i_ino,
+ (unsigned long) parent->i_generation,
+ dentry->d_name.len, dentry->d_name.name,
+ (unsigned long) dentry->d_inode->i_ino,
+ (unsigned long) dentry->d_inode->i_generation);
else
CDEBUG(D_INODE, "lookup 0x%p in %lu/%lu: %*s -> ??\n",
- dentry,
- (unsigned long) parent->i_ino,
- (unsigned long) parent->i_generation,
- dentry->d_name.len, dentry->d_name.name);
+ dentry,
+ (unsigned long) parent->i_ino,
+ (unsigned long) parent->i_generation,
+ dentry->d_name.len, dentry->d_name.name);
return retval;
}
LASSERT(it && it->d.lustre.it_disposition);
request = it->d.lustre.it_data;
- rc = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
+ rc = ll_prep_inode(sbi->ll_lov_exp, sbi->ll_lmv_exp,
&inode, request, 1, dir->i_sb);
if (rc)
GOTO(out, inode = ERR_PTR(rc));
{
struct inode *inode;
struct ptlrpc_request *request = it->d.lustre.it_data;
- struct obd_export *mdc_exp = ll_i2mdcexp(dir);
+ struct obd_export *lmv_exp = ll_i2lmvexp(dir);
int rc = 0;
ENTRY;
if (rc)
RETURN(rc);
- mdc_store_inode_generation(mdc_exp, request, MDS_REQ_INTENT_REC_OFF, 1);
+ mdc_store_inode_generation(lmv_exp, request, MDS_REQ_INTENT_REC_OFF, 1);
inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
NULL, 0, mode, 0, it);
- if (IS_ERR(inode)) {
+ if (IS_ERR(inode))
RETURN(PTR_ERR(inode));
- }
d_instantiate(dentry, inode);
RETURN(0);
case S_IFBLK:
case S_IFIFO:
case S_IFSOCK:
- ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- err = md_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
+ ll_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ err = md_create(sbi->ll_lmv_exp, &op_data, NULL, 0, mode,
current->fsuid, current->fsgid, rdev, &request);
if (err == 0)
ll_update_times(request, 0, dir);
case S_IFBLK:
case S_IFIFO:
case S_IFSOCK:
- ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- err = md_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
+ ll_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ err = md_create(sbi->ll_lmv_exp, &op_data, NULL, 0, mode,
current->fsuid, current->fsgid, rdev, &request);
if (err)
GOTO(out_err, err);
ll_update_times(request, 0, dir);
- err = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
+ err = ll_prep_inode(sbi->ll_lov_exp, sbi->ll_lmv_exp,
&inode, request, 0, child->d_sb);
if (err)
GOTO(out_err, err);
if (dir->i_nlink >= EXT3_LINK_MAX)
RETURN(err);
- ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- err = md_create(sbi->ll_mdc_exp, &op_data,
+ ll_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ err = md_create(sbi->ll_lmv_exp, &op_data,
tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
current->fsuid, current->fsgid, 0, &request);
if (err == 0)
src->i_ino, src->i_generation, src,
dir->i_ino, dir->i_generation, dir, name);
- ll_prepare_mdc_op_data(&op_data, src, dir, name, len, 0);
- err = md_link(sbi->ll_mdc_exp, &op_data, &request);
+ ll_prepare_mdc_data(&op_data, src, dir, name, len, 0);
+ err = md_link(sbi->ll_lmv_exp, &op_data, &request);
if (err == 0)
ll_update_times(request, 0, dir);
ptlrpc_req_finished(request);
name, dir->i_ino, dir->i_generation, dir);
mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
- ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- err = md_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
+ ll_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ err = md_create(sbi->ll_lmv_exp, &op_data, NULL, 0, mode,
current->fsuid, current->fsgid, 0, &request);
if (err == 0)
ll_update_times(request, 0, dir);
CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p)\n",
name, dir->i_ino, dir->i_generation, dir);
- ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, S_IFDIR);
- rc = md_unlink(ll_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
+ ll_prepare_mdc_data(&op_data, dir, NULL, name, len, S_IFDIR);
+ rc = md_unlink(ll_i2sbi(dir)->ll_lmv_exp, &op_data, &request);
if (rc == 0)
ll_update_times(request, 0, dir);
ptlrpc_req_finished(request);
CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p)\n",
name, dir->i_ino, dir->i_generation, dir);
- ll_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- rc = md_unlink(ll_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
+ ll_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ rc = md_unlink(ll_i2sbi(dir)->ll_lmv_exp, &op_data, &request);
if (rc)
GOTO(out, rc);
ll_update_times(request, 0, dir);
struct mdc_op_data op_data;
int err;
ENTRY;
- CDEBUG(D_VFSTRACE, "VFS Op:oldname=%s,src_dir=%lu/%u(%p),newname=%s,"
+ CDEBUG(D_VFSTRACE, "VFS Op:oldname=%s, src_dir=%lu/%u(%p), newname=%s, "
"tgt_dir=%lu/%u(%p)\n", oldname, src->i_ino, src->i_generation,
src, newname, tgt->i_ino, tgt->i_generation, tgt);
- ll_prepare_mdc_op_data(&op_data, src, tgt, NULL, 0, 0);
- err = md_rename(sbi->ll_mdc_exp, &op_data,
+ ll_prepare_mdc_data(&op_data, src, tgt, NULL, 0, 0);
+ err = md_rename(sbi->ll_lmv_exp, &op_data,
oldname, oldlen, newname, newlen, &request);
if (!err) {
ll_update_times(request, 0, src);
}
ptlrpc_req_finished(request);
-
RETURN(err);
}
valid_flags = OBD_MD_FLTYPE | OBD_MD_FLATIME;
if (cmd == OBD_BRW_WRITE) {
oa->o_valid |= OBD_MD_FLIFID | OBD_MD_FLEPOCH;
- mdc_pack_fid(obdo_fid(oa), inode->i_ino, 0, inode->i_mode);
- obdo_fid(oa)->mds = ll_i2info(inode)->lli_mds;
- oa->o_easize = ll_i2info(inode)->lli_io_epoch;
+ mdc_pack_id(obdo_id(oa), inode->i_ino, 0, inode->i_mode,
+ id_group(&ll_i2info(inode)->lli_id),
+ id_fid(&ll_i2info(inode)->lli_id));
+ oa->o_easize = ll_i2info(inode)->lli_io_epoch;
valid_flags |= OBD_MD_FLMTIME | OBD_MD_FLCTIME;
}
page_extent.l_extent.end =
page_extent.l_extent.start + PAGE_CACHE_SIZE - 1;
flags = LDLM_FL_CBPENDING | LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK;
- matches = obd_match(ll_i2sbi(inode)->ll_osc_exp,
+ matches = obd_match(ll_i2sbi(inode)->ll_lov_exp,
ll_i2info(inode)->lli_smd, LDLM_EXTENT,
&page_extent, LCK_PR | LCK_PW, &flags, inode,
&match_lockh);
}
lprocfs_counter_incr(sbi->ll_stats, LPROC_LL_RELEASE);
- err = ll_mdc_close(sbi->ll_mdc_exp, inode, filp);
+ err = ll_mdc_close(sbi->ll_lmv_exp, inode, filp);
if (err && rc == 0)
rc = err;
err = ll_local_open(filp, it);
if (rc != 0) {
CERROR("error opening special file: rc %d\n", rc);
- ll_mdc_close(ll_i2sbi(inode)->ll_mdc_exp, inode, filp);
+ ll_mdc_close(ll_i2sbi(inode)->ll_lmv_exp, inode, filp);
} else if (err) {
if (pfop && *pfop) {
if ((*pfop)->release)
#include "llite_internal.h"
static int ll_readlink_internal(struct inode *inode,
- struct ptlrpc_request **request, char **symname)
+ struct ptlrpc_request **request,
+ char **symname)
{
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_sb_info *sbi = ll_i2sbi(inode);
- struct ll_fid fid;
+ struct lustre_id id;
struct mds_body *body;
int rc, symlen = inode->i_size + 1;
ENTRY;
RETURN(0);
}
- ll_inode2fid(&fid, inode);
- rc = md_getattr(sbi->ll_mdc_exp, &fid, OBD_MD_LINKNAME, symlen,
+ ll_inode2id(&id, inode);
+ rc = md_getattr(sbi->ll_lmv_exp, &id, OBD_MD_LINKNAME, symlen,
request);
if (rc) {
if (rc != -ENOENT)
it->d.lustre.it_lock_mode);
}
-int lmv_handle_remote_inode(struct obd_export *exp,
- void *lmm, int lmmsize,
- struct lookup_intent *it, int flags,
- struct ptlrpc_request **reqp,
+int lmv_handle_remote_inode(struct obd_export *exp, void *lmm,
+ int lmmsize, struct lookup_intent *it,
+ int flags, struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking)
{
struct obd_device *obd = exp->exp_obd;
LASSERT(body != NULL);
if (body->valid & OBD_MD_MDS) {
- /* oh, MDS reports that this is remote inode case
- * i.e. we have to ask for real attrs on another MDS */
+ /*
+ * oh, MDS reports that this is remote inode case i.e. we have
+ * to ask for real attrs on another MDS.
+ */
struct ptlrpc_request *req = NULL;
- struct ll_fid nfid;
struct lustre_handle plock;
+ struct lustre_id nid;
int pmode;
- if (it->it_op == IT_LOOKUP) {
- /* unfortunately, we have to lie to MDC/MDS to
- * retrieve attributes llite needs */
+ if (it->it_op == IT_LOOKUP || it->it_op == IT_CHDIR) {
+ /*
+ * unfortunately, we have to lie to MDC/MDS to retrieve
+ * attributes llite needs.
+ */
it->it_op = IT_GETATTR;
}
pmode = it->d.lustre.it_lock_mode;
if (pmode) {
memcpy(&plock, &it->d.lustre.it_lock_handle,
- sizeof(plock));
+ sizeof(plock));
it->d.lustre.it_lock_mode = 0;
}
- nfid = body->fid1;
+ nid = body->id1;
it->d.lustre.it_disposition &= ~DISP_ENQ_COMPLETE;
- rc = md_intent_lock(lmv->tgts[nfid.mds].ltd_exp, &nfid,
+ rc = md_intent_lock(lmv->tgts[id_group(&nid)].ltd_exp, &nid,
NULL, 0, lmm, lmmsize, NULL, it, flags,
&req, cb_blocking);
- /* llite needs LOOKUP lock to track dentry revocation in
- * order to maintain dcache consistency. thus drop UPDATE
- * lock here and put LOOKUP in request */
+ /*
+ * llite needs LOOKUP lock to track dentry revocation in order
+ * to maintain dcache consistency. Thus drop UPDATE lock here
+ * and put LOOKUP in request.
+ */
if (rc == 0) {
lmv_drop_intent_lock(it);
memcpy(&it->d.lustre.it_lock_handle, &plock,
- sizeof(plock));
+ sizeof(plock));
it->d.lustre.it_lock_mode = pmode;
} else if (pmode)
RETURN(rc);
}
-int lmv_intent_open(struct obd_export *exp,
- struct ll_fid *pfid, const char *name, int len,
- void *lmm, int lmmsize, struct ll_fid *cfid,
- struct lookup_intent *it, int flags,
- struct ptlrpc_request **reqp,
+int lmv_intent_open(struct obd_export *exp, struct lustre_id *pid,
+ const char *name, int len, void *lmm, int lmmsize,
+ struct lustre_id *cid, struct lookup_intent *it,
+ int flags, struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
struct mds_body *body = NULL;
- struct ll_fid rpfid = *pfid;
+ struct lustre_id rpid = *pid;
+ int rc, mds, loop = 0;
struct lmv_obj *obj;
struct mea *mea;
- int rc, mds, loop = 0;
ENTRY;
/* IT_OPEN is intended to open (and create, possible) an object. Parent
- * (pfid) may be splitted dir */
+ * (pid) may be splitted dir */
repeat:
LASSERT(++loop <= 2);
- mds = rpfid.mds;
- obj = lmv_grab_obj(obd, &rpfid);
+ mds = id_group(&rpid);
+ obj = lmv_grab_obj(obd, &rpid);
if (obj) {
/* directory is already splitted, so we have to forward
* request to the right MDS */
- mds = raw_name2idx(obj->hashtype, obj->objcount, (char *)name, len);
- CDEBUG(D_OTHER, "forward to MDS #%u (%lu/%lu/%lu)\n", mds,
- (unsigned long) rpfid.mds, (unsigned long) rpfid.id,
- (unsigned long) rpfid.generation);
- rpfid = obj->objs[mds].fid;
+ mds = raw_name2idx(obj->hashtype, obj->objcount,
+ (char *)name, len);
+
+ CDEBUG(D_OTHER, "forward to MDS #%u ("DLID4")\n",
+ mds, OLID4(&rpid));
+ rpid = obj->objs[mds].id;
lmv_put_obj(obj);
}
- rc = md_intent_lock(lmv->tgts[rpfid.mds].ltd_exp, &rpfid, name,
- len, lmm, lmmsize, cfid, it, flags, reqp,
+ rc = md_intent_lock(lmv->tgts[id_group(&rpid)].ltd_exp, &rpid, name,
+ len, lmm, lmmsize, cid, it, flags, reqp,
cb_blocking);
if (rc == -ERESTART) {
- /* directory got splitted. time to update local object
- * and repeat the request with proper MDS */
- LASSERT(fid_equal(pfid, &rpfid));
- rc = lmv_get_mea_and_update_object(exp, &rpfid);
+ /* directory got splitted. time to update local object and
+ * repeat the request with proper MDS */
+ LASSERT(id_equal_fid(pid, &rpid));
+ rc = lmv_get_mea_and_update_object(exp, &rpid);
if (rc == 0) {
ptlrpc_req_finished(*reqp);
goto repeat;
flags, reqp, cb_blocking);
if (rc != 0) {
LASSERT(rc < 0);
- CERROR("can't handle remote %s: dir %lu/%lu/%lu(%lu/%lu/%lu):"
- "%*s: %d\n", LL_IT2STR(it),
- (unsigned long) pfid->mds,
- (unsigned long) pfid->id,
- (unsigned long) pfid->generation,
- (unsigned long) rpfid.mds,
- (unsigned long) rpfid.id,
- (unsigned long) rpfid.generation,
+
+ /*
+ * this is possible, that some userspace application will try to
+ * open file as directory and we will have error -20 here. As
+ * this is "usual" situation, we should not print error here,
+ * only debug info.
+ */
+ CDEBUG(D_OTHER, "can't handle remote %s: dir "DLID4"("DLID4"):"
+ "%*s: %d\n", LL_IT2STR(it), OLID4(pid), OLID4(&rpid),
len, name, rc);
RETURN(rc);
}
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
- cfid = &body->fid1;
- obj = lmv_grab_obj(obd, cfid);
- if (!obj && (mea = body_of_splitted_dir(*reqp, 1))) {
+ cid = &body->id1;
+ obj = lmv_grab_obj(obd, cid);
+ if (!obj && (mea = lmv_splitted_dir_body(*reqp, 1))) {
/* wow! this is splitted dir, we'd like to handle it */
- obj = lmv_create_obj(exp, &body->fid1, mea);
+ obj = lmv_create_obj(exp, &body->id1, mea);
if (IS_ERR(obj))
RETURN(PTR_ERR(obj));
}
if (obj) {
/* this is splitted dir and we'd want to get attrs */
- CDEBUG(D_OTHER, "attrs from slaves for %lu/%lu/%lu\n",
- (unsigned long)cfid->mds, (unsigned long)cfid->id,
- (unsigned long)cfid->generation);
- rc = lmv_revalidate_slaves(exp, reqp, cfid,
- it, 1, cb_blocking);
+ CDEBUG(D_OTHER, "attrs from slaves for "DLID4"\n",
+ OLID4(cid));
+
+ rc = lmv_revalidate_slaves(exp, reqp, cid, it, 1,
+ cb_blocking);
} else if (S_ISDIR(body->mode)) {
- /*CWARN("hmmm, %lu/%lu/%lu has not lmv obj?!\n",
- (unsigned long) cfid->mds,
- (unsigned long) cfid->id,
- (unsigned long) cfid->generation);*/
+ CDEBUG(D_OTHER, "object "DLID4" has not lmv obj?\n",
+ OLID4(cid));
}
if (obj)
RETURN(rc);
}
-int lmv_intent_getattr(struct obd_export *exp,
- struct ll_fid *pfid, const char *name, int len,
- void *lmm, int lmmsize, struct ll_fid *cfid,
- struct lookup_intent *it, int flags,
- struct ptlrpc_request **reqp,
+int lmv_intent_getattr(struct obd_export *exp, struct lustre_id *pid,
+ const char *name, int len, void *lmm, int lmmsize,
+ struct lustre_id *cid, struct lookup_intent *it,
+ int flags, struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
struct mds_body *body = NULL;
- struct ll_fid rpfid = *pfid;
+ struct lustre_id rpid = *pid;
struct lmv_obj *obj, *obj2;
struct mea *mea;
int rc = 0, mds;
ENTRY;
- if (cfid) {
+ if (cid) {
/* caller wants to revalidate attrs of obj we have to revalidate
* slaves if requested object is splitted directory */
- CDEBUG(D_OTHER, "revalidate attrs for %lu/%lu/%lu\n",
- (unsigned long)cfid->mds, (unsigned long)cfid->id,
- (unsigned long)cfid->generation);
- mds = cfid->mds;
- obj = lmv_grab_obj(obd, cfid);
+ CDEBUG(D_OTHER, "revalidate attrs for "DLID4"\n", OLID4(cid));
+ mds = id_group(cid);
+ obj = lmv_grab_obj(obd, cid);
if (obj) {
/* in fact, we need not this with current intent_lock(),
* but it may change some day */
- if (!fid_equal(pfid, cfid)){
- rpfid = obj->objs[mds].fid;
- mds = rpfid.mds;
+ if (!id_equal_fid(pid, cid)){
+ rpid = obj->objs[mds].id;
+ mds = id_group(&rpid);
}
lmv_put_obj(obj);
}
} else {
- CDEBUG(D_OTHER, "INTENT getattr for %*s on %lu/%lu/%lu\n",
- len, name, (unsigned long)pfid->mds, (unsigned long)pfid->id,
- (unsigned long)pfid->generation);
- mds = pfid->mds;
- obj = lmv_grab_obj(obd, pfid);
+ CDEBUG(D_OTHER, "INTENT getattr for %*s on "DLID4"\n",
+ len, name, OLID4(pid));
+ mds = id_group(pid);
+ obj = lmv_grab_obj(obd, pid);
if (obj && len) {
/* directory is already splitted. calculate mds */
- mds = raw_name2idx(obj->hashtype, obj->objcount, (char *) name, len);
- rpfid = obj->objs[mds].fid;
- mds = rpfid.mds;
+ mds = raw_name2idx(obj->hashtype, obj->objcount,
+ (char *)name, len);
+ rpid = obj->objs[mds].id;
+ mds = id_group(&rpid);
lmv_put_obj(obj);
- CDEBUG(D_OTHER, "forward to MDS #%u (slave %lu/%lu/%lu)\n",
- mds, (unsigned long)rpfid.mds, (unsigned long)rpfid.id,
- (unsigned long)rpfid.generation);
+ CDEBUG(D_OTHER, "forward to MDS #%u (slave "DLID4")\n",
+ mds, OLID4(&rpid));
}
- }
- rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpfid, name,
- len, lmm, lmmsize, cfid, it, flags, reqp,
+ }
+ rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpid, name,
+ len, lmm, lmmsize, cid, it, flags, reqp,
cb_blocking);
if (rc < 0)
RETURN(rc);
* be fine if we don't. this means that nobody should
* use UPDATE lock to notify about object * removal */
CDEBUG(D_OTHER,
- "revalidate slaves for %lu/%lu/%lu, rc %d\n",
- (unsigned long)cfid->mds, (unsigned long)cfid->id,
- (unsigned long)cfid->generation, rc);
+ "revalidate slaves for "DLID4", rc %d\n",
+ OLID4(cid), rc);
- LASSERT(cfid != 0);
- rc = lmv_revalidate_slaves(exp, reqp, cfid, it, rc,
+ LASSERT(cid != 0);
+ rc = lmv_revalidate_slaves(exp, reqp, cid, it, rc,
cb_blocking);
- RETURN(rc);
+ RETURN(rc);
}
if (*reqp == NULL)
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
- cfid = &body->fid1;
- obj2 = lmv_grab_obj(obd, cfid);
+ cid = &body->id1;
+ obj2 = lmv_grab_obj(obd, cid);
- if (!obj2 && (mea = body_of_splitted_dir(*reqp, 1))) {
+ if (!obj2 && (mea = lmv_splitted_dir_body(*reqp, 1))) {
/* wow! this is splitted dir, we'd like to handle it. */
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
- obj2 = lmv_create_obj(exp, &body->fid1, mea);
+ obj2 = lmv_create_obj(exp, &body->id1, mea);
if (IS_ERR(obj2))
RETURN(PTR_ERR(obj2));
}
if (obj2) {
/* this is splitted dir and we'd want to get attrs */
- CDEBUG(D_OTHER, "attrs from slaves for %lu/%lu/%lu, rc %d\n",
- (unsigned long)cfid->mds, (unsigned long)cfid->id,
- (unsigned long)cfid->generation, rc);
+ CDEBUG(D_OTHER, "attrs from slaves for "DLID4", rc %d\n",
+ OLID4(cid), rc);
- rc = lmv_revalidate_slaves(exp, reqp, cfid, it, 1, cb_blocking);
+ rc = lmv_revalidate_slaves(exp, reqp, cid, it, 1, cb_blocking);
lmv_put_obj(obj2);
}
RETURN(rc);
{
/* update size */
body->size += obj->size;
-/* body->atime = obj->atime;
- body->ctime = obj->ctime;
- body->mtime = obj->mtime;
- body->nlink = obj->nlink;*/
}
int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
- obj = lmv_grab_obj(obd, &body->fid1);
+ obj = lmv_grab_obj(obd, &body->id1);
LASSERT(obj != NULL);
- CDEBUG(D_OTHER, "lookup slaves for %lu/%lu/%lu\n",
- (unsigned long)body->fid1.mds,
- (unsigned long)body->fid1.id,
- (unsigned long)body->fid1.generation);
+ CDEBUG(D_OTHER, "lookup slaves for "DLID4"\n",
+ OLID4(&body->id1));
lmv_lock_obj(obj);
for (i = 0; i < obj->objcount; i++) {
- struct ll_fid fid = obj->objs[i].fid;
+ struct lustre_id id = obj->objs[i].id;
struct ptlrpc_request *req = NULL;
struct lookup_intent it;
- if (fid_equal(&fid, &obj->fid))
+ if (id_equal_fid(&id, &obj->id))
/* skip master obj */
continue;
- CDEBUG(D_OTHER, "lookup slave %lu/%lu/%lu\n",
- (unsigned long)fid.mds, (unsigned long)fid.id,
- (unsigned long)fid.generation);
+ CDEBUG(D_OTHER, "lookup slave "DLID4"\n", OLID4(&id));
/* is obj valid? */
memset(&it, 0, sizeof(it));
it.it_op = IT_GETATTR;
- rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &fid,
- NULL, 0, NULL, 0, &fid, &it, 0, &req,
+ rc = md_intent_lock(lmv->tgts[id_group(&id)].ltd_exp, &id,
+ NULL, 0, NULL, 0, &id, &it, 0, &req,
lmv_dirobj_blocking_ast);
lockh = (struct lustre_handle *)&it.d.lustre.it_lock_handle;
RETURN(rc);
}
-int lmv_intent_lookup(struct obd_export *exp,
- struct ll_fid *pfid, const char *name, int len,
- void *lmm, int lmmsize, struct ll_fid *cfid,
- struct lookup_intent *it, int flags,
- struct ptlrpc_request **reqp,
+int lmv_intent_lookup(struct obd_export *exp, struct lustre_id *pid,
+ const char *name, int len, void *lmm, int lmmsize,
+ struct lustre_id *cid, struct lookup_intent *it,
+ int flags, struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
struct mds_body *body = NULL;
- struct ll_fid rpfid = *pfid;
+ struct lustre_id rpid = *pid;
struct lmv_obj *obj;
struct mea *mea;
int rc, mds, loop = 0;
ENTRY;
- /* IT_LOOKUP is intended to produce name -> fid resolving (let's call
+ /*
+ * IT_LOOKUP is intended to produce name -> id resolving (let's call
* this lookup below) or to confirm requested resolving is still valid
- * (let's call this revalidation) cfid != NULL specifies revalidation */
-
- if (cfid) {
- /* this is revalidation: we have to check is LOOKUP lock still
- * valid for given fid. very important part is that we have to
- * choose right mds because namespace is per mds */
- rpfid = *pfid;
- obj = lmv_grab_obj(obd, pfid);
+ * (let's call this revalidation) cid != NULL specifies revalidation.
+ */
+ if (cid) {
+ /*
+ * this is revalidation: we have to check is LOOKUP lock still
+ * valid for given id. Very important part is that we have to
+ * choose right mds because namespace is per mds.
+ */
+ rpid = *pid;
+ obj = lmv_grab_obj(obd, pid);
if (obj) {
- mds = raw_name2idx(obj->hashtype, obj->objcount,
- (char *) name, len);
- rpfid = obj->objs[mds].fid;
+ mds = raw_name2idx(obj->hashtype, obj->objcount,
+ (char *)name, len);
+ rpid = obj->objs[mds].id;
lmv_put_obj(obj);
}
- mds = rpfid.mds;
+ mds = id_group(&rpid);
- CDEBUG(D_OTHER, "revalidate lookup for %lu/%lu/%lu to %d MDS\n",
- (unsigned long)cfid->mds, (unsigned long)cfid->id,
- (unsigned long)cfid->generation, mds);
+ CDEBUG(D_OTHER, "revalidate lookup for "DLID4" to %d MDS\n",
+ OLID4(cid), mds);
} else {
- mds = pfid->mds;
+ mds = id_group(pid);
repeat:
LASSERT(++loop <= 2);
- /* this is lookup. during lookup we have to update all the
- * attributes, because returned values will be put in struct
+
+ /* this is lookup. during lookup we have to update all the
+ * attributes, because returned values will be put in struct
* inode */
- obj = lmv_grab_obj(obd, pfid);
+ obj = lmv_grab_obj(obd, pid);
if (obj) {
if (len) {
/* directory is already splitted. calculate mds */
mds = raw_name2idx(obj->hashtype, obj->objcount,
(char *)name, len);
- rpfid = obj->objs[mds].fid;
- mds = rpfid.mds;
+ rpid = obj->objs[mds].id;
+ mds = id_group(&rpid);
}
lmv_put_obj(obj);
}
}
- rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpfid, name,
- len, lmm, lmmsize, cfid, it, flags, reqp,
+ rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpid, name,
+ len, lmm, lmmsize, cid, it, flags, reqp,
cb_blocking);
if (rc > 0) {
- LASSERT(cfid != 0);
+ LASSERT(cid != 0);
RETURN(rc);
}
if (rc > 0) {
/* very interesting. it seems object is still valid but for some
* reason llite calls lookup, not revalidate */
- CDEBUG(D_OTHER, "lookup for %lu/%lu/%lu and data should be uptodate\n",
- (unsigned long)rpfid.mds, (unsigned long)rpfid.id,
- (unsigned long)rpfid.generation);
+ CDEBUG(D_OTHER, "lookup for "DLID4" and data should be uptodate\n",
+ OLID4(&rpid));
LASSERT(*reqp == NULL);
RETURN(rc);
}
if (rc == 0 && *reqp == NULL) {
/* once again, we're asked for lookup, not revalidate */
- CDEBUG(D_OTHER, "lookup for %lu/%lu/%lu and data should be uptodate\n",
- (unsigned long)rpfid.mds, (unsigned long)rpfid.id,
- (unsigned long)rpfid.generation);
+ CDEBUG(D_OTHER, "lookup for "DLID4" and data should be uptodate\n",
+ OLID4(&rpid));
RETURN(rc);
}
CWARN("we haven't knew about directory splitting!\n");
LASSERT(obj == NULL);
- obj = lmv_create_obj(exp, &rpfid, NULL);
+ obj = lmv_create_obj(exp, &rpid, NULL);
if (IS_ERR(obj))
RETURN(PTR_ERR(obj));
lmv_put_obj(obj);
if (rc < 0)
RETURN(rc);
- /* okay, MDS has returned success. probably name has been resolved in
- * remote inode */
+ /* okay, MDS has returned success. Probably name has been resolved in
+ * remote inode. */
rc = lmv_handle_remote_inode(exp, lmm, lmmsize, it, flags,
reqp, cb_blocking);
- if (rc == 0 && (mea = body_of_splitted_dir(*reqp, 1))) {
+ if (rc == 0 && (mea = lmv_splitted_dir_body(*reqp, 1))) {
/* wow! this is splitted dir, we'd like to handle it */
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
- obj = lmv_grab_obj(obd, &body->fid1);
+ obj = lmv_grab_obj(obd, &body->id1);
if (!obj) {
- obj = lmv_create_obj(exp, &body->fid1, mea);
+ obj = lmv_create_obj(exp, &body->id1, mea);
if (IS_ERR(obj))
RETURN(PTR_ERR(obj));
}
RETURN(rc);
}
-int lmv_intent_lock(struct obd_export *exp,
- struct ll_fid *pfid, const char *name, int len,
- void *lmm, int lmmsize, struct ll_fid *cfid,
- struct lookup_intent *it, int flags,
- struct ptlrpc_request **reqp,
+int lmv_intent_lock(struct obd_export *exp, struct lustre_id *pid,
+ const char *name, int len, void *lmm, int lmmsize,
+ struct lustre_id *cid, struct lookup_intent *it,
+ int flags, struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking)
{
struct obd_device *obd = exp->exp_obd;
ENTRY;
LASSERT(it);
- LASSERT(pfid);
+ LASSERT(pid);
- CDEBUG(D_OTHER, "INTENT LOCK '%s' for '%*s' on %lu/%lu -> %u\n",
- LL_IT2STR(it), len, name, (unsigned long) pfid->id,
- (unsigned long) pfid->generation, pfid->mds);
+ CDEBUG(D_OTHER, "INTENT LOCK '%s' for '%*s' on %lu/%lu -> %lu\n",
+ LL_IT2STR(it), len, name, (unsigned long)id_ino(pid),
+ (unsigned long)id_gen(pid), (unsigned long)id_group(pid));
rc = lmv_check_connect(obd);
if (rc)
RETURN(rc);
if (it->it_op == IT_LOOKUP)
- rc = lmv_intent_lookup(exp, pfid, name, len, lmm,
- lmmsize, cfid, it, flags, reqp,
+ rc = lmv_intent_lookup(exp, pid, name, len, lmm,
+ lmmsize, cid, it, flags, reqp,
cb_blocking);
else if (it->it_op & IT_OPEN)
- rc = lmv_intent_open(exp, pfid, name, len, lmm,
- lmmsize, cfid, it, flags, reqp,
+ rc = lmv_intent_open(exp, pid, name, len, lmm,
+ lmmsize, cid, it, flags, reqp,
cb_blocking);
else if (it->it_op == IT_GETATTR || it->it_op == IT_CHDIR)
- rc = lmv_intent_getattr(exp, pfid, name, len, lmm,
- lmmsize, cfid, it, flags, reqp,
+ rc = lmv_intent_getattr(exp, pid, name, len, lmm,
+ lmmsize, cid, it, flags, reqp,
cb_blocking);
else
LBUG();
}
int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
- struct ll_fid *mfid, struct lookup_intent *oit,
+ struct lustre_id *mid, struct lookup_intent *oit,
int master_valid, ldlm_blocking_callback cb_blocking)
{
struct obd_device *obd = exp->exp_obd;
* the fields. say, common fields (that are equal on all the subojects
* need not to be update, another fields (i_size, for example) are
* cached all the time */
- obj = lmv_grab_obj(obd, mfid);
+ obj = lmv_grab_obj(obd, mid);
LASSERT(obj != NULL);
master_lock_mode = 0;
lmv_lock_obj(obj);
for (i = 0; i < obj->objcount; i++) {
- struct ll_fid fid = obj->objs[i].fid;
+ struct lustre_id id = obj->objs[i].id;
struct lustre_handle *lockh = NULL;
struct ptlrpc_request *req = NULL;
ldlm_blocking_callback cb;
struct lookup_intent it;
int master = 0;
- CDEBUG(D_OTHER, "revalidate subobj %lu/%lu/%lu\n",
- (unsigned long)fid.mds, (unsigned long)fid.id,
- (unsigned long) fid.generation);
+ CDEBUG(D_OTHER, "revalidate subobj "DLID4"\n",
+ OLID4(&id));
memset(&it, 0, sizeof(it));
it.it_op = IT_GETATTR;
cb = lmv_dirobj_blocking_ast;
- if (fid_equal(&fid, &obj->fid)) {
+ if (id_equal_fid(&id, &obj->id)) {
if (master_valid) {
/* lmv_intent_getattr() already checked
* validness and took the lock */
}
/* is obj valid? */
- rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &fid,
- NULL, 0, NULL, 0, &fid, &it, 0, &req, cb);
+ rc = md_intent_lock(lmv->tgts[id_group(&id)].ltd_exp,
+ &id, NULL, 0, NULL, 0, &id, &it, 0,
+ &req, cb);
lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
if (rc > 0 && req == NULL) {
/* nice, this slave is valid */
}
if (*reqp == NULL) {
- /* this is first reply, we'll use it to return
- * updated data back to the caller */
+ /* this is first reply, we'll use it to return updated
+ * data back to the caller */
LASSERT(req);
ptlrpc_request_addref(req);
*reqp = req;
body->size = size;
if (mreq == NULL) {
- /* very important to maintain lli->mds the same because
- * of revalidation. mreq == NULL means that caller has
- * no reply and the only attr we can return is size */
+ /* very important to maintain id_group(lli->lli_id) the
+ * same because of revalidation. mreq == NULL means that
+ * caller has no reply and the only attr we can return
+ * is size */
body->valid = OBD_MD_FLSIZE;
- body->mds = obj->fid.mds;
+// body->mds = id_group(&obj->id);
}
if (master_valid == 0) {
memcpy(&oit->d.lustre.it_lock_handle,
#define MEA_SIZE_LMV(lmv) \
((lmv)->desc.ld_tgt_count * \
- sizeof(struct ll_fid) + sizeof(struct mea))
+ sizeof(struct lustre_id) + sizeof(struct mea))
struct lmv_inode {
- struct ll_fid fid; /* fid of dirobj */
+ struct lustre_id id; /* id of dirobj */
unsigned long size; /* slave size value */
int flags;
};
struct semaphore guard;
int state; /* object state. */
atomic_t count; /* ref counter. */
- struct ll_fid fid; /* master fid of dir */
+ struct lustre_id id; /* master id of dir */
void *update; /* bitmap of status (uptodate) */
__u32 hashtype;
int objcount; /* number of slaves */
struct lmv_obj *lmv_get_obj(struct lmv_obj *obj);
struct lmv_obj *lmv_grab_obj(struct obd_device *obd,
- struct ll_fid *fid);
+ struct lustre_id *id);
struct lmv_obj *lmv_alloc_obj(struct obd_device *obd,
- struct ll_fid *fid,
+ struct lustre_id *id,
struct mea *mea);
struct lmv_obj *lmv_create_obj(struct obd_export *exp,
- struct ll_fid *fid,
+ struct lustre_id *id,
struct mea *mea);
-int lmv_delete_obj(struct obd_export *exp, struct ll_fid *fid);
+int lmv_delete_obj(struct obd_export *exp, struct lustre_id *id);
-int lmv_intent_lock(struct obd_export *,
- struct ll_fid *, const char *, int, void *, int,
- struct ll_fid *, struct lookup_intent *, int,
+int lmv_intent_lock(struct obd_export *, struct lustre_id *,
+ const char *, int, void *, int,
+ struct lustre_id *, struct lookup_intent *, int,
struct ptlrpc_request **, ldlm_blocking_callback);
-int lmv_intent_lookup(struct obd_export *,
- struct ll_fid *, const char *, int, void *, int,
- struct ll_fid *, struct lookup_intent *, int,
+int lmv_intent_lookup(struct obd_export *, struct lustre_id *,
+ const char *, int, void *, int,
+ struct lustre_id *, struct lookup_intent *, int,
struct ptlrpc_request **, ldlm_blocking_callback);
-int lmv_intent_getattr(struct obd_export *,
- struct ll_fid *, const char *, int, void *, int,
- struct ll_fid *, struct lookup_intent *, int,
+int lmv_intent_getattr(struct obd_export *, struct lustre_id *,
+ const char *, int, void *, int,
+ struct lustre_id *, struct lookup_intent *, int,
struct ptlrpc_request **, ldlm_blocking_callback);
-int lmv_intent_open(struct obd_export *,
- struct ll_fid *, const char *, int, void *, int,
- struct ll_fid *, struct lookup_intent *, int,
- struct ptlrpc_request **, ldlm_blocking_callback);
+int lmv_intent_open(struct obd_export *, struct lustre_id *, const char *,
+ int, void *, int, struct lustre_id *, struct lookup_intent *,
+ int, struct ptlrpc_request **, ldlm_blocking_callback);
int lmv_revalidate_slaves(struct obd_export *, struct ptlrpc_request **,
- struct ll_fid *, struct lookup_intent *, int,
+ struct lustre_id *, struct lookup_intent *, int,
ldlm_blocking_callback cb_blocking);
-int lmv_get_mea_and_update_object(struct obd_export *, struct ll_fid *);
+int lmv_get_mea_and_update_object(struct obd_export *, struct lustre_id *);
int lmv_dirobj_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
void *, int);
static inline struct mea *
-body_of_splitted_dir(struct ptlrpc_request *req, int offset)
+lmv_splitted_dir_body(struct ptlrpc_request *req, int offset)
{
struct mds_body *body;
struct mea *mea;
if (!body || !S_ISDIR(body->mode) || !body->eadatasize)
return NULL;
- mea = lustre_msg_buf(req->rq_repmsg,
- offset + 1, body->eadatasize);
+ mea = lustre_msg_buf(req->rq_repmsg, offset + 1,
+ body->eadatasize);
LASSERT(mea);
if (mea->mea_count == 0)
return mea;
}
-static inline int
-fid_equal(struct ll_fid *fid1, struct ll_fid *fid2)
-{
- if (fid1->mds != fid2->mds)
- return 0;
- if (fid1->id != fid2->id)
- return 0;
- if (fid1->generation != fid2->generation)
- return 0;
- return 1;
-}
-
/* lproc_lmv.c */
extern struct file_operations lmv_proc_target_fops;
#include <linux/obd_lmv.h>
#include "lmv_internal.h"
+static void lmv_activate_target(struct lmv_obd *lmv,
+ struct lmv_tgt_desc *tgt,
+ int activate)
+{
+ if (tgt->active == activate)
+ return;
+
+ tgt->active = activate;
+ lmv->desc.ld_active_tgt_count += (activate ? 1 : -1);
+}
+
/* Error codes:
*
* -EINVAL : UUID can't be found in the LMV's target list
CDEBUG(D_INFO, "lmv idx %d is %s conn "LPX64"\n",
i, tgt->uuid.uuid, tgt->ltd_exp->exp_handle.h_cookie);
+
if (strncmp(uuid->uuid, tgt->uuid.uuid, sizeof uuid->uuid) == 0)
break;
}
if (i == lmv->desc.ld_tgt_count)
- GOTO(out, rc = -EINVAL);
+ GOTO(out_lmv_lock, rc = -EINVAL);
obd = class_exp2obd(tgt->ltd_exp);
if (obd == NULL)
- GOTO(out, rc = -ENOTCONN);
+ GOTO(out_lmv_lock, rc = -ENOTCONN);
CDEBUG(D_INFO, "Found OBD %s=%s device %d (%p) type %s at LMV idx %d\n",
obd->obd_name, obd->obd_uuid.uuid, obd->obd_minor, obd,
if (tgt->active == activate) {
CDEBUG(D_INFO, "OBD %p already %sactive!\n", obd,
activate ? "" : "in");
- GOTO(out, rc);
+ GOTO(out_lmv_lock, rc);
}
- CDEBUG(D_INFO, "Marking OBD %p %sactive\n", obd, activate ? "" : "in");
+ CDEBUG(D_INFO, "Marking OBD %p %sactive\n",
+ obd, activate ? "" : "in");
- tgt->active = activate;
- if (activate)
- lmv->desc.ld_active_tgt_count++;
- else
- lmv->desc.ld_active_tgt_count--;
+ lmv_activate_target(lmv, tgt, activate);
EXIT;
- out:
+
+ out_lmv_lock:
spin_unlock(&lmv->lmv_lock);
return rc;
}
}
uuid = &watched->u.cli.cl_import->imp_target_uuid;
- /* Set MDC as active before notifying the observer, so the
- * observer can use the MDC normally.
+ /* Set MDC as active before notifying the observer, so the observer can
+ * use the MDC normally.
*/
rc = lmv_set_mdc_active(&obd->u.lmv, uuid, active);
if (rc) {
return lprocfs_obd_detach(dev);
}
-/* This is fake connect function. Its purpose is to initialize lmv and
- * say caller that everything is okay. Real connection will be performed
- * later. */
+/* this is fake connect function. Its purpose is to initialize lmv and say
+ * caller that everything is okay. Real connection will be performed later. */
static int lmv_connect(struct lustre_handle *conn, struct obd_device *obd,
- struct obd_uuid *cluuid, unsigned long connect_flags)
+ struct obd_uuid *cluuid, unsigned long flags)
{
+#ifdef __KERNEL__
+ struct proc_dir_entry *lmv_proc_dir;
+#endif
struct lmv_obd *lmv = &obd->u.lmv;
struct obd_export *exp;
- struct proc_dir_entry *lmv_proc_dir;
- int rc;
+ int rc = 0;
ENTRY;
rc = class_connect(conn, obd, cluuid);
}
exp = class_conn2export(conn);
- /* We don't want to actually do the underlying connections more than
+
+ /* we don't want to actually do the underlying connections more than
* once, so keep track. */
lmv->refcount++;
if (lmv->refcount > 1) {
RETURN(0);
}
- lmv->cluuid = *cluuid;
- lmv->connect_flags = connect_flags;
- lmv->connected = 0;
lmv->exp = exp;
+ lmv->connected = 0;
+ lmv->cluuid = *cluuid;
+ lmv->connect_flags = flags;
sema_init(&lmv->init_sem, 1);
+#ifdef __KERNEL__
lmv_proc_dir = lprocfs_register("target_obds", obd->obd_proc_entry,
NULL, NULL);
if (IS_ERR(lmv_proc_dir)) {
obd->obd_type->typ_name, obd->obd_name);
lmv_proc_dir = NULL;
}
+#endif
+ /*
+ * all real clients shouls perform actual connection rightaway, because
+ * it is possible, that LMV will not have opportunity to connect
+ * targets, as MDC stuff will bit called directly, for instance while
+ * reading ../mdc/../kbytesfree procfs file, etc.
+ */
+ if (flags & OBD_OPT_REAL_CLIENT)
+ rc = lmv_check_connect(obd);
- RETURN(0);
+#ifdef __KERNEL__
+ if (lmv_proc_dir)
+ lprocfs_remove(lmv_proc_dir);
+#endif
+
+ RETURN(rc);
}
void lmv_set_timeouts(struct obd_device *obd)
for (i = 0, tgts = lmv->tgts; i < lmv->desc.ld_tgt_count; i++, tgts++) {
if (tgts->ltd_exp == NULL)
continue;
+
obd_set_info(tgts->ltd_exp, strlen("inter_mds"),
"inter_mds", 0, NULL);
}
}
-/* Performs a check if passed obd is connected. If no - connect it. */
#define MAX_STRING_SIZE 128
+
+/* performs a check if passed obd is connected. If no - connect it. */
int lmv_check_connect(struct obd_device *obd)
{
+#ifdef __KERNEL__
+ struct proc_dir_entry *lmv_proc_dir;
+#endif
struct lmv_obd *lmv = &obd->u.lmv;
- struct obd_uuid *cluuid;
struct lmv_tgt_desc *tgts;
- struct proc_dir_entry *lmv_proc_dir;
+ struct obd_uuid *cluuid;
struct obd_export *exp;
int rc, rc2, i;
if (lmv->connected)
return 0;
-
+
down(&lmv->init_sem);
if (lmv->connected) {
up(&lmv->init_sem);
for (i = 0, tgts = lmv->tgts; i < lmv->desc.ld_tgt_count; i++, tgts++) {
struct obd_device *tgt_obd;
- struct obd_uuid lmv_osc_uuid = { "LMV_OSC_UUID" };
struct lustre_handle conn = {0, };
+ struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" };
LASSERT(tgts != NULL);
CERROR("Target %s not set up\n", tgts->uuid.uuid);
GOTO(out_disc, rc = -EINVAL);
}
-
- rc = obd_connect(&conn, tgt_obd, &lmv_osc_uuid,
+
+ rc = obd_connect(&conn, tgt_obd, &lmv_mdc_uuid,
lmv->connect_flags);
if (rc) {
CERROR("Target %s connect error %d\n",
tgt_obd->obd_name, tgt_obd->obd_uuid.uuid,
atomic_read(&obd->obd_refcount));
+#ifdef __KERNEL__
lmv_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
if (lmv_proc_dir) {
struct obd_device *mdc_obd = class_conn2obd(&conn);
lmv_proc_dir = NULL;
}
}
+#endif
}
lmv_set_timeouts(obd);
uuid = tgts->uuid;
rc2 = obd_disconnect(tgts->ltd_exp, 0);
if (rc2)
- CERROR("error: LMV target %s disconnect on MDT idx %d: "
+ CERROR("error: LMV target %s disconnect on MDC idx %d: "
"error %d\n", uuid.uuid, i, rc2);
}
class_disconnect(exp, 0);
{
struct obd_device *obd = class_exp2obd(exp);
struct lmv_obd *lmv = &obd->u.lmv;
+
+#ifdef __KERNEL__
struct proc_dir_entry *lmv_proc_dir;
+#endif
int rc, i;
ENTRY;
if (lmv->refcount != 0)
goto out_local;
+#ifdef __KERNEL__
lmv_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
+#endif
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
struct obd_device *mdc_obd;
continue;
mdc_obd = class_exp2obd(lmv->tgts[i].ltd_exp);
+
+#ifdef __KERNEL__
if (lmv_proc_dir) {
struct proc_dir_entry *mdc_symlink;
mdc_obd->obd_name);
}
}
+#endif
if (obd->obd_no_recov) {
- /* Pass it on to our clients.
- * XXX This should be an argument to disconnect,
- * XXX not a back-door flag on the OBD. Ah well.
- */
- struct obd_device *mdc_obd;
- mdc_obd = class_exp2obd(lmv->tgts[i].ltd_exp);
if (mdc_obd)
mdc_obd->obd_no_recov = 1;
}
lmv->tgts[i].ltd_exp->exp_obd->obd_uuid.uuid);
obd_register_observer(lmv->tgts[i].ltd_exp->exp_obd, NULL);
-
rc = obd_disconnect(lmv->tgts[i].ltd_exp, flags);
if (rc) {
if (lmv->tgts[i].active) {
}
rc = 0;
}
- if (lmv->tgts[i].active) {
- lmv->desc.ld_active_tgt_count--;
- lmv->tgts[i].active = 0;
- }
+
+ lmv_activate_target(lmv, &lmv->tgts[i], 0);
lmv->tgts[i].ltd_exp = NULL;
}
+#ifdef __KERNEL__
if (lmv_proc_dir) {
lprocfs_remove(lmv_proc_dir);
} else {
CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
obd->obd_type->typ_name, obd->obd_name);
}
-
+#endif
out_local:
/* this is the case when no real connection is established by
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
int err;
- if (lmv->tgts[i].ltd_exp == NULL) {
- CWARN("%s: NULL export for %d\n", obddev->obd_name, i);
+ if (lmv->tgts[i].ltd_exp == NULL)
continue;
- }
err = obd_iocontrol(cmd, lmv->tgts[i].ltd_exp, len, karg, uarg);
if (err) {
RETURN(-EINVAL);
}
- lmv->bufsize = sizeof(struct lmv_tgt_desc) * desc->ld_tgt_count;
- OBD_ALLOC(lmv->tgts, lmv->bufsize);
+ lmv->tgts_size = sizeof(struct lmv_tgt_desc) * desc->ld_tgt_count;
+ OBD_ALLOC(lmv->tgts, lmv->tgts_size);
if (lmv->tgts == NULL) {
CERROR("Out of memory\n");
RETURN(-ENOMEM);
lmv->max_cookiesize = 0;
- lmv->max_easize = sizeof(struct ll_fid) *
+ lmv->max_easize = sizeof(struct lustre_id) *
desc->ld_tgt_count + sizeof(struct mea);
rc = lmv_setup_mgr(obd);
if (rc) {
CERROR("Can't setup LMV object manager, "
"error %d.\n", rc);
- OBD_FREE(lmv->tgts, lmv->bufsize);
+ OBD_FREE(lmv->tgts, lmv->tgts_size);
}
tgt_obd = class_find_client_obd(&lmv->tgts->uuid, LUSTRE_MDC_NAME,
RETURN(rc);
}
+static int lmv_cleanup(struct obd_device *obd, int flags)
+{
+ struct lmv_obd *lmv = &obd->u.lmv;
+ ENTRY;
+
+ lmv_cleanup_mgr(obd);
+ OBD_FREE(lmv->tgts, lmv->tgts_size);
+
+ RETURN(0);
+}
+
static int lmv_statfs(struct obd_device *obd, struct obd_statfs *osfs,
unsigned long max_age)
{
RETURN(rc);
}
-static int lmv_cleanup(struct obd_device *obd, int flags)
-{
- struct lmv_obd *lmv = &obd->u.lmv;
- ENTRY;
- lmv_cleanup_mgr(obd);
- OBD_FREE(lmv->tgts, lmv->bufsize);
- RETURN(0);
-}
-
-static int lmv_getstatus(struct obd_export *exp, struct ll_fid *fid)
+static int lmv_getstatus(struct obd_export *exp, struct lustre_id *id)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
int rc;
ENTRY;
+
rc = lmv_check_connect(obd);
if (rc)
RETURN(rc);
- rc = md_getstatus(lmv->tgts[0].ltd_exp, fid);
- fid->mds = 0;
+
+ rc = md_getstatus(lmv->tgts[0].ltd_exp, id);
+ id_group(id) = 0;
+
RETURN(rc);
}
-static int lmv_getattr(struct obd_export *exp, struct ll_fid *fid,
+static int lmv_getattr(struct obd_export *exp, struct lustre_id *id,
unsigned long valid, unsigned int ea_size,
struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
- int rc, i = fid->mds;
+ int rc, i = id_group(id);
struct lmv_obj *obj;
ENTRY;
LASSERT(i < lmv->desc.ld_tgt_count);
- rc = md_getattr(lmv->tgts[i].ltd_exp, fid, valid,
+ rc = md_getattr(lmv->tgts[i].ltd_exp, id, valid,
ea_size, request);
if (rc)
RETURN(rc);
- obj = lmv_grab_obj(obd, fid);
+ obj = lmv_grab_obj(obd, id);
- CDEBUG(D_OTHER, "GETATTR for %lu/%lu/%lu %s\n",
- (unsigned long)fid->mds, (unsigned long)fid->id,
- (unsigned long)fid->generation, obj ? "(splitted)" : "");
+ CDEBUG(D_OTHER, "GETATTR for "DLID4" %s\n",
+ OLID4(id), obj ? "(splitted)" : "");
/* if object is splitted, then we loop over all the slaves and gather
* size attribute. In ideal world we would have to gather also mds field
}
/* skip master obj. */
- if (fid_equal(&obj->fid, &obj->objs[i].fid))
+ if (id_equal_fid(&obj->id, &obj->objs[i].id))
continue;
body->size += obj->objs[i].size;
RETURN(rc);
}
-static int lmv_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
- ldlm_iterator_t it, void *data)
+static int lmv_change_cbdata(struct obd_export *exp,
+ struct lustre_id *id,
+ ldlm_iterator_t it,
+ void *data)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
if (rc)
RETURN(rc);
- CDEBUG(D_OTHER, "CBDATA for %lu/%lu/%lu\n", (unsigned long)fid->mds,
- (unsigned long)fid->id, (unsigned long)fid->generation);
-
- LASSERT(fid->mds < lmv->desc.ld_tgt_count);
+ CDEBUG(D_OTHER, "CBDATA for "DLID4"\n", OLID4(id));
+ LASSERT(id_group(id) < lmv->desc.ld_tgt_count);
- rc = md_change_cbdata(lmv->tgts[fid->mds].ltd_exp,
- fid, it, data);
+ rc = md_change_cbdata(lmv->tgts[id_group(id)].ltd_exp,
+ id, it, data);
RETURN(rc);
}
-static int lmv_change_cbdata_name(struct obd_export *exp, struct ll_fid *pfid,
- char *name, int len, struct ll_fid *cfid,
- ldlm_iterator_t it, void *data)
+static int lmv_change_cbdata_name(struct obd_export *exp,
+ struct lustre_id *pid,
+ char *name, int len,
+ struct lustre_id *cid,
+ ldlm_iterator_t it,
+ void *data)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
+ struct lustre_id rcid = *cid;
struct lmv_obj *obj;
int rc = 0, mds;
ENTRY;
if (rc)
RETURN(rc);
- LASSERT(pfid->mds < lmv->desc.ld_tgt_count);
- LASSERT(cfid->mds < lmv->desc.ld_tgt_count);
+ LASSERT(id_group(pid) < lmv->desc.ld_tgt_count);
+ LASSERT(id_group(cid) < lmv->desc.ld_tgt_count);
- CDEBUG(D_OTHER, "CBDATA for %lu/%lu/%lu:%*s -> %lu/%lu/%lu\n",
- (unsigned long)pfid->mds, (unsigned long)pfid->id,
- (unsigned long)pfid->generation, len, name,
- (unsigned long)cfid->mds, (unsigned long)cfid->id,
- (unsigned long)cfid->generation);
+ CDEBUG(D_OTHER, "CBDATA for "DLID4":%*s -> "DLID4"\n",
+ OLID4(pid), len, name, OLID4(cid));
/* this is default mds for directory name belongs to. */
- mds = pfid->mds;
- obj = lmv_grab_obj(obd, pfid);
+ mds = id_group(pid);
+ obj = lmv_grab_obj(obd, pid);
if (obj) {
/* directory is splitted. look for right mds for this name. */
mds = raw_name2idx(obj->hashtype, obj->objcount, name, len);
- mds = obj->objs[mds].fid.mds;
+ rcid = obj->objs[mds].id;
+ mds = id_group(&rcid);
lmv_put_obj(obj);
}
- rc = md_change_cbdata(lmv->tgts[mds].ltd_exp, cfid, it, data);
+ rc = md_change_cbdata(lmv->tgts[mds].ltd_exp, &rcid, it, data);
RETURN(rc);
}
-static int lmv_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
+static int lmv_valid_attrs(struct obd_export *exp, struct lustre_id *id)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
int rc = 0;
ENTRY;
+
rc = lmv_check_connect(obd);
if (rc)
RETURN(rc);
- CDEBUG(D_OTHER, "validate %lu/%lu/%lu\n", (unsigned long) fid->mds,
- (unsigned long) fid->id, (unsigned long) fid->generation);
- LASSERT(fid->mds < lmv->desc.ld_tgt_count);
- rc = md_valid_attrs(lmv->tgts[fid->mds].ltd_exp, fid);
+
+ CDEBUG(D_OTHER, "validate "DLID4"\n", OLID4(id));
+ LASSERT(id_group(id) < lmv->desc.ld_tgt_count);
+ rc = md_valid_attrs(lmv->tgts[id_group(id)].ltd_exp, id);
RETURN(rc);
}
int lmv_close(struct obd_export *exp, struct obdo *obdo,
- struct obd_client_handle *och,
- struct ptlrpc_request **request)
+ struct obd_client_handle *och,
+ struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
int rc, i = obdo->o_mds;
ENTRY;
+
rc = lmv_check_connect(obd);
if (rc)
RETURN(rc);
+
LASSERT(i < lmv->desc.ld_tgt_count);
- CDEBUG(D_OTHER, "CLOSE %lu/%lu/%lu\n", (unsigned long) obdo->o_mds,
- (unsigned long) obdo->o_id, (unsigned long) obdo->o_generation);
+ CDEBUG(D_OTHER, "CLOSE %lu/%lu/%lu\n", (unsigned long)obdo->o_mds,
+ (unsigned long)obdo->o_id, (unsigned long)obdo->o_generation);
rc = md_close(lmv->tgts[i].ltd_exp, obdo, och, request);
RETURN(rc);
}
-int lmv_get_mea_and_update_object(struct obd_export *exp, struct ll_fid *fid)
+int lmv_get_mea_and_update_object(struct obd_export *exp,
+ struct lustre_id *id)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA;
- /* time to update mea of parent fid */
- rc = md_getattr(lmv->tgts[fid->mds].ltd_exp, fid,
- valid, mealen, &req);
+ /* time to update mea of parent id */
+ rc = md_getattr(lmv->tgts[id_group(id)].ltd_exp,
+ id, valid, mealen, &req);
if (rc) {
CERROR("md_getattr() failed, error %d\n", rc);
GOTO(cleanup, rc);
if (md.mea == NULL)
GOTO(cleanup, rc = -ENODATA);
- obj = lmv_create_obj(exp, fid, md.mea);
+ obj = lmv_create_obj(exp, id, md.mea);
if (IS_ERR(obj))
rc = PTR_ERR(obj);
RETURN(-EIO);
repeat:
LASSERT(++loop <= 2);
- obj = lmv_grab_obj(obd, &op_data->fid1);
+ obj = lmv_grab_obj(obd, &op_data->id1);
if (obj) {
- mds = raw_name2idx(obj->hashtype, obj->objcount, op_data->name,
- op_data->namelen);
- op_data->fid1 = obj->objs[mds].fid;
+ mds = raw_name2idx(obj->hashtype, obj->objcount,
+ op_data->name, op_data->namelen);
+ op_data->id1 = obj->objs[mds].id;
lmv_put_obj(obj);
}
- CDEBUG(D_OTHER, "CREATE '%*s' on %lu/%lu/%lu\n", op_data->namelen,
- op_data->name, (unsigned long)op_data->fid1.mds,
- (unsigned long)op_data->fid1.id,
- (unsigned long)op_data->fid1.generation);
+ CDEBUG(D_OTHER, "CREATE '%*s' on "DLID4"\n", op_data->namelen,
+ op_data->name, OLID4(&op_data->id1));
- rc = md_create(lmv->tgts[op_data->fid1.mds].ltd_exp, op_data, data,
- datalen, mode, uid, gid, rdev, request);
+ rc = md_create(lmv->tgts[id_group(&op_data->id1)].ltd_exp,
+ op_data, data, datalen, mode, uid, gid, rdev, request);
if (rc == 0) {
if (*request == NULL)
RETURN(rc);
sizeof(*body));
LASSERT(body != NULL);
- CDEBUG(D_OTHER, "created. id = %lu, generation = %lu, "
- "mds = %d\n", (unsigned long)body->fid1.id,
- (unsigned long)body->fid1.generation, op_data->fid1.mds);
+ CDEBUG(D_OTHER, "created. "DLID4"\n", OLID4(&op_data->id1));
- LASSERT(body->valid & OBD_MD_MDS ||
- body->mds == op_data->fid1.mds);
+/* LASSERT(body->valid & OBD_MD_MDS ||
+ body->mds == id_group(&op_data->id1));*/
} else if (rc == -ERESTART) {
/* directory got splitted. time to update local object and
* repeat the request with proper MDS */
- rc = lmv_get_mea_and_update_object(exp, &op_data->fid1);
+ rc = lmv_get_mea_and_update_object(exp, &op_data->id1);
if (rc == 0) {
ptlrpc_req_finished(*request);
goto repeat;
int lmv_enqueue_slaves(struct obd_export *exp, int locktype,
struct lookup_intent *it, int lockmode,
struct mdc_op_data *data, struct lustre_handle *lockh,
- void *lmm, int lmmsize, ldlm_completion_callback cb_completion,
+ void *lmm, int lmmsize, ldlm_completion_callback cb_compl,
ldlm_blocking_callback cb_blocking, void *cb_data)
{
struct obd_device *obd = exp->exp_obd;
LASSERT(mea != NULL);
for (i = 0; i < mea->mea_count; i++) {
memset(&data2, 0, sizeof(data2));
- data2.fid1 = mea->mea_fids[i];
- mds = data2.fid1.mds;
+ data2.id1 = mea->mea_ids[i];
+ mds = id_group(&data2.id1);
if (lmv->tgts[mds].ltd_exp == NULL)
continue;
- rc = md_enqueue(lmv->tgts[mds].ltd_exp, locktype, it, lockmode,
- &data2, lockh + i, lmm, lmmsize, cb_completion,
- cb_blocking, cb_data);
+ rc = md_enqueue(lmv->tgts[mds].ltd_exp, locktype, it,
+ lockmode, &data2, lockh + i, lmm, lmmsize,
+ cb_compl, cb_blocking, cb_data);
- CDEBUG(D_OTHER, "take lock on slave %lu/%lu/%lu -> %d/%d\n",
- (unsigned long)mea->mea_fids[i].mds,
- (unsigned long)mea->mea_fids[i].id,
- (unsigned long)mea->mea_fids[i].generation,
- rc, it->d.lustre.it_status);
+ CDEBUG(D_OTHER, "take lock on slave "DLID4" -> %d/%d\n",
+ OLID4(&mea->mea_ids[i]), rc, it->d.lustre.it_status);
if (rc)
GOTO(cleanup, rc);
if (it->d.lustre.it_data) {
int lmv_enqueue(struct obd_export *exp, int lock_type,
struct lookup_intent *it, int lock_mode,
struct mdc_op_data *data, struct lustre_handle *lockh,
- void *lmm, int lmmsize, ldlm_completion_callback cb_completion,
+ void *lmm, int lmmsize, ldlm_completion_callback cb_compl,
ldlm_blocking_callback cb_blocking, void *cb_data)
{
struct obd_device *obd = exp->exp_obd;
if (rc)
RETURN(rc);
- if (it->it_op == IT_UNLINK) {
+ if (data->mea1 && it->it_op == IT_UNLINK) {
rc = lmv_enqueue_slaves(exp, lock_type, it, lock_mode,
data, lockh, lmm, lmmsize,
- cb_completion, cb_blocking, cb_data);
+ cb_compl, cb_blocking, cb_data);
RETURN(rc);
}
if (data->namelen) {
- obj = lmv_grab_obj(obd, &data->fid1);
+ obj = lmv_grab_obj(obd, &data->id1);
if (obj) {
/* directory is splitted. look for right mds for this
* name */
mds = raw_name2idx(obj->hashtype, obj->objcount,
(char *)data->name, data->namelen);
- data->fid1 = obj->objs[mds].fid;
+ data->id1 = obj->objs[mds].id;
lmv_put_obj(obj);
}
}
- CDEBUG(D_OTHER, "ENQUEUE '%s' on %lu/%lu\n", LL_IT2STR(it),
- (unsigned long)data->fid1.id, (unsigned long)data->fid1.generation);
+ CDEBUG(D_OTHER, "ENQUEUE '%s' on "DLID4"\n", LL_IT2STR(it),
+ OLID4(&data->id1));
- rc = md_enqueue(lmv->tgts[data->fid1.mds].ltd_exp, lock_type, it,
- lock_mode, data, lockh, lmm, lmmsize, cb_completion,
- cb_blocking, cb_data);
-
+ rc = md_enqueue(lmv->tgts[id_group(&data->id1)].ltd_exp,
+ lock_type, it, lock_mode, data, lockh, lmm,
+ lmmsize, cb_compl, cb_blocking, cb_data);
RETURN(rc);
}
-int lmv_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+int lmv_getattr_name(struct obd_export *exp, struct lustre_id *id,
char *filename, int namelen, unsigned long valid,
unsigned int ea_size, struct ptlrpc_request **request)
{
+ int rc, mds = id_group(id), loop = 0;
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
- struct ll_fid rfid = *fid;
- int rc, mds = fid->mds, loop = 0;
+ struct lustre_id rid = *id;
struct mds_body *body;
struct lmv_obj *obj;
+ int fetch_fid_on;
ENTRY;
+
rc = lmv_check_connect(obd);
if (rc)
RETURN(rc);
repeat:
LASSERT(++loop <= 2);
- obj = lmv_grab_obj(obd, fid);
+ obj = lmv_grab_obj(obd, id);
if (obj) {
/* directory is splitted. look for right mds for this name */
- mds = raw_name2idx(obj->hashtype, obj->objcount, filename, namelen - 1);
- rfid = obj->objs[mds].fid;
+ mds = raw_name2idx(obj->hashtype, obj->objcount,
+ filename, namelen - 1);
+ rid = obj->objs[mds].id;
lmv_put_obj(obj);
}
- CDEBUG(D_OTHER, "getattr_name for %*s on %lu/%lu/%lu -> %lu/%lu/%lu\n",
- namelen, filename, (unsigned long)fid->mds,
- (unsigned long)fid->id, (unsigned long)fid->generation,
- (unsigned long)rfid.mds, (unsigned long)rfid.id,
- (unsigned long)rfid.generation);
-
- rc = md_getattr_name(lmv->tgts[rfid.mds].ltd_exp, &rfid, filename,
- namelen, valid, ea_size, request);
+ CDEBUG(D_OTHER, "getattr_name for %*s on "DLID4" -> "DLID4"\n",
+ namelen, filename, OLID4(id), OLID4(&rid));
+
+ fetch_fid_on = (valid & OBD_MD_FID);
+
+ /*
+ * here should be applied OBD_MD_FID to ->valid, because otherwise,
+ * mds_getattr_name() will not fetch fid component of lustre_id and
+ * thus, next call to md_getattr_name() will be performed to wrong mds.
+ */
+ if (!fetch_fid_on)
+ valid |= OBD_MD_FID;
+
+ rc = md_getattr_name(lmv->tgts[id_group(&rid)].ltd_exp,
+ &rid, filename, namelen, valid,
+ ea_size, request);
if (rc == 0) {
- /* this could be cross-node reference. in this case all we have
- * right now is mds/ino/generation triple. we'd like to find
- * other attributes */
+ /*
+ * this could be cross-node reference. in this case all we have
+ * right now is lustre_id triple. we'd like to find other
+ * attributes.
+ */
body = lustre_msg_buf((*request)->rq_repmsg, 0, sizeof(*body));
LASSERT(body != NULL);
if (body->valid & OBD_MD_MDS) {
struct ptlrpc_request *req = NULL;
- rfid = body->fid1;
- CDEBUG(D_OTHER, "request attrs for %lu/%lu/%lu\n",
- (unsigned long) rfid.mds,
- (unsigned long) rfid.id,
- (unsigned long) rfid.generation);
- rc = md_getattr_name(lmv->tgts[rfid.mds].ltd_exp, &rfid,
- NULL, 1, valid, ea_size, &req);
+
+ rid = body->id1;
+ CDEBUG(D_OTHER, "request attrs for "DLID4"\n", OLID4(&rid));
+
+ /*
+ * turning OBD_MD_FID fetching off, as we already have
+ * full lustre_id and do need to fetch fid component
+ * again. This will help to make thing slightly faster.
+ */
+ if (!fetch_fid_on)
+ valid &= ~OBD_MD_FID;
+
+ rc = md_getattr_name(lmv->tgts[id_group(&rid)].ltd_exp,
+ &rid, NULL, 1, valid, ea_size, &req);
ptlrpc_req_finished(*request);
*request = req;
}
} else if (rc == -ERESTART) {
/* directory got splitted. time to update local object and
* repeat the request with proper MDS */
- rc = lmv_get_mea_and_update_object(exp, &rfid);
+ rc = lmv_get_mea_and_update_object(exp, &rid);
if (rc == 0) {
ptlrpc_req_finished(*request);
goto repeat;
RETURN(rc);
}
-
/*
- * llite passes fid of an target inode in data->fid1 and fid of directory in
- * data->fid2
+ * llite passes id of an target inode in data->id1 and id of directory in
+ * data->id2
*/
int lmv_link(struct obd_export *exp, struct mdc_op_data *data,
struct ptlrpc_request **request)
if (data->namelen != 0) {
/* usual link request */
- obj = lmv_grab_obj(obd, &data->fid1);
+ obj = lmv_grab_obj(obd, &data->id1);
if (obj) {
- rc = raw_name2idx(obj->hashtype, obj->objcount, data->name,
- data->namelen);
- data->fid1 = obj->objs[rc].fid;
+ rc = raw_name2idx(obj->hashtype, obj->objcount,
+ data->name, data->namelen);
+ data->id1 = obj->objs[rc].id;
lmv_put_obj(obj);
}
- CDEBUG(D_OTHER,"link %lu/%lu/%lu:%*s to %lu/%lu/%lu mds %lu\n",
- (unsigned long)data->fid2.mds,
- (unsigned long)data->fid2.id,
- (unsigned long)data->fid2.generation,
- data->namelen, data->name,
- (unsigned long)data->fid1.mds,
- (unsigned long)data->fid1.id,
- (unsigned long)data->fid1.generation,
- (unsigned long)data->fid1.mds);
+ CDEBUG(D_OTHER,"link "DLID4":%*s to "DLID4"\n",
+ OLID4(&data->id2), data->namelen, data->name,
+ OLID4(&data->id1));
} else {
- /* request from MDS to acquire i_links for inode by fid1 */
- CDEBUG(D_OTHER, "inc i_nlinks for %lu/%lu/%lu\n",
- (unsigned long)data->fid1.mds,
- (unsigned long)data->fid1.id,
- (unsigned long)data->fid1.generation);
+ /* request from MDS to acquire i_links for inode by id1 */
+ CDEBUG(D_OTHER, "inc i_nlinks for "DLID4"\n",
+ OLID4(&data->id1));
}
- rc = md_link(lmv->tgts[data->fid1.mds].ltd_exp, data, request);
+ rc = md_link(lmv->tgts[id_group(&data->id1)].ltd_exp,
+ data, request);
RETURN(rc);
}
int rc, mds;
ENTRY;
- CDEBUG(D_OTHER, "rename %*s in %lu/%lu/%lu to %*s in %lu/%lu/%lu\n",
- oldlen, old, (unsigned long)data->fid1.mds,
- (unsigned long)data->fid1.id,
- (unsigned long)data->fid1.generation,
- newlen, new, (unsigned long) data->fid2.mds,
- (unsigned long) data->fid2.id,
- (unsigned long) data->fid2.generation);
-
- if (!fid_equal(&data->fid1, &data->fid2))
- CDEBUG(D_OTHER, "cross-node rename %lu/%lu/%lu:%*s to %lu/%lu/%lu:%*s\n",
- (unsigned long)data->fid1.mds,
- (unsigned long)data->fid1.id,
- (unsigned long)data->fid1.generation, oldlen, old,
- (unsigned long)data->fid2.mds,
- (unsigned long)data->fid2.id,
- (unsigned long)data->fid2.generation, newlen, new);
+ CDEBUG(D_OTHER, "rename %*s in "DLID4" to %*s in "DLID4"\n",
+ oldlen, old, OLID4(&data->id1), newlen, new, OLID4(&data->id2));
rc = lmv_check_connect(obd);
if (rc)
RETURN(rc);
if (oldlen == 0) {
- /* MDS with old dir entry is asking another MDS to create name
- * there */
+ /*
+ * MDS with old dir entry is asking another MDS to create name
+ * there.
+ */
CDEBUG(D_OTHER,
- "create %*s(%d/%d) in %lu/%lu/%lu pointing to %lu/%lu/%lu\n",
- newlen, new, oldlen, newlen,
- (unsigned long)data->fid2.mds,
- (unsigned long)data->fid2.id,
- (unsigned long)data->fid2.generation,
- (unsigned long)data->fid1.mds,
- (unsigned long)data->fid1.id,
- (unsigned long)data->fid1.generation);
- mds = data->fid2.mds;
+ "create %*s(%d/%d) in "DLID4" pointing "
+ "to "DLID4"\n", newlen, new, oldlen, newlen,
+ OLID4(&data->id2), OLID4(&data->id1));
+
+ mds = id_group(&data->id2);
+
+ /*
+ * target directory can be splitted, sowe should forward request
+ * to the right MDS.
+ */
+ obj = lmv_grab_obj(obd, &data->id2);
+ if (obj) {
+ mds = raw_name2idx(obj->hashtype, obj->objcount,
+ (char *)new, newlen);
+ data->id2 = obj->objs[mds].id;
+ CDEBUG(D_OTHER, "forward to MDS #%u ("DLID4")\n", mds,
+ OLID4(&data->id2));
+ lmv_put_obj(obj);
+ }
goto request;
}
- obj = lmv_grab_obj(obd, &data->fid1);
+ obj = lmv_grab_obj(obd, &data->id1);
if (obj) {
- /* directory is already splitted, so we have to forward request
- * to the right MDS */
- mds = raw_name2idx(obj->hashtype, obj->objcount, (char *)old, oldlen);
- data->fid1 = obj->objs[mds].fid;
- CDEBUG(D_OTHER, "forward to MDS #%u (%lu/%lu/%lu)\n", mds,
- (unsigned long)obj->objs[mds].fid.mds,
- (unsigned long)obj->objs[mds].fid.id,
- (unsigned long)obj->objs[mds].fid.generation);
+ /*
+ * directory is already splitted, so we have to forward request
+ * to the right MDS.
+ */
+ mds = raw_name2idx(obj->hashtype, obj->objcount,
+ (char *)old, oldlen);
+ data->id1 = obj->objs[mds].id;
+ CDEBUG(D_OTHER, "forward to MDS #%u ("DLID4")\n", mds,
+ OLID4(&data->id1));
lmv_put_obj(obj);
}
- obj = lmv_grab_obj(obd, &data->fid2);
+ obj = lmv_grab_obj(obd, &data->id2);
if (obj) {
- /* directory is already splitted, so we have to forward request
- * to the right MDS */
- mds = raw_name2idx(obj->hashtype, obj->objcount, (char *)new, newlen);
- data->fid2 = obj->objs[mds].fid;
- CDEBUG(D_OTHER, "forward to MDS #%u (%lu/%lu/%lu)\n", mds,
- (unsigned long)obj->objs[mds].fid.mds,
- (unsigned long)obj->objs[mds].fid.id,
- (unsigned long)obj->objs[mds].fid.generation);
+ /*
+ * directory is already splitted, so we have to forward request
+ * to the right MDS.
+ */
+ mds = raw_name2idx(obj->hashtype, obj->objcount,
+ (char *)new, newlen);
+
+ data->id2 = obj->objs[mds].id;
+ CDEBUG(D_OTHER, "forward to MDS #%u ("DLID4")\n", mds,
+ OLID4(&data->id2));
lmv_put_obj(obj);
}
- mds = data->fid1.mds;
+ mds = id_group(&data->id1);
request:
+ if (id_group(&data->id1) != id_group(&data->id2)) {
+ CDEBUG(D_OTHER,"cross-node rename "DLID4"/%*s to "DLID4"/%*s\n",
+ OLID4(&data->id1), oldlen, old, OLID4(&data->id2),
+ newlen, new);
+ }
+
rc = md_rename(lmv->tgts[mds].ltd_exp, data, old, oldlen,
new, newlen, request);
RETURN(rc);
if (rc)
RETURN(rc);
- obj = lmv_grab_obj(obd, &data->fid1);
+ obj = lmv_grab_obj(obd, &data->id1);
- CDEBUG(D_OTHER, "SETATTR for %lu/%lu/%lu, valid 0x%x%s\n",
- (unsigned long)data->fid1.mds, (unsigned long)data->fid1.id,
- (unsigned long)data->fid1.generation, iattr->ia_valid,
- obj ? ", splitted" : "");
+ CDEBUG(D_OTHER, "SETATTR for "DLID4", valid 0x%x%s\n",
+ OLID4(&data->id1), iattr->ia_valid, obj ? ", splitted" : "");
if (obj) {
for (i = 0; i < obj->objcount; i++) {
- data->fid1 = obj->objs[i].fid;
+ data->id1 = obj->objs[i].id;
- rc = md_setattr(lmv->tgts[data->fid1.mds].ltd_exp, data,
- iattr, ea, ealen, ea2, ea2len, &req);
-
- if (fid_equal(&obj->fid, &obj->objs[i].fid)) {
- /* this is master object and this request should
- * be returned back to llite */
+ rc = md_setattr(lmv->tgts[id_group(&data->id1)].ltd_exp,
+ data, iattr, ea, ealen, ea2, ea2len, &req);
+
+ if (id_equal_fid(&obj->id, &obj->objs[i].id)) {
+ /*
+ * this is master object and this request should
+ * be returned back to llite.
+ */
*request = req;
} else {
ptlrpc_req_finished(req);
}
lmv_put_obj(obj);
} else {
- LASSERT(data->fid1.mds < lmv->desc.ld_tgt_count);
- rc = md_setattr(lmv->tgts[data->fid1.mds].ltd_exp, data,
- iattr, ea, ealen, ea2, ea2len, request);
+ LASSERT(id_group(&data->id1) < lmv->desc.ld_tgt_count);
+ rc = md_setattr(lmv->tgts[id_group(&data->id1)].ltd_exp,
+ data, iattr, ea, ealen, ea2, ea2len, request);
if (rc == 0) {
body = lustre_msg_buf((*request)->rq_repmsg, 0,
sizeof(*body));
LASSERT(body != NULL);
- LASSERT(body->mds == data->fid1.mds);
+ LASSERT(id_group(&body->id1) == id_group(&data->id1));
}
}
RETURN(rc);
}
-int lmv_sync(struct obd_export *exp, struct ll_fid *fid,
+int lmv_sync(struct obd_export *exp, struct lustre_id *id,
struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
if (rc)
RETURN(rc);
- rc = md_sync(lmv->tgts[fid->mds].ltd_exp, fid, request);
+ rc = md_sync(lmv->tgts[id_group(id)].ltd_exp,
+ id, request);
RETURN(rc);
}
-int lmv_dirobj_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
+int lmv_dirobj_blocking_ast(struct ldlm_lock *lock,
+ struct ldlm_lock_desc *desc,
void *data, int flag)
{
struct lustre_handle lockh;
obj = lock->l_ast_data;
if (obj) {
CDEBUG(D_OTHER, "cancel %s on "LPU64"/"LPU64
- ", master %u/"LPU64"/%u\n",
+ ", master "DLID4"\n",
lock->l_resource->lr_name.name[3] == 1 ?
- "LOOKUP" : "UPDATE",
+ "LOOKUP" : "UPDATE",
lock->l_resource->lr_name.name[0],
- lock->l_resource->lr_name.name[1], obj->fid.mds,
- obj->fid.id, obj->fid.generation);
+ lock->l_resource->lr_name.name[1],
+ OLID4(&obj->id));
lmv_put_obj(obj);
}
break;
}
}
-int lmv_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
+int lmv_readpage(struct obd_export *exp, struct lustre_id *id,
__u64 offset, struct page *page,
struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
- struct ll_fid rfid = *mdc_fid;
+ struct lustre_id rid = *id;
struct lmv_obj *obj;
int rc, i;
ENTRY;
+#warning "we need well-desgined readdir() implementation"
rc = lmv_check_connect(obd);
if (rc)
RETURN(rc);
- LASSERT(mdc_fid->mds < lmv->desc.ld_tgt_count);
- CDEBUG(D_OTHER, "READPAGE at %llu from %lu/%lu/%lu\n",
- offset, (unsigned long) rfid.mds,
- (unsigned long) rfid.id,
- (unsigned long) rfid.generation);
+ LASSERT(id_group(id) < lmv->desc.ld_tgt_count);
+ CDEBUG(D_OTHER, "READPAGE at %llu from "DLID4"\n",
+ offset, OLID4(&rid));
- obj = lmv_grab_obj(obd, mdc_fid);
+ obj = lmv_grab_obj(obd, id);
if (obj) {
lmv_lock_obj(obj);
break;
offset -= obj->objs[i].size;
}
- rfid = obj->objs[i].fid;
+ rid = obj->objs[i].id;
lmv_unlock_obj(obj);
lmv_put_obj(obj);
- CDEBUG(D_OTHER, "forward to %lu/%lu/%lu with offset %lu\n",
- (unsigned long)rfid.mds, (unsigned long)rfid.id,
- (unsigned long)rfid.generation, (unsigned long)offset);
+ CDEBUG(D_OTHER, "forward to "DLID4" with offset %lu\n",
+ OLID4(&rid), (unsigned long)offset);
}
- rc = md_readpage(lmv->tgts[rfid.mds].ltd_exp, &rfid, offset,
- page, request);
+ rc = md_readpage(lmv->tgts[id_group(&rid)].ltd_exp, &rid,
+ offset, page, request);
- if (rc == 0 && !fid_equal(&rfid, mdc_fid))
+ if (rc == 0 && !id_equal_fid(&rid, id))
/* this page isn't from master object. To avoid "." and ".."
* duplication in directory, we have to remove them from all
* slave objects */
LASSERT(mea != NULL);
for (i = 0; i < mea->mea_count; i++) {
memset(&data2, 0, sizeof(data2));
- data2.fid1 = mea->mea_fids[i];
+ data2.id1 = mea->mea_ids[i];
data2.create_mode = MDS_MODE_DONT_LOCK | S_IFDIR;
- mds = data2.fid1.mds;
+
+ mds = id_group(&data2.id1);
if (lmv->tgts[mds].ltd_exp == NULL)
continue;
rc = md_unlink(lmv->tgts[mds].ltd_exp, &data2, req);
- CDEBUG(D_OTHER, "unlink slave %lu/%lu/%lu -> %d\n",
- (unsigned long) mea->mea_fids[i].mds,
- (unsigned long) mea->mea_fids[i].id,
- (unsigned long) mea->mea_fids[i].generation, rc);
+ CDEBUG(D_OTHER, "unlink slave "DLID4" -> %d\n",
+ OLID4(&mea->mea_ids[i]), rc);
if (*req) {
ptlrpc_req_finished(*req);
*req = NULL;
RETURN(rc);
}
-int lmv_delete_object(struct obd_export *exp, struct ll_fid *fid)
+int lmv_delete_object(struct obd_export *exp, struct lustre_id *id)
{
ENTRY;
- if (!lmv_delete_obj(exp, fid)) {
- CDEBUG(D_OTHER, "Object %lu/%lu/%lu is not found.\n",
- (unsigned long)fid->mds, (unsigned long)fid->id,
- (unsigned long)fid->generation);
+ if (!lmv_delete_obj(exp, id)) {
+ CDEBUG(D_OTHER, "object "DLID4" is not found.\n",
+ OLID4(id));
}
RETURN(0);
} else if (data->namelen != 0) {
struct lmv_obj *obj;
- obj = lmv_grab_obj(obd, &data->fid1);
+ obj = lmv_grab_obj(obd, &data->id1);
if (obj) {
- i = raw_name2idx(obj->hashtype, obj->objcount, data->name,
- data->namelen);
- data->fid1 = obj->objs[i].fid;
+ i = raw_name2idx(obj->hashtype, obj->objcount,
+ data->name, data->namelen);
+ data->id1 = obj->objs[i].id;
lmv_put_obj(obj);
}
- CDEBUG(D_OTHER, "unlink '%*s' in %lu/%lu/%lu -> %u\n",
- data->namelen, data->name,
- (unsigned long) data->fid1.mds,
- (unsigned long) data->fid1.id,
- (unsigned long) data->fid1.generation, i);
+ CDEBUG(D_OTHER, "unlink '%*s' in "DLID4" -> %u\n",
+ data->namelen, data->name, OLID4(&data->id1),
+ i);
} else {
- CDEBUG(D_OTHER, "drop i_nlink on %lu/%lu/%lu\n",
- (unsigned long) data->fid1.mds,
- (unsigned long) data->fid1.id,
- (unsigned long) data->fid1.generation);
+ CDEBUG(D_OTHER, "drop i_nlink on "DLID4"\n",
+ OLID4(&data->id1));
}
- rc = md_unlink(lmv->tgts[data->fid1.mds].ltd_exp, data, request);
+ rc = md_unlink(lmv->tgts[id_group(&data->id1)].ltd_exp,
+ data, request);
RETURN(rc);
}
rc = lmv_check_connect(obd);
if (rc)
RETURN(ERR_PTR(rc));
-#warning "we need well-desgined readdir() implementation to remove this mess"
obd = lmv->tgts[0].ltd_exp->exp_obd;
EXIT;
return obd;
RETURN(rc);
}
+int lmv_getready(struct obd_export *exp)
+{
+ struct obd_device *obd = exp->exp_obd;
+ int rc = 0;
+
+ ENTRY;
+ rc = lmv_check_connect(obd);
+ RETURN(rc);
+}
+
/*
- * to be called from MDS only
+ * to be called from MDS only.
*/
int lmv_obd_create(struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md **ea, struct obd_trans_info *oti)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
+ struct lustre_id mid;
int i, c, rc = 0;
struct mea *mea;
- struct ll_fid mfid;
int lcount;
ENTRY;
if (ea == NULL) {
rc = lmv_obd_create_single(exp, oa, NULL, oti);
+ if (rc)
+ CERROR("Can't create object, rc = %d\n", rc);
RETURN(rc);
}
}
if (*ea == NULL)
- RETURN(-EINVAL);
+ RETURN(-ENOMEM);
}
rc = 0;
- mfid.id = oa->o_id;
- mfid.generation = oa->o_generation;
+ id_ino(&mid) = oa->o_id;
+ id_fid(&mid) = oa->o_fid;
+ id_gen(&mid) = oa->o_generation;
+
mea = (struct mea *)*ea;
if (!mea->mea_count || mea->mea_count > lmv->desc.ld_tgt_count)
mea->mea_count = lmv->desc.ld_tgt_count;
+
+ mea->mea_master = -1;
mea->mea_magic = MEA_MAGIC_ALL_CHARS;
- mea->mea_master = -1;
lcount = lmv->desc.ld_tgt_count;
for (i = 0, c = 0; c < mea->mea_count && i < lcount; i++) {
struct lov_stripe_md obj_md;
if (lmv->tgts[i].ltd_exp == NULL) {
/* this is master MDS */
- mea->mea_fids[c].id = mfid.id;
- mea->mea_fids[c].generation = mfid.generation;
- mea->mea_fids[c].mds = i;
mea->mea_master = i;
+ id_group(&mea->mea_ids[c]) = i;
+ id_ino(&mea->mea_ids[c]) = id_ino(&mid);
+ id_gen(&mea->mea_ids[c]) = id_gen(&mid);
+ id_fid(&mea->mea_ids[c]) = id_fid(&mid);
c++;
continue;
}
/* "master" MDS should always be part of stripped dir, so scan
- for it. */
+ * for it. */
if (mea->mea_master == -1 && c == mea->mea_count - 1)
continue;
- oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLTYPE | OBD_MD_FLMODE
- | OBD_MD_FLUID | OBD_MD_FLGID | OBD_MD_FLID;
+ oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLUID | OBD_MD_FLGID | OBD_MD_FLID;
rc = obd_create(lmv->tgts[c].ltd_exp, oa, &obj_mdp, oti);
if (rc) {
RETURN(rc);
}
- mea->mea_fids[c].id = oa->o_id;
- mea->mea_fids[c].generation = oa->o_generation;
- mea->mea_fids[c].mds = i;
- c++;
CDEBUG(D_OTHER, "dirobj at mds %d: "LPU64"/%u\n",
i, oa->o_id, oa->o_generation);
+
+ /* here after object is created on desired MDS we save its fid
+ * to local mea_ids. */
+ LASSERT(oa->o_fid);
+
+ id_group(&mea->mea_ids[c]) = i;
+ id_ino(&mea->mea_ids[c]) = oa->o_id;
+ id_fid(&mea->mea_ids[c]) = oa->o_fid;
+ id_gen(&mea->mea_ids[c]) = oa->o_generation;
+ c++;
}
LASSERT(c == mea->mea_count);
CDEBUG(D_OTHER, "%d dirobjects created\n", (int) mea->mea_count);
{
struct obd_device *obd;
struct lmv_obd *lmv;
+ int rc = 0;
ENTRY;
obd = class_exp2obd(exp);
if (keylen == 6 && memcmp(key, "mdsize", 6) == 0) {
__u32 *mdsize = val;
*vallen = sizeof(__u32);
- *mdsize = sizeof(struct ll_fid) * lmv->desc.ld_tgt_count
- + sizeof(struct mea);
+ *mdsize = sizeof(struct lustre_id) * lmv->desc.ld_tgt_count
+ + sizeof(struct mea);
RETURN(0);
} else if (keylen == 6 && memcmp(key, "mdsnum", 6) == 0) {
struct obd_uuid *cluuid = &lmv->cluuid;
}
}
LASSERT(0);
+ } else if (keylen == 6 && memcmp(key, "rootid", 6) == 0) {
+ /* getting rootid from first MDS. */
+ rc = obd_get_info(lmv->tgts[0].ltd_exp, keylen, key,
+ vallen, val);
+ RETURN(rc);
+ } else if (keylen >= strlen("lmvdesc") && strcmp(key, "lmvdesc") == 0) {
+ struct lmv_desc *desc_ret = val;
+ *desc_ret = lmv->desc;
+ RETURN(0);
}
CDEBUG(D_IOCTL, "invalid key\n");
int mea_size;
ENTRY;
- mea_size = sizeof(struct ll_fid) *
+ mea_size = sizeof(struct lustre_id) *
lmv->desc.ld_tgt_count + sizeof(struct mea);
if (!lmmp)
RETURN(mea_size);
int mea_size;
ENTRY;
- mea_size = sizeof(struct ll_fid) *
+ mea_size = sizeof(struct lustre_id) *
lmv->desc.ld_tgt_count + sizeof(struct mea);
if (mem_tgt == NULL)
return mea_size;
LASSERT(pgarr != NULL);
LASSERT(oa->o_mds < lmv->desc.ld_tgt_count);
- oa->o_gr = mea->mea_fids[oa->o_mds].generation;
- oa->o_id = mea->mea_fids[oa->o_mds].id;
- oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
- err = obd_brw(rw, lmv->tgts[oa->o_mds].ltd_exp, oa,
- NULL, oa_bufs, pgarr, oti);
+ oa->o_gr = id_gen(&mea->mea_ids[oa->o_mds]);
+ oa->o_id = id_ino(&mea->mea_ids[oa->o_mds]);
+ oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
+
+ err = obd_brw(rw, lmv->tgts[oa->o_mds].ltd_exp,
+ oa, NULL, oa_bufs, pgarr, oti);
RETURN(err);
}
.o_init_ea_size = lmv_init_ea_size,
.o_notify = lmv_notify,
.o_iocontrol = lmv_iocontrol,
+ .o_getready = lmv_getready,
};
struct md_ops lmv_md_ops = {
static LIST_HEAD(lmv_obj_list);
static spinlock_t lmv_obj_list_lock = SPIN_LOCK_UNLOCKED;
-/* creates new obj on passed @fid and @mea. */
+/* creates new obj on passed @id and @mea. */
struct lmv_obj *
-lmv_alloc_obj(struct obd_device *obd, struct ll_fid *fid,
+lmv_alloc_obj(struct obd_device *obd,
+ struct lustre_id *id,
struct mea *mea)
{
int i;
struct lmv_obd *lmv = &obd->u.lmv;
LASSERT(mea->mea_magic == MEA_MAGIC_LAST_CHAR
- || mea->mea_magic == MEA_MAGIC_ALL_CHARS);
+ || mea->mea_magic == MEA_MAGIC_ALL_CHARS);
OBD_ALLOC(obj, sizeof(*obj));
if (!obj)
return NULL;
+ obj->id = *id;
obj->obd = obd;
obj->state = 0;
- obj->fid = *fid;
obj->hashtype = mea->mea_magic;
-
+
init_MUTEX(&obj->guard);
atomic_set(&obj->count, 0);
obj->objcount = mea->mea_count;
memset(obj->objs, 0, obj_size);
- /* put all fids in */
+ /* put all ids in */
for (i = 0; i < mea->mea_count; i++) {
- CDEBUG(D_OTHER, "subobj %lu/%lu/%lu\n",
- (unsigned long)mea->mea_fids[i].mds,
- (unsigned long)mea->mea_fids[i].id,
- (unsigned long)mea->mea_fids[i].generation);
- obj->objs[i].fid = mea->mea_fids[i];
+ CDEBUG(D_OTHER, "subobj "DLID4"\n",
+ OLID4(&mea->mea_ids[i]));
+ obj->objs[i].id = mea->mea_ids[i];
+ LASSERT(id_fid(&obj->objs[i].id));
}
return obj;
return NULL;
}
-/* destroys passed @obj. */
+/* destroy passed @obj. */
void
lmv_free_obj(struct lmv_obj *obj)
{
LASSERT(obj);
if (atomic_dec_and_test(&obj->count)) {
- struct ll_fid *fid = &obj->fid;
- CDEBUG(D_OTHER, "last reference to %lu/%lu/%lu - destroying\n",
- (unsigned long)fid->mds, (unsigned long)fid->id,
- (unsigned long)fid->generation);
+ struct lustre_id *id = &obj->id;
+ CDEBUG(D_OTHER, "last reference to "DLID4" - "
+ "destroying\n", OLID4(id));
__del_obj(obj);
}
}
}
static struct lmv_obj *
-__grab_obj(struct obd_device *obd, struct ll_fid *fid)
+__grab_obj(struct obd_device *obd, struct lustre_id *id)
{
struct lmv_obj *obj;
struct list_head *cur;
if (obj->state & O_FREEING)
continue;
- /* check if this is waht we're looking for. */
- if (fid_equal(&obj->fid, fid))
+ /* check if this is what we're looking for. */
+ if (id_equal_fid(&obj->id, id))
return __get_obj(obj);
}
}
struct lmv_obj *
-lmv_grab_obj(struct obd_device *obd, struct ll_fid *fid)
+lmv_grab_obj(struct obd_device *obd, struct lustre_id *id)
{
struct lmv_obj *obj;
ENTRY;
spin_lock(&lmv_obj_list_lock);
- obj = __grab_obj(obd, fid);
+ obj = __grab_obj(obd, id);
spin_unlock(&lmv_obj_list_lock);
RETURN(obj);
}
-/* looks in objects list for an object that matches passed @fid. If it is not
+/* looks in objects list for an object that matches passed @id. If it is not
* found -- creates it using passed @mea and puts onto list. */
static struct lmv_obj *
-__create_obj(struct obd_device *obd, struct ll_fid *fid, struct mea *mea)
+__create_obj(struct obd_device *obd, struct lustre_id *id, struct mea *mea)
{
struct lmv_obj *new, *obj;
ENTRY;
- obj = lmv_grab_obj(obd, fid);
+ obj = lmv_grab_obj(obd, id);
if (obj)
RETURN(obj);
/* no such object yet, allocate and initialize it. */
- new = lmv_alloc_obj(obd, fid, mea);
+ new = lmv_alloc_obj(obd, id, mea);
if (!new)
RETURN(NULL);
/* check if someone create it already while we were dealing with
* allocating @obj. */
spin_lock(&lmv_obj_list_lock);
- obj = __grab_obj(obd, fid);
+ obj = __grab_obj(obd, id);
if (obj) {
/* someone created it already - put @obj and getting out. */
lmv_free_obj(new);
spin_unlock(&lmv_obj_list_lock);
- CDEBUG(D_OTHER, "new obj in lmv cache: %lu/%lu/%lu\n",
- (unsigned long)fid->mds, (unsigned long)fid->id,
- (unsigned long)fid->generation);
+ CDEBUG(D_OTHER, "new obj in lmv cache: "DLID4"\n",
+ OLID4(id));
RETURN(new);
}
-/* creates object from passed @fid and @mea. If @mea is NULL, it will be
+/* creates object from passed @id and @mea. If @mea is NULL, it will be
* obtained from correct MDT and used for constructing the object. */
struct lmv_obj *
-lmv_create_obj(struct obd_export *exp, struct ll_fid *fid, struct mea *mea)
+lmv_create_obj(struct obd_export *exp, struct lustre_id *id, struct mea *mea)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
int mealen, i, rc;
ENTRY;
- CDEBUG(D_OTHER, "get mea for %lu/%lu/%lu and create lmv obj\n",
- (unsigned long)fid->mds, (unsigned long)fid->id,
- (unsigned long)fid->generation);
+ CDEBUG(D_OTHER, "get mea for "DLID4" and create lmv obj\n",
+ OLID4(id));
if (!mea) {
unsigned long valid;
CDEBUG(D_OTHER, "mea isn't passed in, get it now\n");
mealen = MEA_SIZE_LMV(lmv);
- /* time to update mea of parent fid */
- i = fid->mds;
+ /* time to update mea of parent id */
+ i = id->li_fid.lf_group;
md.mea = NULL;
valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA;
- rc = md_getattr(lmv->tgts[fid->mds].ltd_exp, fid,
- valid, mealen, &req);
+ rc = md_getattr(lmv->tgts[id->li_fid.lf_group].ltd_exp,
+ id, valid, mealen, &req);
if (rc) {
CERROR("md_getattr() failed, error %d\n", rc);
GOTO(cleanup, obj = ERR_PTR(rc));
}
/* got mea, now create obj for it. */
- obj = __create_obj(obd, fid, mea);
+ obj = __create_obj(obd, id, mea);
if (!obj) {
- CERROR("Can't create new object %lu/%lu/%lu\n",
- (unsigned long)fid->mds, (unsigned long)fid->id,
- (unsigned long)fid->generation);
+ CERROR("Can't create new object "DLID4"\n",
+ OLID4(id));
GOTO(cleanup, obj = ERR_PTR(-ENOMEM));
}
cleanup:
RETURN(obj);
}
-/* looks for object with @fid and orders to destroy it. It possible the object
- * will not be destroyed right now, because it is still using by someone. In
- * this case it will be marked as "freeing" and will not be accessible anymore
- * for subsequent callers of lmv_grab_obj(). */
+/* looks for object with @id and orders to destroy it. It is possible the
+ * object will not be destroyed right now, because it is still using by
+ * someone. In this case it will be marked as "freeing" and will not be
+ * accessible anymore for subsequent callers of lmv_grab_obj(). */
int
-lmv_delete_obj(struct obd_export *exp, struct ll_fid *fid)
+lmv_delete_obj(struct obd_export *exp, struct lustre_id *id)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obj *obj;
spin_lock(&lmv_obj_list_lock);
- obj = __grab_obj(obd, fid);
+ obj = __grab_obj(obd, id);
if (obj) {
obj->state |= O_FREEING;
if (atomic_read(&obj->count) > 1)
- CERROR("obj %lu/%lu/%lu has count > 2 (%d)\n",
- (unsigned long) obj->fid.mds,
- (unsigned long) obj->fid.id,
- (unsigned long) obj->fid.generation,
- atomic_read(&obj->count));
+ CERROR("obj "DLID4" has count > 2 (%d)\n",
+ OLID4(&obj->id), atomic_read(&obj->count));
__put_obj(obj);
__put_obj(obj);
rc = 1;
int
lmv_setup_mgr(struct obd_device *obd)
{
- CDEBUG(D_INFO, "LMV object manager setup (%s)\n", obd->obd_uuid.uuid);
+ CDEBUG(D_INFO, "LMV object manager setup (%s)\n",
+ obd->obd_uuid.uuid);
return 0;
}
struct lmv_obj *obj;
struct list_head *cur, *tmp;
- CDEBUG(D_INFO, "LMV object manager cleanup (%s)\n", obd->obd_uuid.uuid);
+ CDEBUG(D_INFO, "LMV object manager cleanup (%s)\n",
+ obd->obd_uuid.uuid);
spin_lock(&lmv_obj_list_lock);
list_for_each_safe(cur, tmp, &lmv_obj_list) {
obj->state |= O_FREEING;
if (atomic_read(&obj->count) > 1)
- CERROR("obj %lu/%lu/%lu has count > 1 (%d)\n",
- (unsigned long) obj->fid.mds,
- (unsigned long) obj->fid.id,
- (unsigned long) obj->fid.generation,
- atomic_read(&obj->count));
+ CERROR("obj "DLID4" has count > 1 (%d)\n",
+ OLID4(&obj->id), atomic_read(&obj->count));
__put_obj(obj);
}
spin_unlock(&lmv_obj_list_lock);
static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
int activate, unsigned long connect_flags)
{
- struct lov_obd *lov = &obd->u.lov;
- struct obd_uuid *tgt_uuid = &tgt->uuid;
- struct obd_device *tgt_obd;
struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
- struct lustre_handle conn = {0, };
+ struct obd_uuid *tgt_uuid = &tgt->uuid;
+
+#ifdef __KERNEL__
struct proc_dir_entry *lov_proc_dir;
+#endif
+ struct lov_obd *lov = &obd->u.lov;
+ struct lustre_handle conn = {0, };
+ struct obd_device *tgt_obd;
int rc;
ENTRY;
tgt->active = 1;
lov->desc.ld_active_tgt_count++;
+#ifdef __KERNEL__
lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
if (lov_proc_dir) {
struct obd_device *osc_obd = class_conn2obd(&conn);
lov_proc_dir = NULL;
}
}
+#endif
RETURN(0);
}
static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
struct obd_uuid *cluuid, unsigned long connect_flags)
{
+#ifdef __KERNEL__
+ struct proc_dir_entry *lov_proc_dir;
+#endif
struct lov_obd *lov = &obd->u.lov;
struct lov_tgt_desc *tgt;
struct obd_export *exp;
- struct proc_dir_entry *lov_proc_dir;
int rc, rc2, i;
ENTRY;
RETURN(0);
}
+#ifdef __KERNEL__
lov_proc_dir = lprocfs_register("target_obds", obd->obd_proc_entry,
NULL, NULL);
if (IS_ERR(lov_proc_dir)) {
obd->obd_type->typ_name, obd->obd_name);
lov_proc_dir = NULL;
}
+#endif
/* connect_flags is the MDS number, save for use in lov_add_obd */
lov->lov_connect_flags = connect_flags;
RETURN (0);
out_disc:
+#ifdef __KERNEL__
if (lov_proc_dir)
lprocfs_remove(lov_proc_dir);
+#endif
while (i-- > 0) {
struct obd_uuid uuid;
static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
int flags)
{
+#ifdef __KERNEL__
struct proc_dir_entry *lov_proc_dir;
+#endif
struct obd_device *osc_obd = class_exp2obd(tgt->ltd_exp);
struct lov_obd *lov = &obd->u.lov;
int rc;
ENTRY;
+#ifdef __KERNEL__
lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
if (lov_proc_dir) {
struct proc_dir_entry *osc_symlink;
osc_obd->obd_name);
}
}
-
+#endif
+
if (obd->obd_no_recov) {
/* Pass it on to our clients.
* XXX This should be an argument to disconnect,
}
obd_register_observer(tgt->ltd_exp->exp_obd, NULL);
-
rc = obd_disconnect(tgt->ltd_exp, flags);
if (rc) {
if (tgt->active) {
static int lov_disconnect(struct obd_export *exp, int flags)
{
struct obd_device *obd = class_exp2obd(exp);
+#ifdef __KERNEL__
+ struct proc_dir_entry *lov_proc_dir;
+#endif
struct lov_obd *lov = &obd->u.lov;
struct lov_tgt_desc *tgt;
- struct proc_dir_entry *lov_proc_dir;
int rc, i;
ENTRY;
if (tgt->ltd_exp)
lov_disconnect_obd(obd, tgt, flags);
}
+
+#ifdef __KERNEL__
lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
if (lov_proc_dir) {
lprocfs_remove(lov_proc_dir);
CERROR("/proc/fs/lustre/%s/%s/target_obds missing.",
obd->obd_type->typ_name, obd->obd_name);
}
-
+#endif
out_local:
rc = class_disconnect(exp, 0);
modulefs_DATA = lvfs$(KMODEXT) fsfilt_$(BACKINGFS)$(KMODEXT) fsfilt_smfs$(KMODEXT)
-sources: fsfilt_$(BACKINGFS).c fsfilt_smfs.c
+sources: fsfilt_$(BACKINGFS).c fsfilt_smfs.c fsfilt_snap_$(BACKINGFS).c
touch sources
fsfilt_extN.c: fsfilt_ext3.c
fsfilt_ldiskfs.c: fsfilt_ext3.c
sed $(strip $(ldiskfs_sed_flags)) $< > $@
+fsfilt_snap_ldiskfs.c: fsfilt_snap_ext3.c
+ sed $(strip $(ldiskfs_sed_flags)) $< > $@
+
endif # MODULES
DIST_SOURCES = fsfilt.c fsfilt_ext3.c fsfilt_smfs.c fsfilt_reiserfs.c \
struct journal_callback cb_jcb; /* jbd private data - MUST BE FIRST */
fsfilt_cb_t cb_func; /* MDS/OBD completion function */
struct obd_device *cb_obd; /* MDS/OBD completion device */
- __u64 cb_last_rcvd; /* MDS/OST last committed operation */
+ __u64 cb_last_num; /* MDS/OST last committed operation */
void *cb_data; /* MDS/OST completion function data */
};
#ifndef EXT3_XATTR_INDEX_TRUSTED /* temporary until we hit l28 kernel */
#define EXT3_XATTR_INDEX_TRUSTED 4
#endif
+
#define XATTR_LUSTRE_MDS_LOV_EA "lov"
+#define XATTR_LUSTRE_MDS_MID_EA "mid"
+#define XATTR_LUSTRE_MDS_SID_EA "sid"
/*
* We don't currently need any additional blocks for rmdir and
RETURN(rc);
}
+static int fsfilt_ext3_set_xattr(struct inode * inode, void *handle, char *name,
+ void *buffer, int buffer_size)
+{
+ int rc = 0;
+
+ lock_kernel();
+
+ rc = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_TRUSTED,
+ name, buffer, buffer_size, 0);
+ unlock_kernel();
+ if (rc)
+ CERROR("set xattr %s from inode %lu: rc %d\n",
+ name, inode->i_ino, rc);
+ return rc;
+}
+
+static int fsfilt_ext3_get_xattr(struct inode *inode, char *name,
+ void *buffer, int buffer_size)
+{
+ int rc = 0;
+
+ lock_kernel();
+
+ rc = ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
+ name, buffer, buffer_size);
+ unlock_kernel();
+
+ if (buffer == NULL)
+ return (rc == -ENODATA) ? 0 : rc;
+ if (rc < 0) {
+ CDEBUG(D_INFO, "error getting EA %s from inode %lu: rc %d\n",
+ name, inode->i_ino, rc);
+ memset(buffer, 0, buffer_size);
+ return (rc == -ENODATA) ? 0 : rc;
+ }
+
+ return rc;
+}
+
static int fsfilt_ext3_set_md(struct inode *inode, void *handle,
void *lmm, int lmm_size)
{
/* keep this when we get rid of OLD_EA (too noisy during conversion) */
if (EXT3_I(inode)->i_file_acl /* || large inode EA flag */)
CWARN("setting EA on %lu/%u again... interesting\n",
- inode->i_ino, inode->i_generation);
+ inode->i_ino, inode->i_generation);
- lock_kernel();
- rc = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_TRUSTED,
- XATTR_LUSTRE_MDS_LOV_EA, lmm, lmm_size, 0);
+ rc = fsfilt_ext3_set_xattr(inode, handle, XATTR_LUSTRE_MDS_LOV_EA,
+ lmm, lmm_size);
+ return rc;
+}
- unlock_kernel();
+/* Must be called with i_sem held */
+static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size)
+{
+ int rc;
- if (rc)
- CERROR("error adding MD data to inode %lu: rc = %d\n",
- inode->i_ino, rc);
+ rc = fsfilt_ext3_get_xattr(inode, XATTR_LUSTRE_MDS_LOV_EA,
+ lmm, lmm_size);
+ return rc;
+}
+
+static int fsfilt_ext3_set_mid(struct inode *inode, void *handle,
+ void *mid, int mid_size)
+{
+ int rc;
+
+ rc = fsfilt_ext3_set_xattr(inode, handle, XATTR_LUSTRE_MDS_MID_EA,
+ mid, mid_size);
return rc;
}
/* Must be called with i_sem held */
-static int fsfilt_ext3_get_md(struct inode *inode, void *lmm, int lmm_size)
+static int fsfilt_ext3_get_mid(struct inode *inode, void *mid, int mid_size)
{
int rc;
- LASSERT(down_trylock(&inode->i_sem) != 0);
- lock_kernel();
+ rc = fsfilt_ext3_get_xattr(inode, XATTR_LUSTRE_MDS_MID_EA,
+ mid, mid_size);
+ return rc;
+}
- rc = ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
- XATTR_LUSTRE_MDS_LOV_EA, lmm, lmm_size);
- unlock_kernel();
+static int fsfilt_ext3_set_sid(struct inode *inode, void *handle,
+ void *sid, int sid_size)
+{
+ int rc;
- /* This gives us the MD size */
- if (lmm == NULL)
- return (rc == -ENODATA) ? 0 : rc;
+ rc = fsfilt_ext3_set_xattr(inode, handle, XATTR_LUSTRE_MDS_SID_EA,
+ sid, sid_size);
+ return rc;
+}
- if (rc < 0) {
- CDEBUG(D_INFO, "error getting EA %d/%s from inode %lu: rc %d\n",
- EXT3_XATTR_INDEX_TRUSTED, XATTR_LUSTRE_MDS_LOV_EA,
- inode->i_ino, rc);
- memset(lmm, 0, lmm_size);
- return (rc == -ENODATA) ? 0 : rc;
- }
+/* Must be called with i_sem held */
+static int fsfilt_ext3_get_sid(struct inode *inode, void *sid, int sid_size)
+{
+ int rc;
+ rc = fsfilt_ext3_get_xattr(inode, XATTR_LUSTRE_MDS_SID_EA,
+ sid, sid_size);
return rc;
}
{
struct fsfilt_cb_data *fcb = (struct fsfilt_cb_data *)jcb;
- fcb->cb_func(fcb->cb_obd, fcb->cb_last_rcvd, fcb->cb_data, error);
+ fcb->cb_func(fcb->cb_obd, fcb->cb_last_num, fcb->cb_data, error);
OBD_SLAB_FREE(fcb, fcb_cache, sizeof *fcb);
atomic_dec(&fcb_cache_count);
static int fsfilt_ext3_add_journal_cb(struct obd_device *obd,
struct super_block *sb,
- __u64 last_rcvd,
- void *handle, fsfilt_cb_t cb_func,
+ __u64 last_num, void *handle,
+ fsfilt_cb_t cb_func,
void *cb_data)
{
struct fsfilt_cb_data *fcb;
atomic_inc(&fcb_cache_count);
fcb->cb_func = cb_func;
fcb->cb_obd = obd;
- fcb->cb_last_rcvd = last_rcvd;
+ fcb->cb_last_num = last_num;
fcb->cb_data = cb_data;
- CDEBUG(D_EXT2, "set callback for last_rcvd: "LPD64"\n", last_rcvd);
+ CDEBUG(D_EXT2, "set callback for last_num: "LPD64"\n", last_num);
+
lock_kernel();
journal_callback_set(handle, fsfilt_ext3_cb_func,
(struct journal_callback *)fcb);
loff_t new_size = inode->i_size;
journal_t *journal;
handle_t *handle;
- int err, block_count = 0, blocksize, size, boffs;
+ int err = 0, block_count = 0, blocksize, size, boffs;
/* Determine how many transaction credits are needed */
blocksize = 1 << inode->i_blkbits;
extern int ext3_del_dir_entry(struct dentry *dentry);
static int fsfilt_ext3_add_dir_entry(struct obd_device *obd,
- struct dentry *parent,
- char *name, int namelen,
- unsigned long ino,
- unsigned long generation,
- unsigned mds)
+ struct dentry *parent,
+ char *name, int namelen,
+ unsigned long ino,
+ unsigned long generation,
+ unsigned long mds,
+ unsigned long fid)
{
#ifdef EXT3_FEATURE_INCOMPAT_MDSNUM
struct dentry *dentry;
(int) PTR_ERR(dentry));
RETURN(PTR_ERR(dentry));
}
- if (dentry->d_inode != NULL) {
+ if (dentry->d_inode != NULL || dentry->d_flags & DCACHE_CROSS_REF) {
CERROR("dentry %*s(0x%p) found\n", dentry->d_name.len,
dentry->d_name.name, dentry);
l_dput(dentry);
dentry->d_inum = ino;
dentry->d_mdsnum = mds;
dentry->d_generation = generation;
+ dentry->d_fid = fid;
lock_kernel();
err = ext3_add_dir_entry(dentry);
unlock_kernel();
#endif
}
-static int fsfilt_ext3_set_xattr(struct inode * inode, void *handle, char *name,
- void *buffer, int buffer_size)
-{
- int rc = 0;
-
- lock_kernel();
-
- rc = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_TRUSTED,
- name, buffer, buffer_size, 0);
- unlock_kernel();
- if (rc)
- CERROR("set xattr %s from inode %lu: rc %d\n",
- name, inode->i_ino, rc);
- return rc;
-}
-
-static int fsfilt_ext3_get_xattr(struct inode *inode, char *name,
- void *buffer, int buffer_size)
-{
- int rc = 0;
-
- lock_kernel();
-
- rc = ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
- name, buffer, buffer_size);
- unlock_kernel();
-
- if (buffer == NULL)
- return (rc == -ENODATA) ? 0 : rc;
- if (rc < 0) {
- CDEBUG(D_INFO, "error getting EA %s from inode %lu: rc %d\n",
- name, inode->i_ino, rc);
- memset(buffer, 0, buffer_size);
- return (rc == -ENODATA) ? 0 : rc;
- }
-
- return rc;
-}
-
/* If fso is NULL, op is FSFILT operation, otherwise op is number of fso
objects. Logs is number of logfiles to update */
static int fsfilt_ext3_get_op_len(int op, struct fsfilt_objinfo *fso, int logs)
}
static struct fsfilt_operations fsfilt_ext3_ops = {
- .fs_type = "ext3",
- .fs_owner = THIS_MODULE,
- .fs_start = fsfilt_ext3_start,
- .fs_brw_start = fsfilt_ext3_brw_start,
- .fs_commit = fsfilt_ext3_commit,
- .fs_commit_async = fsfilt_ext3_commit_async,
- .fs_commit_wait = fsfilt_ext3_commit_wait,
- .fs_setattr = fsfilt_ext3_setattr,
- .fs_iocontrol = fsfilt_ext3_iocontrol,
- .fs_set_md = fsfilt_ext3_set_md,
- .fs_get_md = fsfilt_ext3_get_md,
- .fs_readpage = fsfilt_ext3_readpage,
- .fs_add_journal_cb = fsfilt_ext3_add_journal_cb,
- .fs_statfs = fsfilt_ext3_statfs,
- .fs_sync = fsfilt_ext3_sync,
- .fs_map_inode_pages = fsfilt_ext3_map_inode_pages,
- .fs_prep_san_write = fsfilt_ext3_prep_san_write,
- .fs_write_record = fsfilt_ext3_write_record,
- .fs_read_record = fsfilt_ext3_read_record,
- .fs_setup = fsfilt_ext3_setup,
- .fs_getpage = fsfilt_ext3_getpage,
- .fs_send_bio = fsfilt_ext3_send_bio,
- .fs_set_xattr = fsfilt_ext3_set_xattr,
- .fs_get_xattr = fsfilt_ext3_get_xattr,
- .fs_get_op_len = fsfilt_ext3_get_op_len,
- .fs_add_dir_entry = fsfilt_ext3_add_dir_entry,
- .fs_del_dir_entry = fsfilt_ext3_del_dir_entry,
+ .fs_type = "ext3",
+ .fs_owner = THIS_MODULE,
+ .fs_start = fsfilt_ext3_start,
+ .fs_brw_start = fsfilt_ext3_brw_start,
+ .fs_commit = fsfilt_ext3_commit,
+ .fs_commit_async = fsfilt_ext3_commit_async,
+ .fs_commit_wait = fsfilt_ext3_commit_wait,
+ .fs_setattr = fsfilt_ext3_setattr,
+ .fs_iocontrol = fsfilt_ext3_iocontrol,
+ .fs_set_md = fsfilt_ext3_set_md,
+ .fs_get_md = fsfilt_ext3_get_md,
+ .fs_set_mid = fsfilt_ext3_set_mid,
+ .fs_get_mid = fsfilt_ext3_get_mid,
+ .fs_set_sid = fsfilt_ext3_set_sid,
+ .fs_get_sid = fsfilt_ext3_get_sid,
+ .fs_readpage = fsfilt_ext3_readpage,
+ .fs_add_journal_cb = fsfilt_ext3_add_journal_cb,
+ .fs_statfs = fsfilt_ext3_statfs,
+ .fs_sync = fsfilt_ext3_sync,
+ .fs_map_inode_pages = fsfilt_ext3_map_inode_pages,
+ .fs_prep_san_write = fsfilt_ext3_prep_san_write,
+ .fs_write_record = fsfilt_ext3_write_record,
+ .fs_read_record = fsfilt_ext3_read_record,
+ .fs_setup = fsfilt_ext3_setup,
+ .fs_getpage = fsfilt_ext3_getpage,
+ .fs_send_bio = fsfilt_ext3_send_bio,
+ .fs_set_xattr = fsfilt_ext3_set_xattr,
+ .fs_get_xattr = fsfilt_ext3_get_xattr,
+ .fs_get_op_len = fsfilt_ext3_get_op_len,
+ .fs_add_dir_entry = fsfilt_ext3_add_dir_entry,
+ .fs_del_dir_entry = fsfilt_ext3_del_dir_entry,
.fs_init_extents_ea = fsfilt_ext3_init_extents_ea,
.fs_insert_extents_ea = fsfilt_ext3_insert_extents_ea,
.fs_remove_extents_ea = fsfilt_ext3_remove_extents_ea,
RETURN(rc);
}
-static int fsfilt_smfs_set_md(struct inode *inode, void *handle,
- void *lmm, int lmm_size)
+typedef int (*set_ea_func_t) (struct inode *, void *, void *, int);
+typedef int (*get_ea_func_t) (struct inode *, void *, int);
+
+static int fsfilt_smfs_set_ea(struct inode *inode, void *handle,
+ void *ea, int ea_size,
+ set_ea_func_t set_ea_func)
{
struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
struct inode *cache_inode = NULL;
if (!cache_inode)
RETURN(-ENOENT);
- pre_smfs_inode(inode, cache_inode);
-
- if (!cache_fsfilt->fs_set_md)
+ if (!set_ea_func)
RETURN(-ENOSYS);
+ pre_smfs_inode(inode, cache_inode);
+
down(&cache_inode->i_sem);
- rc = cache_fsfilt->fs_set_md(cache_inode, handle, lmm, lmm_size);
+ rc = set_ea_func(cache_inode, handle, ea, ea_size);
up(&cache_inode->i_sem);
post_smfs_inode(inode, cache_inode);
- smfs_rec_md(inode, lmm, lmm_size);
-
RETURN(rc);
}
-/* Must be called with i_sem held */
-static int fsfilt_smfs_get_md(struct inode *inode, void *lmm, int lmm_size)
+static int fsfilt_smfs_get_ea(struct inode *inode, void *ea,
+ int ea_size, get_ea_func_t get_ea_func)
{
struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
struct inode *cache_inode = NULL;
if (!cache_inode)
RETURN(-ENOENT);
- pre_smfs_inode(inode, cache_inode);
-
- if (!cache_fsfilt->fs_get_md)
+ if (!get_ea_func)
RETURN(-ENOSYS);
+ pre_smfs_inode(inode, cache_inode);
+
down(&cache_inode->i_sem);
- rc = cache_fsfilt->fs_get_md(cache_inode, lmm, lmm_size);
+ rc = get_ea_func(cache_inode, ea, ea_size);
up(&cache_inode->i_sem);
post_smfs_inode(inode, cache_inode);
RETURN(rc);
}
+static int fsfilt_smfs_set_md(struct inode *inode, void *handle,
+ void *lmm, int lmm_size)
+{
+ int rc = 0;
+ struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
+
+ rc = fsfilt_smfs_set_ea(inode, handle, lmm, lmm_size,
+ cache_fsfilt->fs_set_md);
+ if (rc)
+ return rc;
+
+ smfs_rec_md(inode, lmm, lmm_size);
+ return rc;
+}
+
+static int fsfilt_smfs_get_md(struct inode *inode, void *lmm, int
+ lmm_size)
+{
+ struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
+ return fsfilt_smfs_get_ea(inode, lmm, lmm_size,
+ cache_fsfilt->fs_get_md);
+}
+
+static int fsfilt_smfs_set_mid(struct inode *inode, void *handle,
+ void *mid, int mid_size)
+{
+ struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
+ return fsfilt_smfs_set_ea(inode, handle, mid, mid_size,
+ cache_fsfilt->fs_set_mid);
+}
+
+static int fsfilt_smfs_get_mid(struct inode *inode, void *mid,
+ int mid_size)
+{
+ struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
+ return fsfilt_smfs_get_ea(inode, mid, mid_size,
+ cache_fsfilt->fs_get_mid);
+}
+
+static int fsfilt_smfs_set_sid(struct inode *inode, void *handle,
+ void *sid, int sid_size)
+{
+ struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
+ return fsfilt_smfs_set_ea(inode, handle, sid, sid_size,
+ cache_fsfilt->fs_set_sid);
+}
+
+static int fsfilt_smfs_get_sid(struct inode *inode, void *sid,
+ int sid_size)
+{
+ struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
+ return fsfilt_smfs_get_ea(inode, sid, sid_size,
+ cache_fsfilt->fs_get_sid);
+}
+
static int fsfilt_smfs_send_bio(int rw, struct inode *inode, struct kiobuf *bio)
{
struct inode *cache_inode;
.fs_iocontrol = fsfilt_smfs_iocontrol,
.fs_set_md = fsfilt_smfs_set_md,
.fs_get_md = fsfilt_smfs_get_md,
+ .fs_set_mid = fsfilt_smfs_set_mid,
+ .fs_get_mid = fsfilt_smfs_get_mid,
+ .fs_set_sid = fsfilt_smfs_set_sid,
+ .fs_get_sid = fsfilt_smfs_get_sid,
.fs_readpage = fsfilt_smfs_readpage,
.fs_getpage = fsfilt_smfs_getpage,
.fs_add_journal_cb = fsfilt_smfs_add_journal_cb,
.fs_setup = fsfilt_smfs_setup,
.fs_post_setup = fsfilt_smfs_post_setup,
.fs_post_cleanup = fsfilt_smfs_post_cleanup,
- .fs_set_fs_flags = fsfilt_smfs_set_fs_flags,
- .fs_clear_fs_flags = fsfilt_smfs_clear_fs_flags,
- .fs_get_fs_flags = fsfilt_smfs_get_fs_flags,
+ .fs_set_fs_flags = fsfilt_smfs_set_fs_flags,
+ .fs_clear_fs_flags = fsfilt_smfs_clear_fs_flags,
+ .fs_get_fs_flags = fsfilt_smfs_get_fs_flags,
.fs_set_ost_flags = fsfilt_smfs_set_ost_flags,
.fs_set_mds_flags = fsfilt_smfs_set_mds_flags,
.fs_precreate_rec = fsfilt_smfs_precreate_rec,
.fs_write_extents = fsfilt_smfs_write_extents,
.fs_set_snap_item = fsfilt_smfs_set_snap_item,
.fs_do_write_cow = fsfilt_smfs_do_write_cow,
- /* FIXME-UMKA: probably fsfilt_smfs_get_op_len() should be
- * put here too. */
};
static int __init fsfilt_smfs_init(void)
#define SNAP_EA_INO_BLOCK_SIZE(size) (((size)-sizeof(ino_t)*2)/2)
#define SNAP_EA_PARENT_OFFSET(size) (sizeof(ino_t)*2 + SNAP_EA_INO_BLOCK_SIZE((size)))
+#define EXT3_EA_TRANS_BLOCKS EXT3_DATA_TRANS_BLOCKS
+#define EXT3_SETMETA_TRANS_BLOCKS EXT3_DATA_TRANS_BLOCKS
+#define EXT3_NEWINODE_TRANS_BLOCKS 10
+
+#define SNAP_COPYBLOCK_TRANS_BLOCKS (EXT3_DATA_TRANS_BLOCKS)
+#define SNAP_INSERTLIST_TRANS_BLOCKS (2 * EXT3_EA_TRANS_BLOCKS + 1)
+#define SNAP_DELETELIST_TRANS_BLOCKS (2 * EXT3_EA_TRANS_BLOCKS + 2)
+#define SNAP_MIGRATEDATA_TRANS_BLOCKS 2
+#define SNAP_SETIND_TRANS_BLOCKS (SNAP_INSERTLIST_TRANS_BLOCKS + 1)
+#define SNAP_ADDORPHAN_TRANS_BLOCKS 2
+#define SNAP_REMOVEORPHAN_TRANS_BLOCKS 1
+#define SNAP_RESTOREORPHAN_TRANS_BLOCKS (EXT3_EA_TRANS_BLOCKS + \
+ SNAP_DELETELIST_TRANS_BLOCKS + \
+ EXT3_NEWINODE_TRANS_BLOCKS + \
+ 2 * SNAP_MIGRATEDATA_TRANS_BLOCKS)
+#define SNAP_BIGCOPY_TRANS_BLOCKS (2 * EXT3_DATA_TRANS_BLOCKS)
+#define SNAP_CREATEIND_TRANS_BLOCKS (EXT3_NEWINODE_TRANS_BLOCKS + \
+ SNAP_MIGRATEDATA_TRANS_BLOCKS + \
+ SNAP_SETIND_TRANS_BLOCKS + \
+ SNAP_BIGCOPY_TRANS_BLOCKS + 3)
+#define SNAP_MIGRATEBLK_TRANS_BLOCKS 2
+#define SNAP_DESTROY_TRANS_BLOCKS (SNAP_DELETELIST_TRANS_BLOCKS + \
+ EXT3_EA_TRANS_BLOCKS + 2)
+#define SNAP_RESTORE_TRANS_BLOCKS (EXT3_NEWINODE_TRANS_BLOCKS + \
+ 2 * SNAP_MIGRATEDATA_TRANS_BLOCKS + 1)
+
#define EXT3_JOURNAL_START(sb, handle, blocks, rc) \
do { \
journal_t *journal; \
de1 = (struct ext3_dir_entry_2 *)(buf + buf_off);
int rlen, nlen;
- LASSERT(nlen == EXT3_DIR_REC_LEN_DE(de));
-
rlen = le16_to_cpu(de->rec_len);
de->rec_len = cpu_to_le16(nlen);
de1->name_len = strlen(name);
memcpy (de1->name, name, de->name_len);
nlen = EXT3_DIR_REC_LEN_DE(de1);
+ LASSERT(nlen == EXT3_DIR_REC_LEN_DE(de));
RETURN(nlen);
}
LASSERT(lgh_id != NULL);
if (lgh_id->lgl_oid) {
struct dentry *dchild;
- char fidname[LL_FID_NAMELEN];
- int fidlen = 0;
+ char id_name[LL_ID_NAMELEN];
+ int id_len = 0;
down(&ctxt->loc_objects_dir->d_inode->i_sem);
- fidlen = ll_fid2str(fidname, lgh_id->lgl_oid, lgh_id->lgl_ogen);
- dchild = lookup_one_len(fidname, ctxt->loc_objects_dir, fidlen);
+ id_len = ll_id2str(id_name, lgh_id->lgl_oid,
+ lgh_id->lgl_ogen);
+
+ dchild = lookup_one_len(id_name, ctxt->loc_objects_dir,
+ id_len);
if (IS_ERR(dchild)) {
up(&ctxt->loc_objects_dir->d_inode->i_sem);
RETURN((struct file *)dchild);
RETURN(filp);
}
if (!S_ISREG(filp->f_dentry->d_inode->i_mode)) {
- CERROR("%s is not a regular file!: mode = %o\n", fidname,
- filp->f_dentry->d_inode->i_mode);
+ CERROR("%s is not a regular file!: mode = %o\n",
+ id_name, filp->f_dentry->d_inode->i_mode);
filp_close(filp, 0);
up(&ctxt->loc_objects_dir->d_inode->i_sem);
RETURN(ERR_PTR(-ENOENT));
} else {
unsigned int tmpname = ll_insecure_random_int();
- char fidname[LL_FID_NAMELEN];
+ char id_name[LL_ID_NAMELEN];
struct dentry *new_child, *parent;
+ int err, id_len;
void *handle;
- int err, namelen;
- sprintf(fidname, "OBJECTS/%u", tmpname);
- filp = filp_open(fidname, O_CREAT | O_EXCL, 0644);
+ sprintf(id_name, "OBJECTS/%u", tmpname);
+ filp = filp_open(id_name, O_CREAT | O_EXCL, 0644);
if (IS_ERR(filp)) {
rc = PTR_ERR(filp);
if (rc == -EEXIST) {
RETURN(filp);
}
- namelen = ll_fid2str(fidname, filp->f_dentry->d_inode->i_ino,
- filp->f_dentry->d_inode->i_generation);
+ id_len = ll_id2str(id_name, filp->f_dentry->d_inode->i_ino,
+ filp->f_dentry->d_inode->i_generation);
parent = filp->f_dentry->d_parent;
down(&parent->d_inode->i_sem);
- new_child = lookup_one_len(fidname, parent, namelen);
+ new_child = lookup_one_len(id_name, parent, id_len);
if (IS_ERR(new_child)) {
CERROR("getting neg dentry for obj rename: %d\n", rc);
GOTO(out_close, rc = PTR_ERR(new_child));
LASSERT(obd != NULL);
if (lgh_id->lgl_oid) {
- dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, lgh_id->lgl_oid,
- lgh_id->lgl_ogen, lgh_id->lgl_ogr);
+ dchild = obd_lvfs_id2dentry(ctxt->loc_exp, lgh_id->lgl_oid,
+ lgh_id->lgl_ogen, lgh_id->lgl_ogr);
if (IS_ERR(dchild) == -ENOENT) {
OBD_ALLOC(oa, sizeof(*oa));
if (!oa)
CDEBUG(D_HA, "re-create log object "LPX64":0x%x:"LPX64"\n",
lgh_id->lgl_oid, lgh_id->lgl_ogen, lgh_id->lgl_ogr);
- dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, lgh_id->lgl_oid,
- lgh_id->lgl_ogen, lgh_id->lgl_ogr);
+ dchild = obd_lvfs_id2dentry(ctxt->loc_exp, lgh_id->lgl_oid,
+ lgh_id->lgl_ogen, lgh_id->lgl_ogr);
} else if (IS_ERR(dchild)) {
CERROR("error looking up logfile "LPX64":0x%x: rc %d\n",
lgh_id->lgl_oid, lgh_id->lgl_ogen, rc);
if (rc)
GOTO(out_free_oa, rc);
- dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, oa->o_id,
- oa->o_generation, oa->o_gr);
+ dchild = obd_lvfs_id2dentry(ctxt->loc_exp, oa->o_id,
+ oa->o_generation, oa->o_gr);
if (IS_ERR(dchild))
GOTO(out_free_oa, rc = PTR_ERR(dchild));
struct dentry *dentry)
{
struct dentry *new_child;
- char fidname[LL_FID_NAMELEN];
+ char id_name[LL_ID_NAMELEN];
void *handle;
- int namelen, rc = 0, err;
+ int id_len, rc = 0, err;
ENTRY;
- namelen = ll_fid2str(fidname, logid.lgl_oid, logid.lgl_ogen);
+ id_len = ll_id2str(id_name, logid.lgl_oid, logid.lgl_ogen);
down(&ctxt->loc_objects_dir->d_inode->i_sem);
- new_child = lookup_one_len(fidname, ctxt->loc_objects_dir, namelen);
+ new_child = lookup_one_len(id_name, ctxt->loc_objects_dir, id_len);
if (IS_ERR(new_child)) {
CERROR("getting neg dentry for obj rename: %d\n", rc);
GOTO(out, rc = PTR_ERR(new_child));
struct lvfs_run_ctxt saved;
struct dentry *fdentry;
struct inode *parent_inode;
- char fidname[LL_FID_NAMELEN];
+ char id_name[LL_ID_NAMELEN];
void *handle;
- int rc = -EINVAL, err, namelen;
+ int rc = -EINVAL, err, id_len;
ENTRY;
if (ctxt->loc_lvfs_ctxt)
if (!strcmp(fdentry->d_parent->d_name.name, "LOGS")) {
LASSERT(parent_inode == ctxt->loc_logs_dir->d_inode);
- namelen = ll_fid2str(fidname, fdentry->d_inode->i_ino,
- fdentry->d_inode->i_generation);
+ id_len = ll_id2str(id_name, fdentry->d_inode->i_ino,
+ fdentry->d_inode->i_generation);
dget(fdentry);
rc = llog_lvfs_close(loghandle);
if (rc) {
if (!rc) {
down(&ctxt->loc_objects_dir->d_inode->i_sem);
- fdentry = lookup_one_len(fidname, ctxt->loc_objects_dir,
- namelen);
+ fdentry = lookup_one_len(id_name, ctxt->loc_objects_dir,
+ id_len);
if (fdentry == NULL || fdentry->d_inode == NULL) {
- CERROR("destroy non_existent object %s\n", fidname);
+ CERROR("destroy non_existent object %s\n",
+ id_name);
GOTO(out_err, rc = IS_ERR(fdentry) ?
PTR_ERR(fdentry) : -ENOENT);
}
#include <linux/lvfs.h>
-struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *ctxt, __u64 id,
- __u32 gen, __u64 gr, void *data)
+struct dentry *lvfs_id2dentry(struct lvfs_run_ctxt *ctxt, __u64 id,
+ __u32 gen, __u64 gr, void *data)
{
- return ctxt->cb_ops.l_fid2dentry(id, gen, gr, data);
+ return ctxt->cb_ops.l_id2dentry(id, gen, gr, data);
}
-EXPORT_SYMBOL(lvfs_fid2dentry);
+EXPORT_SYMBOL(lvfs_id2dentry);
struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
__u32 flags, const void *lmm, int lmmlen);
void mdc_readdir_pack(struct ptlrpc_request *req, int req_offset,
- __u64 offset, __u32 size, struct ll_fid *mdc_fid);
+ __u64 offset, __u32 size, struct lustre_id *mdc_id);
void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
int valid, struct obd_client_handle *och);
#endif
void mdc_readdir_pack(struct ptlrpc_request *req, int req_offset,
- __u64 offset, __u32 size, struct ll_fid *mdc_fid)
+ __u64 offset, __u32 size, struct lustre_id *mdc_id)
{
struct mds_body *b;
b = lustre_msg_buf(req->rq_reqmsg, req_offset, sizeof (*b));
- b->fid1 = *mdc_fid;
+ b->id1 = *mdc_id;
b->size = offset; /* !! */
b->nlink = size; /* !! */
}
((flags & O_DIRECTORY) ? MDS_OPEN_DIRECTORY : 0) |
0;
}
+
/* packing of MDS records */
void mdc_open_pack(struct lustre_msg *msg, int offset,
struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
/* XXX do something about time, uid, gid */
rec->cr_opcode = REINT_OPEN;
if (op_data != NULL)
- rec->cr_fid = op_data->fid1;
- memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
+ rec->cr_id = op_data->id1;
+ memset(&rec->cr_replayid, 0, sizeof(rec->cr_replayid));
rec->cr_mode = mode;
rec->cr_flags = mds_pack_open_flags(flags);
rec->cr_rdev = rdev;
b->valid = valid;
b->flags = flags;
- b->fid1 = data->fid1;
- b->fid2 = data->fid2;
+ b->id1 = data->id1;
+ b->id2 = data->id2;
if (data->name) {
char *tmp;
tmp = lustre_msg_buf(msg, offset + 1,
struct mds_body *body;
body = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*body));
+ mdc_pack_id(&body->id1, oa->o_id, 0, oa->o_mode, 0, 0);
- mdc_pack_fid(&body->fid1, oa->o_id, 0, oa->o_mode);
memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
if (oa->o_valid & OBD_MD_FLATIME) {
body->atime = oa->o_atime;
#include <linux/obd_class.h>
#include <linux/lustre_mds.h>
#include <linux/lustre_dlm.h>
-//#include <linux/lustre_smfs.h>
-//#include <linux/lustre_snap.h>
#include <linux/lprocfs_status.h>
#include "mdc_internal.h"
}
EXPORT_SYMBOL(it_set_disposition);
-static void mdc_fid2mdc_op_data(struct mdc_op_data *data,
- struct ll_fid *f1, struct ll_fid *f2,
- const char *name, int namelen, int mode)
+static void mdc_id2mdc_data(struct mdc_op_data *data,
+ struct lustre_id *f1,
+ struct lustre_id *f2,
+ const char *name,
+ int namelen, int mode)
{
LASSERT(data);
LASSERT(f1);
- data->fid1 = *f1;
+ data->id1 = *f1;
if (f2)
- data->fid2 = *f2;
- else
- memset(&data->fid2, 0, sizeof(data->fid2));
+ data->id2 = *f2;
+
+ data->valid = 0;
data->name = name;
data->namelen = namelen;
data->create_mode = mode;
"Found existing inode %p/%lu/%u state %lu in lock: "
"setting data to %p/%lu/%u\n", old_inode,
old_inode->i_ino, old_inode->i_generation,
- old_inode->i_state,
- new_inode, new_inode->i_ino, new_inode->i_generation);
+ old_inode->i_state, new_inode, new_inode->i_ino,
+ new_inode->i_generation);
}
#endif
lock->l_ast_data = data;
}
EXPORT_SYMBOL(mdc_set_lock_data);
-int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
+int mdc_change_cbdata(struct obd_export *exp, struct lustre_id *id,
ldlm_iterator_t it, void *data)
{
struct ldlm_res_id res_id = { .name = {0} };
ENTRY;
- res_id.name[0] = fid->id;
- res_id.name[1] = fid->generation;
+ res_id.name[0] = id_fid(id);
+ res_id.name[1] = id_group(id);
- ldlm_change_cbdata(class_exp2obd(exp)->obd_namespace, &res_id, it,
- data);
+ ldlm_change_cbdata(class_exp2obd(exp)->obd_namespace,
+ &res_id, it, data);
EXIT;
return 0;
void *cb_data)
{
struct ptlrpc_request *req;
+ struct ldlm_res_id res_id = {
+ .name = {id_fid(&data->id1), id_group(&data->id1)}
+ };
struct obd_device *obddev = class_exp2obd(exp);
- struct ldlm_res_id res_id =
- { .name = {data->fid1.id, data->fid1.generation} };
ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
struct ldlm_intent *lit;
struct ldlm_request *lockreq;
reply_buffers = 3;
req->rq_replen = lustre_msg_size(3, repsize);
} else if (it->it_op & (IT_GETATTR | IT_LOOKUP | IT_CHDIR)) {
- int valid = OBD_MD_FLNOTOBD | OBD_MD_FLEASIZE;
+ int valid = data->valid | OBD_MD_FLNOTOBD | OBD_MD_FLEASIZE;
reqsize[req_buffers++] = sizeof(struct mds_body);
reqsize[req_buffers++] = data->namelen + 1;
if (it->it_op & IT_GETATTR)
policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
+
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION,
LDLM_ENQUEUE, req_buffers, reqsize, NULL);
/* pack the intended request */
mdc_getattr_pack(req->rq_reqmsg, MDS_REQ_INTENT_REC_OFF,
valid, it->it_flags, data);
+
/* get ready for the reply */
reply_buffers = 3;
req->rq_replen = lustre_msg_size(3, repsize);
* Else, if DISP_LOOKUP_EXECD then d.lustre.it_status is the rc of the
* child lookup.
*/
-int mdc_intent_lock(struct obd_export *exp,
- struct ll_fid *pfid, const char *name, int len,
- void *lmm, int lmmsize, struct ll_fid *cfid,
- struct lookup_intent *it, int lookup_flags,
- struct ptlrpc_request **reqp,
+int mdc_intent_lock(struct obd_export *exp, struct lustre_id *pid,
+ const char *name, int len, void *lmm, int lmmsize,
+ struct lustre_id *cid, struct lookup_intent *it,
+ int lookup_flags, struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking)
{
struct lustre_handle lockh;
struct ptlrpc_request *request;
- int rc = 0;
struct mds_body *mds_body;
struct lustre_handle old_lock;
struct ldlm_lock *lock;
+ int rc = 0;
ENTRY;
LASSERT(it);
- CDEBUG(D_DLMTRACE, "name: %*s in inode "LPU64", intent: %s flags %#o\n",
- len, name, pfid->id, ldlm_it2str(it->it_op), it->it_flags);
+ CDEBUG(D_DLMTRACE, "name: %*s in obj "DLID4", intent: %s flags %#o\n",
+ len, name, OLID4(pid), ldlm_it2str(it->it_op), it->it_flags);
- if (cfid && (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR ||
- it->it_op == IT_CHDIR)) {
+ if (cid && (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR ||
+ it->it_op == IT_CHDIR)) {
/* We could just return 1 immediately, but since we should only
* be called in revalidate_it if we already have a lock, let's
* verify that. */
- struct ldlm_res_id res_id ={.name = {cfid->id,
- cfid->generation}};
+ struct ldlm_res_id res_id = {.name = {id_fid(cid),
+ id_group(cid)}};
struct lustre_handle lockh;
ldlm_policy_data_t policy;
int mode = LCK_PR;
/* For the GETATTR case, ll_revalidate_it issues two separate
- queries - for LOOKUP and for UPDATE lock because if cannot
+ queries - for LOOKUP and for UPDATE lock because it cannot
check them together - we might have those two bits to be
present in two separate granted locks */
- policy.l_inodebits.bits =
- (it->it_op == IT_GETATTR)?MDS_INODELOCK_UPDATE:
- MDS_INODELOCK_LOOKUP;
+ policy.l_inodebits.bits = (it->it_op == IT_GETATTR) ?
+ MDS_INODELOCK_UPDATE: MDS_INODELOCK_LOOKUP;
+
mode = LCK_PR;
rc = ldlm_lock_match(exp->exp_obd->obd_namespace,
LDLM_FL_BLOCK_GRANTED, &res_id,
it->d.lustre.it_lock_mode = mode;
}
- /* Only return failure if it was not GETATTR by cfid
- (from inode_revalidate) */
+ /* Only return failure if it was not GETATTR by cid (from
+ inode_revalidate) */
if (rc || name)
RETURN(rc);
}
* never dropped its reference, so the refcounts are all OK */
if (!it_disposition(it, DISP_ENQ_COMPLETE)) {
struct mdc_op_data op_data;
- mdc_fid2mdc_op_data(&op_data, pfid, cfid, name, len, 0);
+
+ mdc_id2mdc_data(&op_data, pid, cid, name, len, 0);
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ /*
+ * This is optimization. Now fid will not be obtained from
+ * server if client inode already exists. This flag is set in
+ * ll_revalidate_it() if it finds that passed dentry contains
+ * inode.
+ */
+ if (!(it->d.lustre.it_int_flags && LL_IT_EXIST)) {
+#endif
+ /*
+ * if we get inode by name (ll_lookup_it() case), we
+ * always should ask for fid, as we will not be able to
+ * take locks, revalidate dentry, etc. later with
+ * invalid fid in inode.
+ */
+ if (cid == NULL && name != NULL)
+ op_data.valid |= OBD_MD_FID;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ }
+#endif
rc = mdc_enqueue(exp, LDLM_IBITS, it, it_to_lock_mode(it),
&op_data, &lockh, lmm, lmmsize,
ldlm_completion_ast, cb_blocking, NULL);
if (rc < 0)
RETURN(rc);
+
memcpy(&it->d.lustre.it_lock_handle, &lockh, sizeof(lockh));
}
request = *reqp = it->d.lustre.it_data;
LASSERT(request != NULL);
/* If we're doing an IT_OPEN which did not result in an actual
- * successful open, then we need to remove the bit which saves
- * this request for unconditional replay.
+ * successful open, then we need to remove the bit which saves this
+ * request for unconditional replay.
*
* It's important that we do this first! Otherwise we might exit the
- * function without doing so, and try to replay a failed create
- * (bug 3440) */
+ * function without doing so, and try to replay a failed create (bug
+ * 3440) */
if (it->it_op & IT_OPEN) {
if (!it_disposition(it, DISP_OPEN_OPEN) ||
it->d.lustre.it_status != 0) {
RETURN(rc);
mds_body = lustre_msg_buf(request->rq_repmsg, 1, sizeof(*mds_body));
- LASSERT(mds_body != NULL); /* mdc_enqueue checked */
+ LASSERT(mds_body != NULL); /* mdc_enqueue checked */
LASSERT_REPSWABBED(request, 1); /* mdc_enqueue swabbed */
- /* If we were revalidating a fid/name pair, mark the intent in
- * case we fail and get called again from lookup */
- if (cfid != NULL) {
+ /* If we were revalidating a fid/name pair, mark the intent in case we
+ * fail and get called again from lookup */
+ if (cid != NULL) {
it_set_disposition(it, DISP_ENQ_COMPLETE);
/* Also: did we find the same inode? */
- /* we have to compare all the fields but type, because
- * MDS can return mds/ino/generation triple if inode
- * lives on another MDS -bzzz */
- if (cfid->generation != mds_body->fid1.generation ||
- cfid->id != mds_body->fid1.id ||
- cfid->mds != mds_body->fid1.mds)
+
+ /* we have to compare all the fields but type, because MDS can
+ * return fid/mds/ino/gen if inode lives on another MDS -bzzz */
+ if (!id_equal(cid, &mds_body->id1))
RETURN(-ESTALE);
}
if (rc)
RETURN(rc);
- /* keep requests around for the multiple phases of the call
- * this shows the DISP_XX must guarantee we make it into the call
+ /*
+ * keep requests around for the multiple phases of the call this shows
+ * the DISP_XX must guarantee we make it into the call.
*/
if (it_disposition(it, DISP_OPEN_CREATE) &&
!it_open_error(DISP_OPEN_CREATE, it))
LASSERT(it->it_op & (IT_GETATTR | IT_LOOKUP | IT_CHDIR));
}
- /* If we already have a matching lock, then cancel the new
- * one. We have to set the data here instead of in
- * mdc_enqueue, because we need to use the child's inode as
- * the l_ast_data to match, and that's not available until
- * intent_finish has performed the iget().) */
+ /*
+ * if we already have a matching lock, then cancel the new one. We have
+ * to set the data here instead of in mdc_enqueue, because we need to
+ * use the child's inode as the l_ast_data to match, and that's not
+ * available until intent_finish has performed the iget().)
+ */
lock = ldlm_handle2lock(&lockh);
if (lock) {
ldlm_policy_data_t policy = lock->l_policy_data;
LDLM_DEBUG(lock, "matching against this");
LDLM_LOCK_PUT(lock);
+
+ LASSERTF(id_fid(&mds_body->id1) == lock->l_resource->lr_name.name[0] &&
+ id_group(&mds_body->id1) == lock->l_resource->lr_name.name[1],
+ "Invalid lock is returned to client. Lock res_is: %lu/%lu, "
+ "response res_id: %lu/%lu.\n",
+ (unsigned long)lock->l_resource->lr_name.name[0],
+ (unsigned long)lock->l_resource->lr_name.name[1],
+ (unsigned long)id_fid(&mds_body->id1),
+ (unsigned long)id_group(&mds_body->id1));
+
memcpy(&old_lock, &lockh, sizeof(lockh));
if (ldlm_lock_match(NULL, LDLM_FL_BLOCK_GRANTED, NULL,
LDLM_IBITS, &policy, LCK_NL, &old_lock)) {
#include <linux/lustre_mds.h>
#include "mdc_internal.h"
-/* mdc_setattr does its own semaphore handling */
-int mdc_reint(struct ptlrpc_request *request,
- struct mdc_rpc_lock *rpc_lock, int level)
+/* this function actually sends request to desired target. */
+static int mdc_reint(struct ptlrpc_request *request,
+ struct mdc_rpc_lock *rpc_lock,
+ int level)
{
int rc;
}
return rc;
}
-EXPORT_SYMBOL(mdc_reint);
-/* If mdc_setattr is called with an 'iattr', then it is a normal RPC that
- * should take the normal semaphore and go to the normal portal.
+
+/* If mdc_setattr is called with an 'iattr', then it is a normal RPC that should
+ * take the normal semaphore and go to the normal portal.
*
- * If it is called with iattr->ia_valid & ATTR_FROM_OPEN, then it is a
- * magic open-path setattr that should take the setattr semaphore and
- * go to the setattr portal. */
+ * If it is called with iattr->ia_valid & ATTR_FROM_OPEN, then it is a magic
+ * open-path setattr that should take the setattr semaphore and go to the
+ * setattr portal. */
int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
- struct iattr *iattr, void *ea, int ealen, void *ea2, int ea2len,
- struct ptlrpc_request **request)
+ struct iattr *iattr, void *ea, int ealen, void *ea2,
+ int ea2len, struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
struct mds_rec_setattr *rec;
}
int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
- const void *data, int datalen, int mode, __u32 uid, __u32 gid,
- __u64 rdev, struct ptlrpc_request **request)
+ const void *data, int datalen, int mode, __u32 uid,
+ __u32 gid, __u64 rdev, struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
struct ptlrpc_request *req;
mdc_pack_secdesc(req, size[0]);
- /* mdc_create_pack fills msg->bufs[1] with name
- * and msg->bufs[2] with tgt, for symlinks or lov MD data */
+ /*
+ * mdc_create_pack() fills msg->bufs[1] with name and msg->bufs[2] with
+ * tgt, for symlinks or lov MD data.
+ */
mdc_create_pack(req->rq_reqmsg, 1, op_data, mode, rdev, data, datalen);
size[0] = sizeof(struct mds_body);
level = LUSTRE_IMP_FULL;
resend:
rc = mdc_reint(req, obd->u.cli.cl_rpc_lock, level);
- /* Resend if we were told to. */
+
+ /* resend if we were told to. */
if (rc == -ERESTARTSYS) {
level = LUSTRE_IMP_RECOVER;
goto resend;
int mdc_get_secdesc_size(void)
{
+#ifdef __KERNEL__
int ngroups = current_ngroups;
if (ngroups > LUSTRE_MAX_GROUPS)
ngroups = LUSTRE_MAX_GROUPS;
+
return sizeof(struct mds_req_sec_desc) +
- sizeof(__u32) * ngroups;
+ sizeof(__u32) * ngroups;
+#else
+ return 0;
+#endif
}
/*
- * because group info might have changed since last time
- * we call get_secdesc_size(), so here we did more sanity check
- * to prevent garbage gids
+ * because group info might have changed since last time we call
+ * get_secdesc_size(), so here we did more sanity check to prevent garbage gids
*/
void mdc_pack_secdesc(struct ptlrpc_request *req, int size)
{
+#ifdef __KERNEL__
struct mds_req_sec_desc *rsd;
struct group_info *ginfo;
- rsd = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_SECDESC_OFF, size);
+ rsd = lustre_msg_buf(req->rq_reqmsg,
+ MDS_REQ_SECDESC_OFF, size);
+
rsd->rsd_uid = current->uid;
rsd->rsd_gid = current->gid;
rsd->rsd_fsuid = current->fsuid;
memcpy(rsd->rsd_groups, current->groups,
rsd->rsd_ngroups * sizeof(__u32));
#endif
+#endif
}
extern int mds_queue_req(struct ptlrpc_request *);
/* Helper that implements most of mdc_getstatus and signal_completed_replay. */
/* XXX this should become mdc_get_info("key"), sending MDS_GET_INFO RPC */
-static int send_getstatus(struct obd_import *imp, struct ll_fid *rootfid,
+static int send_getstatus(struct obd_import *imp, struct lustre_id *rootid,
int level, int msg_flags)
{
struct ptlrpc_request *req;
GOTO (out, rc = -EPROTO);
}
- memcpy(rootfid, &body->fid1, sizeof(*rootfid));
+ memcpy(rootid, &body->id1, sizeof(*rootid));
CDEBUG(D_NET, "root ino="LPU64", last_committed="LPU64
- ", last_xid="LPU64"\n",
- rootfid->id, req->rq_repmsg->last_committed,
- req->rq_repmsg->last_xid);
+ ", last_xid="LPU64"\n", rootid->li_stc.u.e3s.l3s_ino,
+ req->rq_repmsg->last_committed, req->rq_repmsg->last_xid);
}
EXIT;
return rc;
}
-/* This should be mdc_get_info("rootfid") */
-int mdc_getstatus(struct obd_export *exp, struct ll_fid *rootfid)
+/* This should be mdc_get_info("rootid") */
+int mdc_getstatus(struct obd_export *exp, struct lustre_id *rootid)
{
- return send_getstatus(class_exp2cliimp(exp), rootfid, LUSTRE_IMP_FULL,
- 0);
+ return send_getstatus(class_exp2cliimp(exp), rootid,
+ LUSTRE_IMP_FULL, 0);
}
int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size,
RETURN (0);
}
-int mdc_getattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
unsigned long valid, unsigned int ea_size,
struct ptlrpc_request **request)
{
mdc_pack_secdesc(req, size[0]);
body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
- memcpy(&body->fid1, fid, sizeof(*fid));
+ memcpy(&body->id1, id, sizeof(*id));
body->valid = valid;
body->eadatasize = ea_size;
RETURN (rc);
}
-int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getattr_name(struct obd_export *exp, struct lustre_id *id,
char *filename, int namelen, unsigned long valid,
unsigned int ea_size, struct ptlrpc_request **request)
{
mdc_pack_secdesc(req, size[0]);
body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
- memcpy(&body->fid1, fid, sizeof(*fid));
+ memcpy(&body->id1, id, sizeof(*id));
body->valid = valid;
body->eadatasize = ea_size;
LASSERT (rec != NULL);
LASSERT (body != NULL);
- memcpy(&rec->cr_replayfid, &body->fid1, sizeof rec->cr_replayfid);
- DEBUG_REQ(D_HA, req, "storing generation %u for ino "LPU64,
- rec->cr_replayfid.generation, rec->cr_replayfid.id);
+ memcpy(&rec->cr_replayid, &body->id1, sizeof(rec->cr_replayid));
+ DEBUG_REQ(D_HA, req, "storing generation for ino "DLID4,
+ OLID4(&rec->cr_replayid));
return 0;
}
struct mea *mea;
int mdsize;
LASSERT(exp_mdc != NULL);
+
/* dir can be non-splitted */
if (md->body->eadatasize == 0)
RETURN(0);
mea = lustre_msg_buf(req->rq_repmsg, offset + 1, mdsize);
LASSERT(mea != NULL);
- rc = obd_unpackmd(exp_mdc, (void *) &md->mea,
- (void *) mea, mdsize);
+ /*
+ * check mea for validness, as there is possible that old tests
+ * will try to set lov EA to dir object and thus confuse this
+ * stuff.
+ */
+ if (mea->mea_magic != MEA_MAGIC_LAST_CHAR &&
+ mea->mea_magic != MEA_MAGIC_ALL_CHARS)
+ GOTO(out_invalid_mea, rc = -EINVAL);
+
+ if (mea->mea_count > 256 || mea->mea_master > 256 ||
+ mea->mea_master > mea->mea_count)
+ GOTO(out_invalid_mea, rc = -EINVAL);
+
+ LASSERT(id_fid(&mea->mea_ids[0]));
+
+ rc = obd_unpackmd(exp_mdc, (void *)&md->mea,
+ (void *)mea, mdsize);
if (rc >= 0) {
LASSERT (rc >= sizeof (*md->mea));
rc = 0;
}
+
+ RETURN(rc);
+
+ out_invalid_mea:
+ CERROR("Detected invalid mea, which does not "
+ "support neither old either new format.\n");
} else {
LASSERT(0);
}
mod->mod_och = och;
mod->mod_open_req = open_req;
- memcpy(&rec->cr_replayfid, &body->fid1, sizeof rec->cr_replayfid);
+ memcpy(&rec->cr_replayid, &body->id1, sizeof rec->cr_replayid);
open_req->rq_replay_cb = mdc_replay_open;
open_req->rq_commit_cb = mdc_commit_open;
open_req->rq_cb_data = mod;
mdc_pack_secdesc(req, size[0]);
- body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof(*body));
- mdc_pack_fid(&body->fid1, obdo->o_id, 0, obdo->o_mode);
+ body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF,
+ sizeof(*body));
+
+ mdc_pack_id(&body->id1, obdo->o_id, 0, obdo->o_mode,
+ obdo->o_mds, obdo->o_fid);
+
body->size = obdo->o_size;
body->blocks = obdo->o_blocks;
body->flags = obdo->o_flags;
body->valid = obdo->o_valid;
-// memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
req->rq_replen = lustre_msg_size(1, &size[1]);
RETURN(rc);
}
-int mdc_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
+int mdc_readpage(struct obd_export *exp,
+ struct lustre_id *id,
__u64 offset, struct page *page,
struct ptlrpc_request **request)
{
int rc, size[2] = {0, sizeof(*body)};
ENTRY;
- CDEBUG(D_INODE, "inode: %ld\n", (long)mdc_fid->id);
+ CDEBUG(D_INODE, "inode: %ld\n", (long)id->li_stc.u.e3s.l3s_ino);
size[0] = mdc_get_secdesc_size();
/* NB req now owns desc and will free it when it gets freed */
ptlrpc_prep_bulk_page(desc, page, 0, PAGE_CACHE_SIZE);
-
- mdc_readdir_pack(req, 1, offset, PAGE_CACHE_SIZE, mdc_fid);
+ mdc_readdir_pack(req, 1, offset, PAGE_CACHE_SIZE, id);
req->rq_replen = lustre_msg_size(1, &size[1]);
rc = ptlrpc_queue_wait(req);
exp->exp_obd->obd_name,
imp->imp_initial_recov);
RETURN(0);
- } else if (keylen >= strlen("mds_num") && strcmp(key, "mds_num") == 0) {
+ } else if (keylen >= strlen("mds_type") && strcmp(key, "mds_type") == 0) {
struct ptlrpc_request *req;
- int rc, size[2] = {keylen, vallen};
char *bufs[2] = {key, val};
+ int rc, size[2] = {keylen, vallen};
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
OST_SET_INFO, 2, size, bufs);
static int mdc_statfs(struct obd_device *obd, struct obd_statfs *osfs,
unsigned long max_age)
{
- struct ptlrpc_request *req;
struct obd_statfs *msfs;
+ struct ptlrpc_request *req;
int rc, size = sizeof(*msfs);
ENTRY;
rc = ptlrpc_queue_wait(req);
mdc_put_rpc_lock(obd->u.cli.cl_rpc_lock, NULL);
- if (rc)
+ if (rc) {
+ /* this can be LMV fake import, whcih is not connected. */
+ if (!req->rq_import->imp_connection)
+ memset(osfs, 0, sizeof(*osfs));
GOTO(out, rc);
+ }
- msfs = lustre_swab_repbuf(req, 0, sizeof(*msfs),lustre_swab_obd_statfs);
+ msfs = lustre_swab_repbuf(req, 0, sizeof(*msfs),
+ lustre_swab_obd_statfs);
if (msfs == NULL) {
CERROR("Can't unpack obd_statfs\n");
GOTO(out, rc = -EPROTO);
EXIT;
out:
ptlrpc_req_finished(req);
-
return rc;
}
//mdc_pack_secdesc(req, size[0]);
- body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof(*body));
- mdc_pack_fid(&body->fid1, ino, gen, type);
+ body = lustre_msg_buf(req->rq_reqmsg,
+ MDS_REQ_REC_OFF, sizeof(*body));
+
+ /* FIXME-UMKA: here should be also mdsnum and fid. */
+ mdc_pack_id(&body->id1, ino, gen, type, 0, 0);
body->flags = flag;
req->rq_replen = lustre_msg_size(1, &size[1]);
RETURN(rc);
}
-int mdc_sync(struct obd_export *exp, struct ll_fid *fid,
+int mdc_sync(struct obd_export *exp, struct lustre_id *id,
struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
//mdc_pack_secdesc(req, size[0]);
- if (fid) {
+ if (id) {
body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF,
sizeof (*body));
- memcpy(&body->fid1, fid, sizeof(*fid));
+ memcpy(&body->id1, id, sizeof(*id));
}
req->rq_replen = lustre_msg_size(1, &size[1]);
}
static int mdc_get_info(struct obd_export *exp, obd_count keylen,
- void *key, __u32 *vallen, void *val)
+ void *key, __u32 *valsize, void *val)
{
+ struct ptlrpc_request *req;
+ char *bufs[1] = {key};
+ int rc = 0;
ENTRY;
- if (!vallen || !val)
+
+ if (!valsize || !val)
RETURN(-EFAULT);
- if (keylen >= strlen("mdsize") && strcmp(key, "mdsize") == 0) {
- struct ptlrpc_request *req;
- __u32 *reply;
- char *bufs[1] = {key};
- int rc;
- req = ptlrpc_prep_req(class_exp2cliimp(exp),
- LUSTRE_OBD_VERSION, OST_GET_INFO,
- 1, &keylen, bufs);
- if (req == NULL)
- RETURN(-ENOMEM);
+ if ((keylen < strlen("mdsize") || strcmp(key, "mdsize") != 0) &&
+ (keylen < strlen("mdsnum") || strcmp(key, "mdsnum") != 0) &&
+ (keylen < strlen("rootid") || strcmp(key, "rootid") != 0))
+ RETURN(-EPROTO);
+
+ req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+ OST_GET_INFO, 1, &keylen, bufs);
+ if (req == NULL)
+ RETURN(-ENOMEM);
- req->rq_replen = lustre_msg_size(1, vallen);
- rc = ptlrpc_queue_wait(req);
- if (rc)
- GOTO(out, rc);
+ req->rq_replen = lustre_msg_size(1, valsize);
+ rc = ptlrpc_queue_wait(req);
+ if (rc)
+ GOTO(out_req, rc);
- /* FIXME: right swap routine here! */
- reply = lustre_swab_repbuf(req, 0, sizeof(*reply), NULL);
+ if (keylen >= strlen("rootid") && !strcmp(key, "rootid")) {
+ struct lustre_id *reply;
+
+ reply = lustre_swab_repbuf(req, 0, sizeof(*reply),
+ lustre_swab_lustre_id);
if (reply == NULL) {
- CERROR("Can't unpack mdsize\n");
- GOTO(out, rc = -EPROTO);
+ CERROR("Can't unpack %s\n", (char *)key);
+ GOTO(out_req, rc = -EPROTO);
+ }
+
+ *(struct lustre_id *)val = *reply;
+ } else {
+ __u32 *reply;
+
+ reply = lustre_swab_repbuf(req, 0, sizeof(*reply),
+ lustre_swab_generic_32s);
+ if (reply == NULL) {
+ CERROR("Can't unpack %s\n", (char *)key);
+ GOTO(out_req, rc = -EPROTO);
}
*((__u32 *)val) = *reply;
- out:
- ptlrpc_req_finished(req);
- RETURN(rc);
}
- RETURN(-EINVAL);
+out_req:
+ ptlrpc_req_finished(req);
+ RETURN(rc);
}
int mdc_obj_create(struct obd_export *exp, struct obdo *oa,
return 0;
}
-static int mdc_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
+static int mdc_valid_attrs(struct obd_export *exp,
+ struct lustre_id *id)
{
struct ldlm_res_id res_id = { .name = {0} };
struct obd_device *obd = exp->exp_obd;
int flags;
ENTRY;
- res_id.name[0] = fid->id;
- res_id.name[1] = fid->generation;
+ res_id.name[0] = id_fid(id);
+ res_id.name[1] = id_group(id);
policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
- CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]);
+ CDEBUG(D_INFO, "trying to match res "LPU64"\n",
+ res_id.name[0]);
/* FIXME use LDLM_FL_TEST_LOCK instead */
flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING;
}
RETURN(0);
}
-static int mdc_change_cbdata_name(struct obd_export *exp, struct ll_fid *pfid,
- char *name, int len, struct ll_fid *cfid,
+
+static int mdc_change_cbdata_name(struct obd_export *exp,
+ struct lustre_id *pid,
+ char *name, int len,
+ struct lustre_id *cid,
ldlm_iterator_t it, void *data)
{
int rc;
- rc = mdc_change_cbdata(exp, cfid, it, data);
+ rc = mdc_change_cbdata(exp, cid, it, data);
RETURN(rc);
}
split = mds_splitting_expected(obd, dentry);
- /* it is important to check here only for MDS_NO_SPLITTABLE.
- * The reason is that MDS_NO_SPLITTABLE means dir is not splittable
- * in principle and another thread will not split it on the quiet.
- * But if we have MDS_NO_SPLIT_EXPECTED, this means, that dir may be
- * splitted anytime, but not now (forcurrent thread) and we should
- * consider that it can happen soon and go that branch which can yield
- * LCK_EX to protect from possible splitting. */
+ /*
+ * it is important to check here only for MDS_NO_SPLITTABLE. The reason
+ * is that MDS_NO_SPLITTABLE means dir is not splittable in principle
+ * and another thread will not split it on the quiet. But if we have
+ * MDS_NO_SPLIT_EXPECTED, this means, that dir may be splitted anytime,
+ * but not now (for current thread) and we should consider that it can
+ * happen soon and go that branch which can yield LCK_EX to protect from
+ * possible splitting.
+ */
if (split == MDS_NO_SPLITTABLE) {
- /* this inode won't be splitted. so we need not to protect from
- * just flush client's cache on modification */
+ /*
+ * this inode won't be splitted. so we need not to protect from
+ * just flush client's cache on modification.
+ */
ret_mode = 0;
if (mode == LCK_PW)
ret_mode = LCK_CW;
if (mode == LCK_PR) {
ret_mode = LCK_CR;
} else if (mode == LCK_PW) {
- /* caller gonna modify directory.we use concurrent
- write lock here to retract client's cache for readdir */
+ /*
+ * caller gonna modify directory.we use concurrent write
+ * lock here to retract client's cache for readdir.
+ */
ret_mode = LCK_CW;
if (split == MDS_EXPECT_SPLIT) {
- /* splitting possible. serialize any access
- * the idea is that first one seen dir is
- * splittable is given exclusive lock and
- * split directory. caller passes lock mode
- * to mds_try_to_split_dir() and splitting
- * would be done with exclusive lock only -bzzz */
- CDEBUG(D_OTHER, "%s: gonna split %u/%u\n",
+ /*
+ * splitting possible. serialize any access the
+ * idea is that first one seen dir is splittable
+ * is given exclusive lock and split
+ * directory. caller passes lock mode to
+ * mds_try_to_split_dir() and splitting would be
+ * done with exclusive lock only -bzzz.
+ */
+ CDEBUG(D_OTHER, "%s: gonna split %lu/%lu\n",
obd->obd_name,
- (unsigned) dentry->d_inode->i_ino,
- (unsigned) dentry->d_inode->i_generation);
+ (unsigned long)dentry->d_inode->i_ino,
+ (unsigned long)dentry->d_inode->i_generation);
ret_mode = LCK_EX;
}
}
}
/* only valid locked dentries or errors should be returned */
-struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid,
- struct vfsmount **mnt, int lock_mode,
- struct lustre_handle *lockh, int *mode,
- char *name, int namelen, __u64 lockpart)
+struct dentry *mds_id2locked_dentry(struct obd_device *obd, struct lustre_id *id,
+ struct vfsmount **mnt, int lock_mode,
+ struct lustre_handle *lockh, int *mode,
+ char *name, int namelen, __u64 lockpart)
{
- struct mds_obd *mds = &obd->u.mds;
- struct dentry *de = mds_fid2dentry(mds, fid, mnt), *retval = de;
+ struct dentry *de = mds_id2dentry(obd, id, mnt), *retval = de;
+ ldlm_policy_data_t policy = { .l_inodebits = { lockpart } };
struct ldlm_res_id res_id = { .name = {0} };
int flags = 0, rc;
- ldlm_policy_data_t policy = { .l_inodebits = { lockpart } };
-
ENTRY;
if (IS_ERR(de))
RETURN(de);
- res_id.name[0] = de->d_inode->i_ino;
- res_id.name[1] = de->d_inode->i_generation;
lockh[1].cookie = 0;
+ res_id.name[0] = id_fid(id);
+ res_id.name[1] = id_group(id);
+
#ifdef S_PDIROPS
if (name && IS_PDIROPS(de->d_inode)) {
ldlm_policy_data_t cpolicy =
res_id.name[2] = full_name_hash(name, namelen);
- CDEBUG(D_INFO, "take lock on %lu:%u:"LPX64"\n",
- de->d_inode->i_ino, de->d_inode->i_generation,
- res_id.name[2]);
+ CDEBUG(D_INFO, "take lock on "DLID4":"LPX64"\n",
+ OLID4(id), res_id.name[2]);
}
#else
#warning "No PDIROPS support in the kernel"
#endif
rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace, res_id,
LDLM_IBITS, &policy, lock_mode, &flags,
- mds_blocking_ast, ldlm_completion_ast, NULL, NULL,
- NULL, 0, NULL, lockh);
+ mds_blocking_ast, ldlm_completion_ast,
+ NULL, NULL, NULL, 0, NULL, lockh);
if (rc != ELDLM_OK) {
l_dput(de);
retval = ERR_PTR(-EIO); /* XXX translate ldlm code */
#endif
-/* Look up an entry by inode number. */
-/* this function ONLY returns valid dget'd dentries with an initialized inode
- or errors */
-struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
- struct vfsmount **mnt)
+/* Look up an entry by inode number. This function ONLY returns valid dget'd
+ * dentries with an initialized inode or errors */
+struct dentry *mds_id2dentry(struct obd_device *obd, struct lustre_id *id,
+ struct vfsmount **mnt)
{
- char fid_name[32];
- unsigned long ino = fid->id;
- __u32 generation = fid->generation;
- struct inode *inode;
+ unsigned long ino = (unsigned long)id_ino(id);
+ __u32 generation = (__u32)id_gen(id);
+ struct mds_obd *mds = &obd->u.mds;
struct dentry *result;
+ struct inode *inode;
+ char idname[32];
if (ino == 0)
RETURN(ERR_PTR(-ESTALE));
-
- snprintf(fid_name, sizeof(fid_name), "0x%lx", ino);
- CDEBUG(D_DENTRY, "--> mds_fid2dentry: ino/gen %lu/%u, sb %p\n",
+ snprintf(idname, sizeof(idname), "0x%lx", ino);
+
+ CDEBUG(D_DENTRY, "--> mds_id2dentry: ino/gen %lu/%u, sb %p\n",
ino, generation, mds->mds_sb);
- /* under ext3 this is neither supposed to return bad inodes
- nor NULL inodes. */
- result = ll_lookup_one_len(fid_name, mds->mds_fid_de, strlen(fid_name));
+ /* under ext3 this is neither supposed to return bad inodes nor NULL
+ inodes. */
+ result = ll_lookup_one_len(idname, mds->mds_id_de,
+ strlen(idname));
if (IS_ERR(result))
RETURN(result);
/* here we disabled generation check, as root inode i_generation
* of cache mds and real mds are different. */
- if (inode->i_ino != mds->mds_rootfid.id && generation &&
- inode->i_generation != generation) {
+ if (inode->i_ino != id_ino(&mds->mds_rootid) && generation &&
+ inode->i_generation != generation) {
/* we didn't find the right inode.. */
- CERROR("bad inode %lu, link: %lu ct: %d or generation %u/%u\n",
+ CERROR("bad inode %lu, link: %lu, ct: %d, generation %u/%u\n",
inode->i_ino, (unsigned long)inode->i_nlink,
atomic_read(&inode->i_count), inode->i_generation,
generation);
/* Establish a connection to the MDS.
*
- * This will set up an export structure for the client to hold state data
- * about that client, like open files, the last operation number it did
- * on the server, etc.
+ * This will set up an export structure for the client to hold state data about
+ * that client, like open files, the last operation number it did on the server,
+ * etc.
*/
static int mds_connect(struct lustre_handle *conn, struct obd_device *obd,
- struct obd_uuid *cluuid, unsigned long connect_flags)
+ struct obd_uuid *cluuid, unsigned long flags)
{
- struct obd_export *exp;
- struct mds_export_data *med; /* */
+ struct mds_export_data *med;
struct mds_client_data *mcd;
+ struct obd_export *exp;
int rc;
ENTRY;
if (!conn || !obd || !cluuid)
RETURN(-EINVAL);
- /* XXX There is a small race between checking the list and adding a
- * new connection for the same UUID, but the real threat (list
- * corruption when multiple different clients connect) is solved.
+ /* XXX There is a small race between checking the list and adding a new
+ * connection for the same UUID, but the real threat (list corruption
+ * when multiple different clients connect) is solved.
*
- * There is a second race between adding the export to the list,
- * and filling in the client data below. Hence skipping the case
- * of NULL mcd above. We should already be controlling multiple
- * connects at the client, and we can't hold the spinlock over
- * memory allocations without risk of deadlocking.
+ * There is a second race between adding the export to the list, and
+ * filling in the client data below. Hence skipping the case of NULL
+ * mcd above. We should already be controlling multiple connects at the
+ * client, and we can't hold the spinlock over memory allocations
+ * without risk of deadlocking.
*/
rc = class_connect(conn, obd, cluuid);
if (rc)
RETURN(rc);
exp = class_conn2export(conn);
- LASSERT(exp);
+
+ LASSERT(exp != NULL);
med = &exp->exp_mds_data;
OBD_ALLOC(mcd, sizeof(*mcd));
if (!mcd) {
- CERROR("mds: out of memory for client data\n");
+ CERROR("%s: out of memory for client data.\n",
+ obd->obd_name);
GOTO(out, rc = -ENOMEM);
}
static int mds_disconnect(struct obd_export *exp, int flags)
{
+ unsigned long irqflags;
struct obd_device *obd;
struct mds_obd *mds;
- unsigned long irqflags;
int rc;
ENTRY;
- LASSERT(exp);
- class_export_get(exp);
-
+ LASSERT(exp != NULL);
obd = class_exp2obd(exp);
if (obd == NULL) {
CDEBUG(D_IOCTL, "invalid client cookie "LPX64"\n",
}
mds = &obd->u.mds;
+ /*
+ * suppress any inter-mds requests durring disconnecting lmv if this is
+ * detected --force mode. This is needed to avoid endless recovery.
+ */
+ if (atomic_read(&mds->mds_real_clients) > 0 &&
+ !(exp->exp_flags & OBD_OPT_REAL_CLIENT))
+ flags |= OBD_OPT_FORCE;
+
if (!(exp->exp_flags & OBD_OPT_REAL_CLIENT)
- && !atomic_read(&mds->mds_real_clients)) {
+ && !atomic_read(&mds->mds_real_clients)) {
/* there was no client at all */
mds_lmv_disconnect(obd, flags);
}
if ((exp->exp_flags & OBD_OPT_REAL_CLIENT)
- && atomic_dec_and_test(&mds->mds_real_clients)) {
+ && atomic_dec_and_test(&mds->mds_real_clients)) {
/* time to drop LMV connections */
CDEBUG(D_OTHER, "%s: last real client %s disconnected. "
"Disconnnect from LMV now\n",
exp->exp_flags = flags;
spin_unlock_irqrestore(&exp->exp_lock, irqflags);
- /* Disconnect early so that clients can't keep using export */
+ /* disconnect early so that clients can't keep using export */
rc = class_disconnect(exp, flags);
ldlm_cancel_locks_for_export(exp);
spin_unlock(&svc->srv_lock);
}
spin_unlock_irqrestore(&exp->exp_lock, irqflags);
-
- class_export_put(exp);
RETURN(rc);
}
{
struct mds_obd *mds = mds_req2mds(req);
struct mds_body *body;
- int rc, size = sizeof(*body);
+ int rc, size;
ENTRY;
+ size = sizeof(*body);
+
rc = lustre_pack_reply(req, 1, &size, NULL);
if (rc || OBD_FAIL_CHECK(OBD_FAIL_MDS_GETSTATUS_PACK)) {
CERROR("mds: out of memory for message: size=%d\n", size);
RETURN(-ENOMEM);
}
- body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
- memcpy(&body->fid1, &mds->mds_rootfid, sizeof(body->fid1));
+ body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
+
+ body->valid |= OBD_MD_FID;
+ memcpy(&body->id1, &mds->mds_rootid, sizeof(body->id1));
- /* the last_committed and last_xid fields are filled in for all
- * replies already - no need to do so here also.
+ /*
+ * the last_committed and last_xid fields are filled in for all replies
+ * already - no need to do so here also.
*/
RETURN(0);
}
/* XXX layering violation! -phil */
l_lock(&lock->l_resource->lr_namespace->ns_lock);
- /* Get this: if mds_blocking_ast is racing with mds_intent_policy,
- * such that mds_blocking_ast is called just before l_i_p takes the
- * ns_lock, then by the time we get the lock, we might not be the
- * correct blocking function anymore. So check, and return early, if
- * so. */
+
+ /*
+ * get this: if mds_blocking_ast is racing with mds_intent_policy, such
+ * that mds_blocking_ast is called just before l_i_p takes the ns_lock,
+ * then by the time we get the lock, we might not be the correct
+ * blocking function anymore. So check, and return early, if so.
+ */
if (lock->l_blocking_ast != mds_blocking_ast) {
l_unlock(&lock->l_resource->lr_namespace->ns_lock);
RETURN(0);
return;
CDEBUG(D_OTHER, "squash req from 0x%llx, (%d:%d/%x)=>(%d:%d/%x)\n",
- *peernid,
- rsd->rsd_fsuid, rsd->rsd_fsgid, rsd->rsd_cap,
+ *peernid, rsd->rsd_fsuid, rsd->rsd_fsgid, rsd->rsd_cap,
mds->mds_squash_uid, mds->mds_squash_gid,
(rsd->rsd_cap & ~CAP_FS_MASK));
rsd->rsd_uid = mds->mds_squash_uid;
rsd->rsd_fsuid = mds->mds_squash_uid;
rsd->rsd_fsgid = mds->mds_squash_gid;
+
/* XXX should we remove all capabilities? */
rsd->rsd_cap &= ~CAP_FS_MASK;
}
static int mds_getattr_internal(struct obd_device *obd, struct dentry *dentry,
- struct ptlrpc_request *req,
- struct mds_body *reqbody, int reply_off)
+ struct ptlrpc_request *req, struct mds_body *reqbody,
+ int reply_off)
{
- struct mds_body *body;
struct inode *inode = dentry->d_inode;
+ struct mds_body *body;
int rc = 0;
ENTRY;
LASSERT(body != NULL); /* caller prepped reply */
if (dentry->d_flags & DCACHE_CROSS_REF) {
- CDEBUG(D_OTHER, "cross reference: %lu/%lu/%lu\n",
- (unsigned long) dentry->d_mdsnum,
- (unsigned long) dentry->d_inum,
- (unsigned long) dentry->d_generation);
- body->valid |= OBD_MD_FLID | OBD_MD_MDS;
- body->fid1.id = dentry->d_inum;
- body->fid1.mds = dentry->d_mdsnum;
- body->fid1.generation = dentry->d_generation;
+ mds_pack_dentry2body(obd, body, dentry,
+ (reqbody->valid & OBD_MD_FID));
+ CDEBUG(D_OTHER, "cross reference: "DLID4"\n",
+ OLID4(&body->id1));
RETURN(0);
}
- mds_pack_inode2fid(obd, &body->fid1, inode);
- mds_pack_inode2body(obd, body, inode);
+
+ mds_pack_inode2body(obd, body, inode, (reqbody->valid & OBD_MD_FID));
if ((S_ISREG(inode->i_mode) && (reqbody->valid & OBD_MD_FLEASIZE)) ||
(S_ISDIR(inode->i_mode) && (reqbody->valid & OBD_MD_FLDIREA))) {
rc = mds_pack_md(obd, req->rq_repmsg, reply_off + 1, body,
inode, 1);
- /* If we have LOV EA data, the OST holds size, atime, mtime */
+ /* if we have LOV EA data, the OST holds size, atime, mtime. */
if (!(body->valid & OBD_MD_FLEASIZE) &&
!(body->valid & OBD_MD_FLDIREA))
body->valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
OBD_MD_FLATIME | OBD_MD_FLMTIME);
} else if (S_ISLNK(inode->i_mode) &&
(reqbody->valid & OBD_MD_LINKNAME) != 0) {
- char *symname = lustre_msg_buf(req->rq_repmsg, reply_off + 1,0);
- int len;
+ int len = req->rq_repmsg->buflens[reply_off + 1];
+ char *symname = lustre_msg_buf(req->rq_repmsg, reply_off + 1, 0);
- LASSERT (symname != NULL); /* caller prepped reply */
- len = req->rq_repmsg->buflens[reply_off + 1];
+ LASSERT(symname != NULL); /* caller prepped reply */
- rc = inode->i_op->readlink(dentry, symname, len);
- if (rc < 0) {
- CERROR("readlink failed: %d\n", rc);
- } else if (rc != len - 1) {
- CERROR ("Unexpected readlink rc %d: expecting %d\n",
- rc, len - 1);
- rc = -EINVAL;
+ if (!inode->i_op->readlink) {
+ rc = -ENOSYS;
} else {
- CDEBUG(D_INODE, "read symlink dest %s\n", symname);
- body->valid |= OBD_MD_LINKNAME;
- body->eadatasize = rc + 1;
- symname[rc] = 0; /* NULL terminate */
- rc = 0;
+ rc = inode->i_op->readlink(dentry, symname, len);
+ if (rc < 0) {
+ CERROR("readlink failed: %d\n", rc);
+ } else if (rc != len - 1) {
+ CERROR("Unexpected readlink rc %d: expecting %d\n",
+ rc, len - 1);
+ rc = -EINVAL;
+ } else {
+ CDEBUG(D_INODE, "read symlink dest %s\n", symname);
+ body->valid |= OBD_MD_LINKNAME;
+ body->eadatasize = rc + 1;
+ symname[rc] = 0;
+ rc = 0;
+ }
}
}
GOTO(out, req->rq_status = rc);
}
- EXIT;
out:
- return(rc);
+ RETURN(rc);
}
static int mds_getattr_pack_msg(struct ptlrpc_request *req, struct inode *inode,
EXIT;
out:
- return(rc);
+ return rc;
}
-int mds_check_mds_num(struct obd_device *obd, struct inode* inode,
+int mds_check_mds_num(struct obd_device *obd, struct inode *inode,
char *name, int namelen)
{
struct mea *mea = NULL;
int mea_size, rc = 0;
ENTRY;
-
+
rc = mds_get_lmv_attr(obd, inode, &mea, &mea_size);
if (rc)
RETURN(rc);
if (mea != NULL) {
- /* dir is already splitted, check if requested filename
- * should live at this MDS or at another one */
- int i;
- i = mea_name2idx(mea, name, namelen - 1);
- if (mea->mea_master != mea->mea_fids[i].mds) {
+ /*
+ * dir is already splitted, check if requested filename should
+ * live at this MDS or at another one.
+ */
+ int i = mea_name2idx(mea, name, namelen - 1);
+ if (mea->mea_master != id_group(&mea->mea_ids[i])) {
CDEBUG(D_OTHER,
- "inapropriate MDS(%d) for %s. should be %d(%d)\n",
- mea->mea_master, name, mea->mea_fids[i].mds, i);
+ "inapropriate MDS(%d) for %s. should be "
+ "%lu(%d)\n", mea->mea_master, name,
+ (unsigned long)id_group(&mea->mea_ids[i]), i);
rc = -ERESTART;
}
}
ENTRY;
LASSERT(!strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME));
-
MDS_UPDATE_COUNTER((&obd->u.mds), MDS_GETATTR_NAME_COUNT);
rsd = lustre_swab_mds_secdesc(req, MDS_REQ_SECDESC_OFF);
}
mds_squash_root(mds, rsd, &req->rq_peer.peer_id.nid);
- /* Swab now, before anyone looks inside the request */
+ /* swab now, before anyone looks inside the request. */
body = lustre_swab_reqbuf(req, offset, sizeof(*body),
lustre_swab_mds_body);
if (body == NULL) {
name = NULL;
LASSERT (offset == 1 || offset == 3);
- /* if requests were at offset 2, the getattr reply goes back at 1 */
if (offset == 3) {
rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
reply_offset = 1;
}
#if 0
#if HAVE_LOOKUP_RAW
- /* FIXME: handle raw lookup */
if (body->valid == OBD_MD_FLID) {
struct mds_body *mds_reply;
int size = sizeof(*mds_reply);
struct inode *dir;
ino_t inum;
- dparent = mds_fid2dentry(mds, &body->fid1, NULL);
+
+ dparent = mds_id2dentry(obd, &body->id1, NULL);
if (IS_ERR(dparent)) {
rc = PTR_ERR(dparent);
GOTO(cleanup, rc);
}
- // The user requested ONLY the inode number, so do a raw lookup
+
+ /*
+ * the user requested ONLY the inode number, so do a raw lookup.
+ */
rc = lustre_pack_reply(req, 1, &size, NULL);
if (rc) {
CERROR("out of memory\n");
l_dput(dparent);
mds_reply = lustre_msg_buf(req->rq_repmsg, 0,
sizeof(*mds_reply));
- mds_reply->fid1.id = inum;
+
+ id_ino(&mds_reply->id1) = inum;
mds_reply->valid = OBD_MD_FLID;
GOTO(cleanup, rc);
}
#endif
#endif
if (resent_req == 0) {
+ LASSERT(id_fid(&body->id1) != 0);
if (name) {
- rc = mds_get_parent_child_locked(obd, mds, &body->fid1,
+ rc = mds_get_parent_child_locked(obd, mds, &body->id1,
parent_lockh, &dparent,
LCK_PR,
MDS_INODELOCK_UPDATE,
name, namesize,
child_lockh, &dchild,
LCK_PR, child_part);
+ if (rc)
+ GOTO(cleanup, rc);
+
+ /*
+ * let's make sure this name should leave on this mds
+ * node.
+ */
+ rc = mds_check_mds_num(obd, dparent->d_inode, name, namesize);
+ if (rc)
+ GOTO(cleanup, rc);
} else {
/* we have no dentry here, drop LOOKUP bit */
- /*FIXME: we need MDS_INODELOCK_LOOKUP or not*/
+ /* FIXME: we need MDS_INODELOCK_LOOKUP or not. */
child_part &= ~MDS_INODELOCK_LOOKUP;
- CDEBUG(D_OTHER, "%s: retrieve attrs for %lu/%lu\n",
- obd->obd_name, (unsigned long) body->fid1.id,
- (unsigned long) body->fid1.generation);
-
-#if 0
- dchild = mds_fid2locked_dentry(obd, &body->fid1, NULL,
- LCK_PR, parent_lockh,
- &update_mode,
- NULL, 0, child_part);
-#else
- dchild = mds_fid2locked_dentry(obd, &body->fid1, NULL,
- LCK_PR, parent_lockh,
- &update_mode,
- NULL, 0,
- MDS_INODELOCK_UPDATE);
-#endif
+ CDEBUG(D_OTHER, "%s: retrieve attrs for "DLID4"\n",
+ obd->obd_name, OLID4(&body->id1));
+
+ dchild = mds_id2locked_dentry(obd, &body->id1, NULL,
+ LCK_PR, parent_lockh,
+ &update_mode,
+ NULL, 0,
+ MDS_INODELOCK_UPDATE);
if (IS_ERR(dchild)) {
- CERROR("can't find inode: %d\n",
- (int) PTR_ERR(dchild));
+ CERROR("can't find inode with id "DLID4", err = %d\n",
+ OLID4(&body->id1), (int)PTR_ERR(dchild));
GOTO(cleanup, rc = PTR_ERR(dchild));
}
- memcpy(child_lockh, parent_lockh,
- sizeof(parent_lockh[0]));
+ memcpy(child_lockh, parent_lockh, sizeof(parent_lockh[0]));
#ifdef S_PDIROPS
if (parent_lockh[1].cookie)
ldlm_lock_decref(parent_lockh + 1, update_mode);
#endif
- cleanup_phase = 2;
- goto fill_inode;
}
- if (rc)
- GOTO(cleanup, rc);
-
- /* let's make sure this name should leave on this mds node */
- rc = mds_check_mds_num(obd, dparent->d_inode, name, namesize);
- if (rc)
- GOTO(cleanup, rc);
} else {
struct ldlm_lock *granted_lock;
- struct ll_fid child_fid;
- struct ldlm_resource *res;
+
DEBUG_REQ(D_DLMTRACE, req, "resent, not enqueuing new locks");
granted_lock = ldlm_handle2lock(child_lockh);
- LASSERTF(granted_lock != NULL, LPU64"/%u lockh "LPX64"\n",
- body->fid1.id, body->fid1.generation,
+ LASSERTF(granted_lock != NULL, LPU64"/%lu lockh "LPX64"\n",
+ id_fid(&body->id1), (unsigned long)id_group(&body->id1),
child_lockh->cookie);
- res = granted_lock->l_resource;
- child_fid.id = res->lr_name.name[0];
- child_fid.generation = res->lr_name.name[1];
- dchild = mds_fid2dentry(mds, &child_fid, NULL);
+ dparent = mds_id2dentry(obd, &body->id1, NULL);
+ LASSERT(dparent);
+
+ dchild = ll_lookup_one_len(name, dparent, namesize - 1);
LASSERT(dchild);
LDLM_LOCK_PUT(granted_lock);
}
cleanup_phase = 2; /* dchild, dparent, locks */
-fill_inode:
-
if (!DENTRY_VALID(dchild)) {
intent_set_disposition(rep, DISP_LOOKUP_NEG);
- /* in the intent case, the policy clears this error:
- the disposition is enough */
+ /*
+ * in the intent case, the policy clears this error: the
+ * disposition is enough.
+ */
rc = -ENOENT;
GOTO(cleanup, rc);
} else {
if (resent_req == 0) {
if (rc && DENTRY_VALID(dchild))
ldlm_lock_decref(child_lockh, LCK_PR);
- if (name) {
+ if (name)
ldlm_lock_decref(parent_lockh, LCK_PR);
- }
#ifdef S_PDIROPS
if (parent_lockh[1].cookie != 0)
ldlm_lock_decref(parent_lockh + 1, update_mode);
case 1:
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
mds_exit_ucred(&uc);
- default: ;
}
return rc;
}
static int mds_getattr(struct ptlrpc_request *req, int offset)
{
- struct mds_obd *mds = mds_req2mds(req);
struct obd_device *obd = req->rq_export->exp_obd;
+ struct mds_obd *mds = &obd->u.mds;
struct lvfs_run_ctxt saved;
struct dentry *de;
struct mds_req_sec_desc *rsd;
RETURN(-EFAULT);
}
- body = lustre_swab_reqbuf(req, offset, sizeof (*body),
+ body = lustre_swab_reqbuf(req, offset, sizeof(*body),
lustre_swab_mds_body);
if (body == NULL) {
CERROR ("Can't unpack body\n");
}
push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
- de = mds_fid2dentry(mds, &body->fid1, NULL);
+ de = mds_id2dentry(obd, &body->id1, NULL);
if (IS_ERR(de)) {
rc = req->rq_status = PTR_ERR(de);
GOTO(out_pop, rc);
out_pop:
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
mds_exit_ucred(&uc);
- return rc;
+ RETURN(rc);
}
static int mds_obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
unsigned long max_age)
{
int rc;
+ ENTRY;
spin_lock(&obd->obd_osfs_lock);
rc = fsfilt_statfs(obd, obd->u.mds.mds_sb, max_age);
memcpy(osfs, &obd->obd_osfs, sizeof(*osfs));
spin_unlock(&obd->obd_osfs_lock);
- return rc;
+ RETURN(rc);
}
static int mds_statfs(struct ptlrpc_request *req)
GOTO(out, rc);
}
- EXIT;
out:
req->rq_status = rc;
- return 0;
+ RETURN(0);
}
static int mds_sync(struct ptlrpc_request *req, int offset)
GOTO(out, rc);
}
- if (body->fid1.id == 0) {
- /* a fid of zero is taken to mean "sync whole filesystem" */
+ if (id_ino(&body->id1) == 0) {
+ /* an id of zero is taken to mean "sync whole filesystem" */
rc = fsfilt_sync(obd, mds->mds_sb);
if (rc)
GOTO(out, rc);
struct file *file = mds->mds_rcvd_filp;
struct dentry *de;
- de = mds_fid2dentry(mds, &body->fid1, NULL);
+ de = mds_id2dentry(obd, &body->id1, NULL);
if (IS_ERR(de))
GOTO(out, rc = PTR_ERR(de));
rc = file->f_op->fsync(NULL, de, 1);
- l_dput(de);
if (rc)
GOTO(out, rc);
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
- mds_pack_inode2fid(obd, &body->fid1, de->d_inode);
- mds_pack_inode2body(obd, body, de->d_inode);
+ mds_pack_inode2body(obd, body, de->d_inode, 0);
+ l_dput(de);
}
out:
req->rq_status = rc;
- return 0;
+ RETURN(0);
}
/* mds_readpage does not take a DLM lock on the inode, because the client must
}
push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
- de = mds_fid2dentry(mds, &body->fid1, &mnt);
+ de = mds_id2dentry(obd, &body->id1, &mnt);
if (IS_ERR(de))
GOTO(out_pop, rc = PTR_ERR(de));
RETURN(0);
}
+/* update master MDS ID, which is stored in local inode EA. */
+int mds_update_mid(struct obd_device *obd, struct lustre_id *id,
+ void *data, int data_len)
+{
+ struct mds_obd *mds = &obd->u.mds;
+ struct dentry *dentry;
+ void *handle;
+ int rc = 0;
+ ENTRY;
+
+ LASSERT(id);
+ LASSERT(obd);
+
+ dentry = mds_id2dentry(obd, id, NULL);
+ if (IS_ERR(dentry))
+ GOTO(out, rc = PTR_ERR(dentry));
+
+ if (!dentry->d_inode) {
+ CERROR("Can't find object "DLID4".\n",
+ OLID4(id));
+ GOTO(out_dentry, rc = -EINVAL);
+ }
+
+ handle = fsfilt_start(obd, dentry->d_inode,
+ FSFILT_OP_SETATTR, NULL);
+ if (IS_ERR(handle))
+ GOTO(out_dentry, rc = PTR_ERR(handle));
+
+ rc = mds_update_inode_mid(obd, dentry->d_inode, handle,
+ (struct lustre_id *)data);
+ if (rc) {
+ CERROR("Can't update inode "DLID4" master id, "
+ "error = %d.\n", OLID4(id), rc);
+ GOTO(out_commit, rc);
+ }
+
+out_commit:
+ fsfilt_commit(obd, mds->mds_sb, dentry->d_inode,
+ handle, 0);
+out_dentry:
+ l_dput(dentry);
+out:
+ RETURN(rc);
+}
+EXPORT_SYMBOL(mds_update_mid);
+
+/* read master MDS ID, which is stored in local inode EA. */
+int mds_read_mid(struct obd_device *obd, struct lustre_id *id,
+ void *data, int data_len)
+{
+ struct dentry *dentry;
+ int rc = 0;
+ ENTRY;
+
+ LASSERT(id);
+ LASSERT(obd);
+
+ dentry = mds_id2dentry(obd, id, NULL);
+ if (IS_ERR(dentry))
+ GOTO(out, rc = PTR_ERR(dentry));
+
+ if (!dentry->d_inode) {
+ CERROR("Can't find object "DLID4".\n",
+ OLID4(id));
+ GOTO(out_dentry, rc = -EINVAL);
+ }
+
+ down(&dentry->d_inode->i_sem);
+ rc = mds_read_inode_mid(obd, dentry->d_inode,
+ (struct lustre_id *)data);
+ up(&dentry->d_inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode "DLID4" master id, "
+ "error = %d.\n", OLID4(id), rc);
+ GOTO(out_dentry, rc);
+ }
+
+out_dentry:
+ l_dput(dentry);
+out:
+ RETURN(rc);
+}
+EXPORT_SYMBOL(mds_read_mid);
+
int mds_reint(struct ptlrpc_request *req, int offset,
struct lustre_handle *lockh)
{
struct mds_obd *mds = &req->rq_export->exp_obd->u.mds;
- struct mds_update_record *rec; /* 116 bytes on the stack? no sir! */
+ struct mds_update_record *rec;
struct mds_req_sec_desc *rsd;
int rc;
ENTRY;
/* rc will be used to interrupt a for loop over multiple records */
rc = mds_reint_rec(rec, offset, req, lockh);
-
mds_exit_ucred(&rec->ur_uc);
out:
OBD_FREE(rec, sizeof(*rec));
[REINT_OPEN] "open",
};
-#define FILTER_VALID_FLAGS (OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLGENER |\
- OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ|\
- OBD_MD_FLATIME | OBD_MD_FLMTIME | OBD_MD_FLCTIME|\
+#define FILTER_VALID_FLAGS (OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLGENER | \
+ OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ| \
+ OBD_MD_FLATIME | OBD_MD_FLMTIME | OBD_MD_FLCTIME| \
OBD_MD_FLID)
static void reconstruct_create(struct ptlrpc_request *req)
{
struct mds_export_data *med = &req->rq_export->exp_mds_data;
- struct mds_obd *mds = &req->rq_export->exp_obd->u.mds;
struct mds_client_data *mcd = med->med_mcd;
struct dentry *dentry;
struct ost_body *body;
- struct ll_fid fid;
+ struct lustre_id id;
+ int rc;
ENTRY;
/* copy rc, transno and disp; steal locks */
return;
}
- fid.mds = 0;
- fid.id = mcd->mcd_last_data;
- fid.generation = 0;
+ id_gen(&id) = 0;
+ id_group(&id) = 0;
- LASSERT(fid.id != 0);
+ id_ino(&id) = mcd->mcd_last_data;
+ LASSERT(id_ino(&id) != 0);
- dentry = mds_fid2dentry(mds, &fid, NULL);
+ dentry = mds_id2dentry(req2obd(req), &id, NULL);
if (IS_ERR(dentry)) {
- CERROR("can't find inode "LPU64"\n", fid.id);
+ CERROR("can't find inode "LPU64"\n", id_ino(&id));
req->rq_status = PTR_ERR(dentry);
EXIT;
return;
}
CWARN("reconstruct reply for x"LPU64" (remote ino) "LPU64" -> %lu/%u\n",
- req->rq_xid, fid.id, dentry->d_inode->i_ino,
+ req->rq_xid, id_ino(&id), dentry->d_inode->i_ino,
dentry->d_inode->i_generation);
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
body->oa.o_id = dentry->d_inode->i_ino;
body->oa.o_generation = dentry->d_inode->i_generation;
body->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGENER;
-
+
+ down(&dentry->d_inode->i_sem);
+ rc = mds_read_inode_sid(req2obd(req), dentry->d_inode, &id);
+ up(&dentry->d_inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, inode %lu, "
+ "rc %d\n", dentry->d_inode->i_ino, rc);
+ id_fid(&id) = 0;
+ }
+
+ body->oa.o_fid = id_fid(&id);
+ body->oa.o_mds = id_group(&id);
l_dput(dentry);
+
EXIT;
- return;
}
static int mdt_obj_create(struct ptlrpc_request *req)
struct obd_device *obd = req->rq_export->exp_obd;
struct mds_obd *mds = &obd->u.mds;
struct ost_body *body, *repbody;
- char fidname[LL_FID_NAMELEN];
+ char idname[LL_ID_NAMELEN];
+ int size = sizeof(*repbody);
struct inode *parent_inode;
struct lvfs_run_ctxt saved;
+ int rc, cleanup_phase = 0;
struct dentry *new = NULL;
struct dentry_params dp;
- int mealen, flags = 0, rc, size = sizeof(*repbody), cleanup_phase = 0;
+ int mealen, flags = 0;
struct lvfs_ucred uc;
+ struct lustre_id id;
struct mea *mea;
void *handle = NULL;
unsigned long cr_inum = 0;
parent_inode = mds->mds_unnamed_dir->d_inode;
- body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_ost_body);
+ body = lustre_swab_reqbuf(req, 0, sizeof(*body),
+ lustre_swab_ost_body);
if (body == NULL)
RETURN(-EFAULT);
MDS_CHECK_RESENT(req, reconstruct_create(req));
- /* FIXME don't understand what security context we should
- * take here. check this -ericm
+ /*
+ * this only serve to inter-mds request, don't need check group database
+ * here. --ericm.
*/
+ uc.luc_ghash = NULL;
+ uc.luc_ginfo = NULL;
+ uc.luc_uid = body->oa.o_uid;
uc.luc_fsuid = body->oa.o_uid;
uc.luc_fsgid = body->oa.o_gid;
- uc.luc_uid = body->oa.o_uid;
- uc.luc_ghash = mds_get_group_entry(mds, body->oa.o_uid);
- uc.luc_ginfo = NULL;
push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
repbody = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*repbody));
if (body->oa.o_id && ((body->oa.o_flags & OBD_FL_RECREATE_OBJS) ||
(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY))) {
/* this is re-create request from MDS holding directory name.
- * we have to lookup given ino/generation first. if it exists
- * (good case) then there is nothing to do. if it does not
- * then we have to recreate it */
- struct ll_fid fid;
- fid.id = body->oa.o_id;
- fid.generation = body->oa.o_generation;
- new = mds_fid2dentry(mds, &fid, NULL);
+ * we have to lookup given ino/gen first. if it exists
+ * (good case) then there is nothing to do. if it does not then
+ * we have to recreate it */
+ id_ino(&id) = body->oa.o_id;
+ id_gen(&id) = body->oa.o_generation;
+
+ new = mds_id2dentry(obd, &id, NULL);
if (!IS_ERR(new) && new->d_inode) {
- CDEBUG(D_HA, "mkdir() repairing is on its way: %lu/%lu\n",
- (unsigned long) fid.id,
- (unsigned long) fid.generation);
+ struct lustre_id sid;
+
+ CWARN("mkdir() repairing is on its way: %lu/%lu\n",
+ (unsigned long)id_ino(&id), (unsigned long)id_gen(&id));
+
obdo_from_inode(&repbody->oa, new->d_inode,
FILTER_VALID_FLAGS);
+
repbody->oa.o_id = new->d_inode->i_ino;
repbody->oa.o_generation = new->d_inode->i_generation;
repbody->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGENER;
cleanup_phase = 1;
+
+ down(&new->d_inode->i_sem);
+ rc = mds_read_inode_sid(obd, new->d_inode, &sid);
+ up(&new->d_inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id "
+ "inode %lu, rc %d.\n",
+ new->d_inode->i_ino, rc);
+ GOTO(cleanup, rc);
+ }
+
+ repbody->oa.o_fid = id_fid(&sid);
+ repbody->oa.o_mds = id_group(&sid);
cr_inum = new->d_inode->i_ino;
GOTO(cleanup, rc = 0);
}
handle = fsfilt_start(obd, parent_inode, FSFILT_OP_MKDIR, NULL);
if (IS_ERR(handle)) {
up(&parent_inode->i_sem);
+ CERROR("fsfilt_start() failed, rc = %d\n",
+ (int)PTR_ERR(handle));
GOTO(cleanup, rc = PTR_ERR(handle));
}
cleanup_phase = 1; /* transaction */
repeat:
- rc = sprintf(fidname, "%u.%u", ll_insecure_random_int(), current->pid);
- new = lookup_one_len(fidname, mds->mds_unnamed_dir, rc);
+ rc = sprintf(idname, "%u.%u", ll_insecure_random_int(), current->pid);
+ new = lookup_one_len(idname, mds->mds_unnamed_dir, rc);
if (IS_ERR(new)) {
CERROR("%s: can't lookup new inode (%s) for mkdir: %d\n",
- obd->obd_name, fidname, (int) PTR_ERR(new));
+ obd->obd_name, idname, (int) PTR_ERR(new));
fsfilt_commit(obd, mds->mds_sb, new->d_inode, handle, 0);
up(&parent_inode->i_sem);
RETURN(PTR_ERR(new));
goto repeat;
}
- new->d_fsdata = (void *) &dp;
+ new->d_fsdata = (void *)&dp;
dp.p_inum = 0;
dp.p_ptr = req;
- if (body->oa.o_id != 0) {
- LASSERT((lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) ||
- (body->oa.o_flags & OBD_FL_RECREATE_OBJS));
+ if ((lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) ||
+ (body->oa.o_flags & OBD_FL_RECREATE_OBJS)) {
+ LASSERT(body->oa.o_id != 0);
DEBUG_REQ(D_HA, req, "replay create obj %lu/%lu",
- (unsigned long) body->oa.o_id,
- (unsigned long) body->oa.o_generation);
+ (unsigned long)body->oa.o_id,
+ (unsigned long)body->oa.o_generation);
dp.p_inum = body->oa.o_id;
}
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
new->d_inode->i_generation = body->oa.o_generation;
mark_inode_dirty(new->d_inode);
- LASSERTF(body->oa.o_id == new->d_inode->i_ino,
- "BUG 3550: failed to recreate obj "
- LPU64" -> %lu\n",
- body->oa.o_id, new->d_inode->i_ino);
- LASSERTF(body->oa.o_generation ==
- new->d_inode->i_generation,
- "BUG 3550: failed to recreate obj/gen "
- LPU64"/%u -> %lu/%u\n",
- body->oa.o_id, body->oa.o_generation,
- new->d_inode->i_ino,
- new->d_inode->i_generation);
+
+ /*
+ * avoiding asserts in cache flush case, as
+ * @body->oa.o_id should be zero.
+ */
+ if (body->oa.o_id) {
+ LASSERTF(body->oa.o_id == new->d_inode->i_ino,
+ "BUG 3550: failed to recreate obj "
+ LPU64" -> %lu\n", body->oa.o_id,
+ new->d_inode->i_ino);
+
+ LASSERTF(body->oa.o_generation ==
+ new->d_inode->i_generation,
+ "BUG 3550: failed to recreate obj/gen "
+ LPU64"/%u -> %lu/%u\n", body->oa.o_id,
+ body->oa.o_generation,
+ new->d_inode->i_ino,
+ new->d_inode->i_generation);
+ }
}
-
+
obdo_from_inode(&repbody->oa, new->d_inode, FILTER_VALID_FLAGS);
repbody->oa.o_id = new->d_inode->i_ino;
repbody->oa.o_generation = new->d_inode->i_generation;
- repbody->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGENER;
+ repbody->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGENER | OBD_MD_FID;
+
+ if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
+ /* building lustre_id on passed @oa. */
+ id_group(&id) = mds->mds_num;
+
+ LASSERT(body->oa.o_fid != 0);
+ id_fid(&id) = body->oa.o_fid;
+
+ id_ino(&id) = repbody->oa.o_id;
+ id_gen(&id) = repbody->oa.o_generation;
+
+ down(&new->d_inode->i_sem);
+ rc = mds_update_inode_sid(obd, new->d_inode, handle, &id);
+ up(&new->d_inode->i_sem);
+
+ /*
+ * make sure, that fid is up-to-date.
+ */
+ mds_set_last_fid(obd, id_fid(&id));
+ } else {
+ down(&new->d_inode->i_sem);
+ rc = mds_alloc_inode_sid(obd, new->d_inode, handle, &id);
+ up(&new->d_inode->i_sem);
+ }
+ if (rc) {
+ CERROR("Can't update lustre ID for inode %lu, "
+ "error = %d\n", new->d_inode->i_ino, rc);
+ GOTO(cleanup, rc);
+ }
+
+ /* initializing o_fid after it is allocated. */
+ repbody->oa.o_fid = id_fid(&id);
+ repbody->oa.o_mds = id_group(&id);
rc = fsfilt_del_dir_entry(obd, new);
up(&parent_inode->i_sem);
-
if (rc) {
CERROR("can't remove name for object: %d\n", rc);
GOTO(cleanup, rc);
}
-
+
cleanup_phase = 2; /* created directory object */
+ CDEBUG(D_OTHER, "created dirobj: %lu/%lu mode %o\n",
+ (unsigned long)new->d_inode->i_ino,
+ (unsigned long)new->d_inode->i_generation,
+ (unsigned)new->d_inode->i_mode);
cr_inum = new->d_inode->i_ino;
- CDEBUG(D_OTHER, "created dirobj: %lu/%u mode %o\n",
- new->d_inode->i_ino, new->d_inode->i_generation,
- new->d_inode->i_mode);
} else {
up(&parent_inode->i_sem);
CERROR("%s: can't create dirobj: %d\n", obd->obd_name, rc);
}
if (body->oa.o_valid & OBD_MD_FLID) {
- /* this is new object for splitted dir. we have to
- * prevent recursive splitting on it -bzzz */
+ /* this is new object for splitted dir. We have to prevent
+ * recursive splitting on it -bzzz */
mealen = obd_size_diskmd(mds->mds_lmv_exp, NULL);
+
OBD_ALLOC(mea, mealen);
if (mea == NULL)
GOTO(cleanup, rc = -ENOMEM);
+
mea->mea_magic = MEA_MAGIC_ALL_CHARS;
mea->mea_master = 0;
mea->mea_count = 0;
+
down(&new->d_inode->i_sem);
rc = fsfilt_set_md(obd, new->d_inode, handle, mea, mealen);
up(&new->d_inode->i_sem);
+ if (rc)
+ CERROR("fsfilt_set_md() failed, rc = %d\n", rc);
+
OBD_FREE(mea, mealen);
CDEBUG(D_OTHER, "%s: mark non-splittable %lu/%u - %d\n",
obd->obd_name, new->d_inode->i_ino,
/* we pass LCK_EX to split routine to signal that we have
* exclusive access to the directory. simple because nobody
* knows it already exists -bzzz */
- mds_try_to_split_dir(obd, new, NULL, body->oa.o_easize, LCK_EX);
+ rc = mds_try_to_split_dir(obd, new, NULL,
+ body->oa.o_easize, LCK_EX);
+ if (rc < 0) {
+ CERROR("Can't split directory %lu, error = %d.\n",
+ new->d_inode->i_ino, rc);
+ } else {
+ rc = 0;
+ }
}
cleanup:
if (rc == 0)
ptlrpc_require_repack(req);
case 1: /* transaction */
- rc = mds_finish_transno(mds, parent_inode, handle, req, rc, cr_inum);
+ rc = mds_finish_transno(mds, parent_inode, handle,
+ req, rc, cr_inum);
}
l_dput(new);
static int mdt_get_info(struct ptlrpc_request *req)
{
- char *key;
struct obd_export *exp = req->rq_export;
- int keylen, rc = 0, size = sizeof(obd_id);
- obd_id *reply;
+ int keylen, rc = 0;
+ char *key;
ENTRY;
key = lustre_msg_buf(req->rq_reqmsg, 0, 1);
}
keylen = req->rq_reqmsg->buflens[0];
- if (keylen < strlen("mdsize") || memcmp(key, "mdsize", 6) != 0)
+ if ((keylen < strlen("mdsize") || strcmp(key, "mdsize") != 0) &&
+ (keylen < strlen("mdsnum") || strcmp(key, "mdsnum") != 0) &&
+ (keylen < strlen("rootid") || strcmp(key, "rootid") != 0))
RETURN(-EPROTO);
- rc = lustre_pack_reply(req, 1, &size, NULL);
- if (rc)
- RETURN(rc);
+ if (keylen >= strlen("rootid") && !strcmp(key, "rootid")) {
+ struct lustre_id *reply;
+ int size = sizeof(*reply);
+
+ rc = lustre_pack_reply(req, 1, &size, NULL);
+ if (rc)
+ RETURN(rc);
+
+ reply = lustre_msg_buf(req->rq_repmsg, 0, size);
+ rc = obd_get_info(exp, keylen, key, &size, reply);
+ } else {
+ obd_id *reply;
+ int size = sizeof(*reply);
+
+ rc = lustre_pack_reply(req, 1, &size, NULL);
+ if (rc)
+ RETURN(rc);
+
+ reply = lustre_msg_buf(req->rq_repmsg, 0, size);
+ rc = obd_get_info(exp, keylen, key, &size, reply);
+ }
- reply = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*reply));
- rc = obd_get_info(exp, keylen, key, &size, reply);
req->rq_repmsg->status = 0;
RETURN(rc);
}
{
struct obd_device *obd;
struct mds_obd *mds;
- int rc = 0;
+ int rc = 0;
ENTRY;
obd = class_exp2obd(exp);
RETURN(-EINVAL);
}
-#define KEY_IS(str) \
- (keylen == strlen(str) && memcmp(key, str, keylen) == 0)
-
mds = &obd->u.mds;
- if (KEY_IS("mds_num")) {
+ if (keylen >= strlen("mds_type") &&
+ memcmp(key, "mds_type", keylen) == 0) {
int valsize;
__u32 group;
- CDEBUG(D_IOCTL, "set mds num %d\n", *(int*)val);
- mds->mds_num = *(int*)val;
- group = FILTER_GROUP_FIRST_MDS + mds->mds_num;
+
+ CDEBUG(D_IOCTL, "set mds type to %x\n", *(int*)val);
+
+ mds->mds_obd_type = *(int*)val;
+ group = FILTER_GROUP_FIRST_MDS + mds->mds_obd_type;
valsize = sizeof(group);
- /*mds number has been changed, so the corresponding obdfilter exp
- *need to be changed too*/
- rc = obd_set_info(mds->mds_osc_exp, strlen("mds_conn"), "mds_conn",
- valsize, &group);
+
+ /* mds number has been changed, so the corresponding obdfilter
+ * exp need to be changed too. */
+ rc = obd_set_info(mds->mds_lov_exp, strlen("mds_conn"),
+ "mds_conn", valsize, &group);
RETURN(rc);
}
CDEBUG(D_IOCTL, "invalid key\n");
}
keylen = req->rq_reqmsg->buflens[0];
- if (keylen == strlen("mds_num") &&
- memcmp(key, "mds_num", keylen) == 0) {
+ if (keylen == strlen("mds_type") &&
+ memcmp(key, "mds_type", keylen) == 0) {
rc = lustre_pack_reply(req, 0, NULL, NULL);
if (rc)
RETURN(rc);
+
val = lustre_msg_buf(req->rq_reqmsg, 1, 0);
-
vallen = req->rq_reqmsg->buflens[1];
rc = obd_set_info(exp, keylen, key, vallen, val);
req->rq_repmsg->status = 0;
RETURN(rc);
- } else if (keylen == strlen("client") &&
- memcmp(key, "client", keylen) == 0) {
- rc = lustre_pack_reply(req, 0, NULL, NULL);
- if (rc)
- RETURN(rc);
- rc = obd_set_info(exp, keylen, key, sizeof(obd_id), NULL);
- req->rq_repmsg->status = 0;
- RETURN(rc);
- }
+ }
CDEBUG(D_IOCTL, "invalid key\n");
RETURN(-EINVAL);
}
case MDS_GETATTR_LOCK: {
struct lustre_handle lockh;
- DEBUG_REQ(D_INODE, req, "getattr_name");
+ DEBUG_REQ(D_INODE, req, "getattr_lock");
OBD_FAIL_RETURN(OBD_FAIL_MDS_GETATTR_LOCK_NET, 0);
/* If this request gets a reconstructed reply, we won't be
}
break;
-
case MDS_REINT: {
__u32 *opcp = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF,
sizeof (*opcp));
return 0;
}
-/* Update the server data on disk. This stores the new mount_count and
- * also the last_rcvd value to disk. If we don't have a clean shutdown,
- * then the server last_rcvd value may be less than that of the clients.
- * This will alert us that we may need to do client recovery.
+/* Update the server data on disk. This stores the new mount_count and also the
+ * last_rcvd value to disk. If we don't have a clean shutdown, then the server
+ * last_rcvd value may be less than that of the clients. This will alert us
+ * that we may need to do client recovery.
*
* Also assumes for mds_last_transno that we are not modifying it (no locking).
*/
CDEBUG(D_SUPER, "MDS mount_count is "LPU64", last_transno is "LPU64"\n",
mds->mds_mount_count, mds->mds_last_transno);
- rc = fsfilt_write_record(obd, filp, msd, sizeof(*msd), &off,force_sync);
+ rc = fsfilt_write_record(obd, filp, msd, sizeof(*msd), &off, force_sync);
if (rc)
CERROR("error writing MDS server data: rc = %d\n", rc);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
RETURN(rc);
}
+/* saves last allocated fid counter to file. */
+int mds_update_last_fid(struct obd_device *obd, void *handle,
+ int force_sync)
+{
+ struct mds_obd *mds = &obd->u.mds;
+ struct file *filp = mds->mds_fid_filp;
+ struct lvfs_run_ctxt saved;
+ loff_t off = 0;
+ int rc = 0;
+ ENTRY;
+
+ down(&mds->mds_last_fid_sem);
+ if (mds->mds_last_fid_changed) {
+ CDEBUG(D_SUPER, "MDS last_fid is #"LPU64"\n",
+ mds->mds_last_fid);
+
+ if (handle) {
+ fsfilt_add_journal_cb(obd, mds->mds_sb,
+ mds->mds_last_fid, handle,
+ mds_commit_last_fid_cb, NULL);
+ }
+
+ push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ rc = fsfilt_write_record(obd, filp, &mds->mds_last_fid,
+ sizeof(mds->mds_last_fid),
+ &off, force_sync);
+ if (rc) {
+ CERROR("error writing MDS last_fid #"LPU64
+ ", err = %d\n", mds->mds_last_fid, rc);
+ } else {
+ mds->mds_last_fid_changed = 0;
+ }
+
+ CDEBUG(D_SUPER, "wrote fid #"LPU64" at idx "
+ "%llu: err = %d\n", mds->mds_last_fid,
+ off, rc);
+ pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ }
+ up(&mds->mds_last_fid_sem);
+
+ RETURN(rc);
+}
+
+void mds_set_last_fid(struct obd_device *obd, __u64 fid)
+{
+ struct mds_obd *mds = &obd->u.mds;
+
+ down(&mds->mds_last_fid_sem);
+ if (fid > mds->mds_last_fid) {
+ mds->mds_last_fid = fid;
+ mds->mds_last_fid_changed = 1;
+ }
+ up(&mds->mds_last_fid_sem);
+}
+
+void mds_commit_last_transno_cb(struct obd_device *obd,
+ __u64 transno, void *data,
+ int error)
+{
+ obd_transno_commit_cb(obd, transno, error);
+}
+
+void mds_commit_last_fid_cb(struct obd_device *obd,
+ __u64 fid, void *data,
+ int error)
+{
+ if (error) {
+ CERROR("%s: fid "LPD64" commit error: %d\n",
+ obd->obd_name, fid, error);
+ return;
+ }
+
+ CDEBUG(D_HA, "%s: fid "LPD64" committed\n",
+ obd->obd_name, fid);
+}
+
+/*
+ * allocates new lustre_id on passed @inode and saves it to inode EA.
+ */
+int mds_alloc_inode_sid(struct obd_device *obd, struct inode *inode,
+ void *handle, struct lustre_id *id)
+{
+ struct mds_obd *mds = &obd->u.mds;
+ int rc = 0;
+ ENTRY;
+
+ LASSERT(id != NULL);
+ LASSERT(obd != NULL);
+
+ id_group(id) = mds->mds_num;
+
+ down(&mds->mds_last_fid_sem);
+ mds->mds_last_fid_changed = 1;
+ id_fid(id) = ++mds->mds_last_fid;
+ up(&mds->mds_last_fid_sem);
+
+ id_ino(id) = inode->i_ino;
+ id_gen(id) = inode->i_generation;
+ id_type(id) = (S_IFMT & inode->i_mode);
+
+ rc = mds_update_inode_sid(obd, inode, handle, id);
+ if (rc) {
+ CERROR("Can't update inode FID EA, "
+ "rc = %d\n", rc);
+ }
+
+ RETURN(rc);
+}
+
+/*
+ * reads inode self id from inode EA. Probably later this should be replaced by
+ * caching inode self id to avoid raeding it every time it is needed.
+ */
+int mds_read_inode_sid(struct obd_device *obd, struct inode *inode,
+ struct lustre_id *id)
+{
+ int rc;
+ ENTRY;
+
+ LASSERT(id != NULL);
+ LASSERT(obd != NULL);
+ LASSERT(inode != NULL);
+
+ rc = fsfilt_get_sid(obd, inode, &id->li_fid,
+ sizeof(id->li_fid));
+ if (rc < 0) {
+ CERROR("fsfilt_get_sid() failed, "
+ "rc = %d\n", rc);
+ RETURN(rc);
+ } else if (!rc) {
+ rc = -ENODATA;
+ RETURN(rc);
+ } else {
+ rc = 0;
+ }
+
+ RETURN(rc);
+}
+
+/* updates inode self id in EA. */
+int mds_update_inode_sid(struct obd_device *obd, struct inode *inode,
+ void *handle, struct lustre_id *id)
+{
+ int rc = 0;
+ ENTRY;
+
+ LASSERT(id != NULL);
+ LASSERT(obd != NULL);
+ LASSERT(inode != NULL);
+
+ rc = fsfilt_set_sid(obd, inode, handle, &id->li_fid,
+ sizeof(id->li_fid));
+ if (rc) {
+ CERROR("fsfilt_set_sid() failed, rc = %d\n", rc);
+ RETURN(rc);
+ }
+
+ RETURN(rc);
+}
+
+/*
+ * reads inode id on master MDS. This is usualy done by CMOBD to update requests
+ * to master MDS by correct store cookie, needed to find inode on master MDS
+ * quickly.
+ */
+int mds_read_inode_mid(struct obd_device *obd, struct inode *inode,
+ struct lustre_id *id)
+{
+ int rc;
+ ENTRY;
+
+ LASSERT(id != NULL);
+ LASSERT(obd != NULL);
+ LASSERT(inode != NULL);
+
+ rc = fsfilt_get_mid(obd, inode, id, sizeof(*id));
+ if (rc < 0) {
+ CERROR("fsfilt_get_mid() failed, "
+ "rc = %d\n", rc);
+ RETURN(rc);
+ } else if (!rc) {
+ rc = -ENODATA;
+ RETURN(rc);
+ } else {
+ rc = 0;
+ }
+
+ RETURN(rc);
+}
+
+/*
+ * updates master inode id. Usualy this is done by CMOBD after an inode is
+ * created and relationship between cache MDS and master one should be
+ * established.
+ */
+int mds_update_inode_mid(struct obd_device *obd, struct inode *inode,
+ void *handle, struct lustre_id *id)
+{
+ int rc = 0;
+ ENTRY;
+
+ LASSERT(id != NULL);
+ LASSERT(obd != NULL);
+ LASSERT(inode != NULL);
+
+ rc = fsfilt_set_mid(obd, inode, handle, id, sizeof(*id));
+ if (rc) {
+ CERROR("fsfilt_set_mid() failed, rc = %d\n", rc);
+ RETURN(rc);
+ }
+
+ RETURN(rc);
+}
+
/* mount the file system (secretly) */
static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
{
options = (char *)page;
memset(options, 0, PAGE_SIZE);
- /* here we use "iopen_nopriv" hardcoded, because it affects MDS utility
+ /*
+ * here we use "iopen_nopriv" hardcoded, because it affects MDS utility
* and the rest of options are passed by mount options. Probably this
- * should be moved to somewhere else like startup scripts or lconf. */
+ * should be moved to somewhere else like startup scripts or lconf.
+ */
sprintf(options, "iopen_nopriv");
if (lcfg->lcfg_inllen4 > 0 && lcfg->lcfg_inlbuf4)
}
}
- /* FIXME-WANGDI: this should be reworked when we will use lmv along
- * with cobd, because correct mdsnum is set in mds_lmv_connect(). */
- if (lcfg->lcfg_inllen6 > 0 && lcfg->lcfg_inlbuf6 && !mds->mds_lmv_obd &&
+ mds->mds_obd_type = MDS_MASTER_OBD;
+
+ if (lcfg->lcfg_inllen6 > 0 && lcfg->lcfg_inlbuf6 &&
strcmp(lcfg->lcfg_inlbuf6, "dumb")) {
- if (!memcmp(lcfg->lcfg_inlbuf6, "master", strlen("master")) &&
- mds->mds_num == 0) {
- mds->mds_num = REAL_MDS_NUMBER;
- } else if (!memcmp(lcfg->lcfg_inlbuf6, "cache", strlen("cache")) &&
- mds->mds_num == 0) {
- mds->mds_num = CACHE_MDS_NUMBER;
+ if (!memcmp(lcfg->lcfg_inlbuf6, "master", strlen("master"))) {
+ mds->mds_obd_type = MDS_MASTER_OBD;
+ } else if (!memcmp(lcfg->lcfg_inlbuf6, "cache", strlen("cache"))) {
+ mds->mds_obd_type = MDS_CACHE_OBD;
}
}
- mnt = do_kern_mount(lcfg->lcfg_inlbuf2, 0,
- lcfg->lcfg_inlbuf1, options);
-
+ mnt = do_kern_mount(lcfg->lcfg_inlbuf2, 0, lcfg->lcfg_inlbuf1, options);
free_page(page);
if (IS_ERR(mnt)) {
CDEBUG(D_SUPER, "%s: mnt = %p\n", lcfg->lcfg_inlbuf1, mnt);
- sema_init(&mds->mds_orphan_recovery_sem, 1);
+ mds->mds_last_fid_changed = 0;
sema_init(&mds->mds_epoch_sem, 1);
+ sema_init(&mds->mds_last_fid_sem, 1);
+ atomic_set(&mds->mds_real_clients, 0);
spin_lock_init(&mds->mds_transno_lock);
+ sema_init(&mds->mds_orphan_recovery_sem, 1);
mds->mds_max_cookiesize = sizeof(struct llog_cookie);
- atomic_set(&mds->mds_real_clients, 0);
sprintf(ns_name, "mds-%s", obd->obd_uuid.uuid);
obd->obd_namespace = ldlm_namespace_new(ns_name, LDLM_NAMESPACE_SERVER);
obd->obd_name, rc);
GOTO(err_ns, rc);
}
-
+
rc = llog_start_commit_thread();
if (rc < 0)
GOTO(err_fs, rc);
- /* this check for @dumb string is needed to handle mounting MDS with
- * smfs. Read lconf:MDSDEV.write_conf() for more details. */
+ /*
+ * this check for @dumb string is needed to handle mounting MDS with
+ * smfs. Read lconf:MDSDEV.write_conf() for more details.
+ */
if (lcfg->lcfg_inllen3 > 0 && lcfg->lcfg_inlbuf3 &&
strcmp(lcfg->lcfg_inlbuf3, "dumb")) {
class_uuid_t uuid;
memcpy(mds->mds_profile, lcfg->lcfg_inlbuf3,
lcfg->lcfg_inllen3);
+
+ /*
+ * setup root id in the case this is not clients write
+ * setup. This is important, as in the case of LMV we need
+ * mds->mds_num to be already assigned to form correct root fid.
+ */
+ rc = mds_fs_setup_rootid(obd);
+ if (rc)
+ GOTO(err_fs, rc);
+
+ /* setup lustre id for ID directory. */
+ rc = mds_fs_setup_virtid(obd);
+ if (rc)
+ GOTO(err_fs, rc);
}
ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
CERROR("No profile found: %s\n", mds->mds_profile);
GOTO(err_cleanup, rc = -ENOENT);
}
- rc = mds_lov_connect(obd, lprof->lp_osc);
+ rc = mds_lov_connect(obd, lprof->lp_lov);
if (rc)
GOTO(err_cleanup, rc);
group = FILTER_GROUP_FIRST_MDS + mds->mds_num;
valsize = sizeof(group);
- rc = obd_set_info(mds->mds_osc_exp, strlen("mds_conn"), "mds_conn",
+ rc = obd_set_info(mds->mds_lov_exp, strlen("mds_conn"), "mds_conn",
valsize, &group);
if (rc)
GOTO(out, rc);
if (mds->mds_profile) {
char * cln_prof;
- struct config_llog_instance cfg;
+ struct llog_ctxt *llctx;
struct lvfs_run_ctxt saved;
+ struct config_llog_instance cfg;
int len = strlen(mds->mds_profile) + sizeof("-clean") + 1;
OBD_ALLOC(cln_prof, len);
cfg.cfg_uuid = mds->mds_lov_uuid;
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- class_config_process_llog(llog_get_context(&obd->obd_llogs, LLOG_CONFIG_ORIG_CTXT),
- cln_prof, &cfg);
+ llctx = llog_get_context(&obd->obd_llogs,
+ LLOG_CONFIG_ORIG_CTXT);
+ class_config_process_llog(llctx, cln_prof, &cfg);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
OBD_FREE(cln_prof, len);
RETURN(0);
mds_update_server_data(obd, 1);
+ mds_update_last_fid(obd, NULL, 1);
+
if (mds->mds_lov_objids != NULL) {
- OBD_FREE(mds->mds_lov_objids,
- mds->mds_lov_desc.ld_tgt_count * sizeof(obd_id));
+ int size = mds->mds_lov_desc.ld_tgt_count *
+ sizeof(obd_id);
+ OBD_FREE(mds->mds_lov_objids, size);
}
mds_fs_cleanup(obd, flags);
unlock_kernel();
- /* 2 seems normal on mds, (may_umount() also expects 2
- fwiw), but we only see 1 at this point in obdfilter. */
+ /*
+ * 2 seems normal on mds, (may_umount() also expects 2 fwiw), but we
+ * only see 1 at this point in obdfilter.
+ */
if (atomic_read(&obd->u.mds.mds_vfsmnt->mnt_count) > 2)
CERROR("%s: mount busy, mnt_count %d != 2\n", obd->obd_name,
atomic_read(&obd->u.mds.mds_vfsmnt->mnt_count));
mntput(mds->mds_vfsmnt);
-
mds->mds_sb = 0;
ldlm_namespace_free(obd->obd_namespace, flags & OBD_OPT_FORCE);
if (rc)
RETURN(req->rq_status = rc);
- rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
- intent_set_disposition(rep, DISP_IT_EXECD);
+ rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*rep));
+ LASSERT(rep != NULL);
+ intent_set_disposition(rep, DISP_IT_EXECD);
/* execute policy */
switch ((long)it->opc) {
LASSERTF(new_lock != NULL, "op "LPX64" lockh "LPX64"\n",
it->opc, lockh[0].cookie);
-
/* If we've already given this lock to a client once, then we should
* have no readers or writers. Otherwise, we should have one reader
* _or_ writer ref (which will be zeroed below) before returning the
RETURN(0);
}
-static struct dentry *mds_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr,
- void *data)
+static struct dentry *mds_lvfs_id2dentry(__u64 ino, __u32 gen,
+ __u64 gr, void *data)
{
+ struct lustre_id id;
struct obd_device *obd = data;
- struct ll_fid fid;
- fid.id = id;
- fid.generation = gen;
- return mds_fid2dentry(&obd->u.mds, &fid, NULL);
+
+ id_ino(&id) = ino;
+ id_gen(&id) = gen;
+ return mds_id2dentry(obd, &id, NULL);
}
static int mds_get_info(struct obd_export *exp, __u32 keylen,
- void *key, __u32 *vallen, void *val)
+ void *key, __u32 *valsize, void *val)
{
struct obd_device *obd;
struct mds_obd *mds;
ENTRY;
obd = class_exp2obd(exp);
+ mds = &obd->u.mds;
+
if (obd == NULL) {
CDEBUG(D_IOCTL, "invalid client cookie "LPX64"\n",
exp->exp_handle.h_cookie);
}
if (keylen >= strlen("reint_log") && memcmp(key, "reint_log", 9) == 0) {
- /*Get log_context handle*/
+ /* get log_context handle. */
unsigned long *llh_handle = val;
- *vallen = sizeof(unsigned long);
+ *valsize = sizeof(unsigned long);
*llh_handle = (unsigned long)obd->obd_llog_ctxt[LLOG_REINT_ORIG_CTXT];
RETURN(0);
}
if (keylen >= strlen("cache_sb") && memcmp(key, "cache_sb", 8) == 0) {
- /*Get log_context handle*/
+ /* get log_context handle. */
unsigned long *sb = val;
- *vallen = sizeof(unsigned long);
+ *valsize = sizeof(unsigned long);
*sb = (unsigned long)obd->u.mds.mds_sb;
RETURN(0);
}
- mds = &obd->u.mds;
if (keylen >= strlen("mdsize") && memcmp(key, "mdsize", keylen) == 0) {
__u32 *mdsize = val;
- *vallen = sizeof(*mdsize);
+ *valsize = sizeof(*mdsize);
*mdsize = mds->mds_max_mdsize;
RETURN(0);
}
+ if (keylen >= strlen("mdsnum") && strcmp(key, "mdsnum") == 0) {
+ __u32 *mdsnum = val;
+ *valsize = sizeof(*mdsnum);
+ *mdsnum = mds->mds_num;
+ RETURN(0);
+ }
+
+ if (keylen >= strlen("rootid") && strcmp(key, "rootid") == 0) {
+ struct lustre_id *rootid = val;
+ *valsize = sizeof(struct lustre_id);
+ *rootid = mds->mds_rootid;
+ RETURN(0);
+ }
+
CDEBUG(D_IOCTL, "invalid key\n");
RETURN(-EINVAL);
}
struct lvfs_callback_ops mds_lvfs_ops = {
- l_fid2dentry: mds_lvfs_fid2dentry,
+ l_id2dentry: mds_lvfs_id2dentry,
};
int mds_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
int niocount, struct niobuf_remote *nb,
struct niobuf_local *res,
struct obd_trans_info *oti);
+
int mds_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
int objcount, struct obd_ioobj *obj, int niocount,
struct niobuf_local *res, struct obd_trans_info *oti,
.o_detach = mdt_detach,
.o_setup = mdt_setup,
.o_cleanup = mdt_cleanup,
- .o_attach = mdt_attach,
- .o_detach = mdt_detach,
};
static int __init mds_init(void)
#define LAST_RCVD "last_rcvd"
#define LOV_OBJID "lov_objid"
+#define LAST_FID "last_fid"
/* Add client data to the MDS. We use a bitmap to locate a free space
* in the last_rcvd file if cl_off is -1 (i.e. a new client).
free_and_out:
OBD_FREE(med->med_mcd, sizeof(*med->med_mcd));
-
return 0;
}
return 0;
}
+static int mds_read_last_fid(struct obd_device *obd, struct file *file)
+{
+ int rc = 0;
+ loff_t off = 0;
+ struct mds_obd *mds = &obd->u.mds;
+ unsigned long last_fid_size = file->f_dentry->d_inode->i_size;
+ ENTRY;
+
+ if (last_fid_size == 0) {
+ CWARN("%s: initializing new %s\n", obd->obd_name,
+ file->f_dentry->d_name.name);
+
+ /*
+ * as fid is used for forming res_id for locking, it should not
+ * be zero. This will keep us out of lots possible problems,
+ * asserts, etc.
+ */
+ mds_set_last_fid(obd, 0);
+ } else {
+ __u64 lastfid;
+
+ rc = fsfilt_read_record(obd, file, &lastfid,
+ sizeof(lastfid), &off);
+ if (rc) {
+ CERROR("error reading MDS %s: rc = %d\n",
+ file->f_dentry->d_name.name, rc);
+ RETURN(rc);
+ }
+
+ /*
+ * make sure, that fid is up-to-date.
+ */
+ mds_set_last_fid(obd, lastfid);
+ }
+
+ CDEBUG(D_INODE, "%s: server last_fid: "LPU64"\n",
+ obd->obd_name, mds->mds_last_fid);
+
+ rc = mds_update_last_fid(obd, NULL, 1);
+ RETURN(rc);
+}
+
static int mds_read_last_rcvd(struct obd_device *obd, struct file *file)
{
struct mds_obd *mds = &obd->u.mds;
mds->mds_server_data = msd;
if (last_rcvd_size == 0) {
- CWARN("%s: initializing new %s\n", obd->obd_name, LAST_RCVD);
+ CWARN("%s: initializing new %s\n", obd->obd_name,
+ file->f_dentry->d_name.name);
memcpy(msd->msd_uuid, obd->obd_uuid.uuid,sizeof(msd->msd_uuid));
msd->msd_last_transno = 0;
} else {
rc = fsfilt_read_record(obd, file, msd, sizeof(*msd), &off);
if (rc) {
- CERROR("error reading MDS %s: rc = %d\n", LAST_RCVD, rc);
+ CERROR("error reading MDS %s: rc = %d\n",
+ file->f_dentry->d_name.name, rc);
GOTO(err_msd, rc);
}
if (strcmp(msd->msd_uuid, obd->obd_uuid.uuid) != 0) {
rc = fsfilt_read_record(obd, file, mcd, sizeof(*mcd), &off);
if (rc) {
CERROR("error reading MDS %s idx %d, off %llu: rc %d\n",
- LAST_RCVD, cl_idx, off, rc);
+ file->f_dentry->d_name.name, cl_idx, off, rc);
break; /* read error shouldn't cause startup to fail */
}
RETURN(rc);
}
-static int mds_fs_post_setup(struct obd_device *obd)
+static int mds_fs_post_setup(struct obd_device *obd)
{
struct mds_obd *mds = &obd->u.mds;
- struct dentry *de = mds_fid2dentry(mds, &mds->mds_rootfid, NULL);
- int rc = 0;
+ struct dentry *dentry;
+ int rc = 0;
+ ENTRY;
- rc = fsfilt_post_setup(obd, de);
+ dentry = mds_id2dentry(obd, &mds->mds_rootid, NULL);
+ if (IS_ERR(dentry)) {
+ CERROR("Can't find ROOT, err = %d\n",
+ (int)PTR_ERR(dentry));
+ RETURN(PTR_ERR(dentry));
+ }
+
+ rc = fsfilt_post_setup(obd, dentry);
if (rc)
- GOTO(out, rc);
-
- fsfilt_set_fs_flags(obd, de->d_inode,
- SM_DO_REC | SM_DO_COW);
+ goto out_dentry;
+
+ LASSERT(dentry->d_inode != NULL);
+
+ fsfilt_set_fs_flags(obd, dentry->d_inode,
+ SM_DO_REC | SM_DO_COW);
+
fsfilt_set_fs_flags(obd, mds->mds_pending_dir->d_inode,
- SM_DO_REC | SM_DO_COW);
+ SM_DO_REC | SM_DO_COW);
+
fsfilt_set_mds_flags(obd, mds->mds_sb);
-out:
- l_dput(de);
- return rc;
+
+out_dentry:
+ l_dput(dentry);
+ RETURN(rc);
+}
+
+/*
+ * sets up root inode lustre_id. It tries to read it first from root inode and
+ * if it is not there, new rootid is allocated and saved there.
+ */
+int mds_fs_setup_rootid(struct obd_device *obd)
+{
+ int rc = 0;
+ void *handle;
+ struct inode *inode;
+ struct dentry *dentry;
+ struct lustre_id rootid;
+ struct mds_obd *mds = &obd->u.mds;
+ ENTRY;
+
+ memcpy(&rootid, &mds->mds_rootid, sizeof(rootid));
+
+ /* getting root directory and setup its fid. */
+ dentry = mds_id2dentry(obd, &rootid, NULL);
+ if (IS_ERR(dentry)) {
+ CERROR("Can't find ROOT, err = %d\n",
+ (int)PTR_ERR(dentry));
+ RETURN(PTR_ERR(dentry));
+ }
+
+ inode = dentry->d_inode;
+ LASSERT(dentry->d_inode);
+
+ rc = mds_pack_inode2id(obd, &rootid, inode, 1);
+ if (rc < 0) {
+ if (rc != -ENODATA)
+ goto out_dentry;
+ } else {
+ /*
+ * rootid is filled by mds_read_inode_sid(), so we do not need
+ * to allocate it and update. The only thing we need to check is
+ * mds_num.
+ */
+ LASSERT(id_group(&rootid) == mds->mds_num);
+ mds_set_last_fid(obd, id_fid(&rootid));
+ GOTO(out_dentry, rc);
+ }
+
+ /* allocating new one, as it is not found in root inode. */
+ handle = fsfilt_start(obd, inode,
+ FSFILT_OP_SETATTR, NULL);
+
+ if (IS_ERR(handle)) {
+ rc = PTR_ERR(handle);
+ CERROR("fsfilt_start() failed, rc = %d\n", rc);
+ GOTO(out_dentry, rc);
+ }
+
+ down(&inode->i_sem);
+ rc = mds_alloc_inode_sid(obd, inode, handle, &rootid);
+ up(&inode->i_sem);
+
+ if (rc) {
+ CERROR("mds_alloc_inode_sid() failed, rc = %d\n",
+ rc);
+ GOTO(out_dentry, rc);
+ }
+
+ rc = fsfilt_commit(obd, mds->mds_sb, inode, handle, 0);
+ if (rc)
+ CERROR("fsfilt_commit() failed, rc = %d\n", rc);
+
+out_dentry:
+ l_dput(dentry);
+ if (rc == 0) {
+ memcpy(&mds->mds_rootid, &rootid, sizeof(rootid));
+ CWARN("%s: rootid: "DLID4"\n", obd->obd_name,
+ OLID4(&rootid));
+ }
+ RETURN(rc);
+}
+
+/*
+ * initializes lustre_id for virtual id directory, it is needed sometimes, as it
+ * is possible that it will be the parent for object an operations is going to
+ * be performed on.
+ */
+int mds_fs_setup_virtid(struct obd_device *obd)
+{
+ int rc = 0;
+ void *handle;
+ struct lustre_id id;
+ struct mds_obd *mds = &obd->u.mds;
+ struct inode *inode = mds->mds_id_dir->d_inode;
+ ENTRY;
+
+ handle = fsfilt_start(obd, inode,
+ FSFILT_OP_SETATTR, NULL);
+
+ if (IS_ERR(handle)) {
+ rc = PTR_ERR(handle);
+ CERROR("fsfilt_start() failed, rc = %d\n", rc);
+ RETURN(rc);
+ }
+
+ down(&inode->i_sem);
+ rc = mds_alloc_inode_sid(obd, inode, handle, &id);
+ up(&inode->i_sem);
+
+ if (rc) {
+ CERROR("mds_alloc_inode_sid() failed, rc = %d\n",
+ rc);
+ RETURN(rc);
+ }
+
+ rc = fsfilt_commit(obd, mds->mds_sb, inode, handle, 0);
+ if (rc) {
+ CERROR("fsfilt_commit() failed, rc = %d\n", rc);
+ RETURN(rc);
+ }
+
+ RETURN(rc);
}
int mds_fs_setup(struct obd_device *obd, struct vfsmount *mnt)
GOTO(err_pop, rc);
}
- mds->mds_rootfid.id = dentry->d_inode->i_ino;
- mds->mds_rootfid.generation = dentry->d_inode->i_generation;
- mds->mds_rootfid.f_type = S_IFDIR;
+ mdc_pack_id(&mds->mds_rootid, dentry->d_inode->i_ino,
+ dentry->d_inode->i_generation, S_IFDIR, 0, 0);
dput(dentry);
-
+
dentry = lookup_one_len("__iopen__", current->fs->pwd,
strlen("__iopen__"));
if (IS_ERR(dentry)) {
CERROR("cannot lookup __iopen__ directory: rc = %d\n", rc);
GOTO(err_pop, rc);
}
+ mds->mds_id_de = dentry;
+
if (!dentry->d_inode) {
rc = -ENOENT;
CERROR("__iopen__ directory has no inode? rc = %d\n", rc);
- GOTO(err_fid, rc);
+ GOTO(err_id_de, rc);
}
- mds->mds_fid_de = dentry;
dentry = simple_mkdir(current->fs->pwd, "PENDING", 0777, 1);
if (IS_ERR(dentry)) {
rc = PTR_ERR(dentry);
CERROR("cannot create PENDING directory: rc = %d\n", rc);
- GOTO(err_fid, rc);
+ GOTO(err_id_de, rc);
}
mds->mds_pending_dir = dentry;
if (IS_ERR(dentry)) {
rc = PTR_ERR(dentry);
CERROR("cannot create FIDS directory: rc = %d\n", rc);
- GOTO(err_fids, rc);
+ GOTO(err_objects, rc);
}
- mds->mds_fids_dir = dentry;
+ mds->mds_id_dir = dentry;
dentry = simple_mkdir(current->fs->pwd, "UNNAMED", 0777, 1);
if (IS_ERR(dentry)) {
if (IS_ERR(file)) {
rc = PTR_ERR(file);
CERROR("cannot open/create %s file: rc = %d\n", LAST_RCVD, rc);
- GOTO(err_objects, rc = PTR_ERR(file));
+ GOTO(err_id_dir, rc = PTR_ERR(file));
}
mds->mds_rcvd_filp = file;
+
if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
CERROR("%s is not a regular file!: mode = %o\n", LAST_RCVD,
file->f_dentry->d_inode->i_mode);
GOTO(err_last_rcvd, rc);
}
- /* open and test the lov objd file */
+ /* open and test the last fid file */
+ file = filp_open(LAST_FID, O_RDWR | O_CREAT, 0644);
+ if (IS_ERR(file)) {
+ rc = PTR_ERR(file);
+ CERROR("cannot open/create %s file: rc = %d\n",
+ LAST_FID, rc);
+ GOTO(err_client, rc = PTR_ERR(file));
+ }
+ mds->mds_fid_filp = file;
+ if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
+ CERROR("%s is not a regular file!: mode = %o\n",
+ LAST_FID, file->f_dentry->d_inode->i_mode);
+ GOTO(err_last_fid, rc = -ENOENT);
+ }
+
+ rc = mds_read_last_fid(obd, file);
+ if (rc) {
+ CERROR("cannot read %s: rc = %d\n", LAST_FID, rc);
+ GOTO(err_last_fid, rc);
+ }
+
+ /* open and test the lov objid file */
file = filp_open(LOV_OBJID, O_RDWR | O_CREAT, 0644);
if (IS_ERR(file)) {
rc = PTR_ERR(file);
CERROR("cannot open/create %s file: rc = %d\n", LOV_OBJID, rc);
- GOTO(err_client, rc = PTR_ERR(file));
+ GOTO(err_last_fid, rc = PTR_ERR(file));
}
mds->mds_lov_objid_filp = file;
if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
err_lov_objid:
if (mds->mds_lov_objid_filp && filp_close(mds->mds_lov_objid_filp, 0))
CERROR("can't close %s after error\n", LOV_OBJID);
+err_last_fid:
+ if (mds->mds_fid_filp && filp_close(mds->mds_fid_filp, 0))
+ CERROR("can't close %s after error\n", LAST_FID);
err_client:
class_disconnect_exports(obd, 0);
err_last_rcvd:
CERROR("can't close %s after error\n", LAST_RCVD);
err_unnamed:
dput(mds->mds_unnamed_dir);
-err_fids:
- dput(mds->mds_fids_dir);
+err_id_dir:
+ dput(mds->mds_id_dir);
err_objects:
dput(mds->mds_objects_dir);
err_logs:
dput(mds->mds_logs_dir);
err_pending:
dput(mds->mds_pending_dir);
-err_fid:
- dput(mds->mds_fid_de);
+err_id_de:
+ dput(mds->mds_id_de);
goto err_pop;
}
mds_server_free_data(mds);
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ if (mds->mds_fid_filp) {
+ rc = filp_close(mds->mds_fid_filp, 0);
+ mds->mds_fid_filp = NULL;
+ if (rc)
+ CERROR("%s file won't close, rc = %d\n", LAST_FID, rc);
+ }
if (mds->mds_rcvd_filp) {
rc = filp_close(mds->mds_rcvd_filp, 0);
mds->mds_rcvd_filp = NULL;
if (rc)
- CERROR("%s file won't close, rc=%d\n", LAST_RCVD, rc);
+ CERROR("%s file won't close, rc = %d\n", LAST_RCVD, rc);
}
if (mds->mds_lov_objid_filp) {
rc = filp_close(mds->mds_lov_objid_filp, 0);
l_dput(mds->mds_unnamed_dir);
mds->mds_unnamed_dir = NULL;
}
- if (mds->mds_fids_dir != NULL) {
- l_dput(mds->mds_fids_dir);
- mds->mds_fids_dir = NULL;
+ if (mds->mds_id_dir != NULL) {
+ l_dput(mds->mds_id_dir);
+ mds->mds_id_dir = NULL;
}
if (mds->mds_objects_dir != NULL) {
l_dput(mds->mds_objects_dir);
rc = mds_fs_post_cleanup(obd);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- shrink_dcache_parent(mds->mds_fid_de);
- dput(mds->mds_fid_de);
+ shrink_dcache_parent(mds->mds_id_de);
+ dput(mds->mds_id_de);
return rc;
}
-/* Creates an object with the same name as its fid. Because this is not at all
+/* Creates an object with the same name as its id. Because this is not at all
* performance sensitive, it is accomplished by creating a file, checking the
- * fid, and renaming it. */
+ * id, and renaming it. */
int mds_obd_create(struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md **ea, struct obd_trans_info *oti)
{
struct file *filp;
struct dentry *dchild;
struct lvfs_run_ctxt saved;
- char fidname[LL_FID_NAMELEN];
+ char idname[LL_ID_NAMELEN];
+ int rc = 0, err, idlen;
void *handle;
- int rc = 0, err, namelen;
ENTRY;
push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
down(&parent_inode->i_sem);
if (oa->o_id) {
- namelen = ll_fid2str(fidname, oa->o_id, oa->o_generation);
-
- dchild = lookup_one_len(fidname, mds->mds_objects_dir, namelen);
+ idlen = ll_id2str(idname, oa->o_id, oa->o_generation);
+ dchild = lookup_one_len(idname, mds->mds_objects_dir, idlen);
if (IS_ERR(dchild))
GOTO(out_pop, rc = PTR_ERR(dchild));
GOTO(out_pop, rc);
}
- sprintf(fidname, "OBJECTS/%u.%u",ll_insecure_random_int(),current->pid);
- filp = filp_open(fidname, O_CREAT | O_EXCL, 0644);
+ sprintf(idname, "OBJECTS/%u.%u", ll_insecure_random_int(), current->pid);
+ filp = filp_open(idname, O_CREAT | O_EXCL, 0644);
if (IS_ERR(filp)) {
rc = PTR_ERR(filp);
if (rc == -EEXIST) {
CERROR("impossible object name collision %s\n",
- fidname);
+ idname);
LBUG();
}
- CERROR("error creating tmp object %s: rc %d\n", fidname, rc);
+ CERROR("error creating tmp object %s: rc %d\n",
+ idname, rc);
GOTO(out_pop, rc);
}
oa->o_id = filp->f_dentry->d_inode->i_ino;
oa->o_generation = filp->f_dentry->d_inode->i_generation;
- namelen = ll_fid2str(fidname, oa->o_id, oa->o_generation);
- CWARN("created log anonymous "LPU64"/%u\n", oa->o_id, oa->o_generation);
-
- dchild = lookup_one_len(fidname, mds->mds_objects_dir, namelen);
+ idlen = ll_id2str(idname, oa->o_id, oa->o_generation);
+
+ CWARN("created log anonymous "LPU64"/%u\n",
+ oa->o_id, oa->o_generation);
+ dchild = lookup_one_len(idname, mds->mds_objects_dir, idlen);
if (IS_ERR(dchild)) {
CERROR("getting neg dentry for obj rename: %d\n", rc);
GOTO(out_close, rc = PTR_ERR(dchild));
out_close:
err = filp_close(filp, 0);
if (err) {
- CERROR("closing tmpfile %s: rc %d\n", fidname, rc);
+ CERROR("closing tmpfile %s: rc %d\n", idname, rc);
if (!rc)
rc = err;
}
struct inode *parent_inode = mds->mds_objects_dir->d_inode;
struct obd_device *obd = exp->exp_obd;
struct lvfs_run_ctxt saved;
- char fidname[LL_FID_NAMELEN];
+ char idname[LL_ID_NAMELEN];
struct dentry *de;
void *handle;
- int err, namelen, rc = 0;
+ int err, idlen, rc = 0;
ENTRY;
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- namelen = ll_fid2str(fidname, oa->o_id, oa->o_generation);
+ idlen = ll_id2str(idname, oa->o_id, oa->o_generation);
down(&parent_inode->i_sem);
- de = lookup_one_len(fidname, mds->mds_objects_dir, namelen);
+ de = lookup_one_len(idname, mds->mds_objects_dir, idlen);
if (IS_ERR(de) || de->d_inode == NULL) {
rc = IS_ERR(de) ? PTR_ERR(de) : -ENOENT;
CERROR("destroying non-existent object "LPU64" %s: rc %d\n",
- oa->o_id, fidname, rc);
+ oa->o_id, idname, rc);
GOTO(out_dput, rc);
}
/* Stripe count is 1 here since this is some MDS specific stuff
return &_group_hash;
}
-static struct mds_grp_hash_entry * alloc_entry(uid_t uid)
+static struct mds_grp_hash_entry *alloc_entry(uid_t uid)
{
struct mds_grp_hash_entry *entry;
RETURN(rc);
}
-struct mds_grp_hash_entry * mds_get_group_entry(struct mds_obd *mds, uid_t uid)
+struct mds_grp_hash_entry *mds_get_group_entry(struct mds_obd *mds, uid_t uid)
{
- struct mds_grp_hash *hash = &_group_hash;
struct mds_grp_hash_entry *entry = NULL, *new = NULL, *next;
+ struct mds_grp_hash *hash = &_group_hash;
struct list_head *head;
wait_queue_t wait;
int rc, found;
ENTRY;
- LASSERT(hash);
-
head = &hash->gh_table[MDSGRP_HASH_INDEX(uid)];
+
find_again:
found = 0;
spin_lock(&hash->gh_lock);
GRP_SET_ACQUIRING(entry);
GRP_CLEAR_NEW(entry);
entry->ge_acquire_expire = jiffies +
- hash->gh_acquire_expire * HZ;
+ hash->gh_acquire_expire * HZ;
spin_unlock(&hash->gh_lock);
rc = refresh_entry(hash, entry);
}
/* fall through */
}
- /* someone (and only one) is doing upcall upon
- * this item, just wait it complete
+
+ /*
+ * someone (and only one) is doing upcall upon this item, just wait it
+ * complete
*/
if (GRP_IS_ACQUIRING(entry)) {
init_waitqueue_entry(&wait, current);
RETURN(NULL);
}
- /* check expired
- * We can't refresh the existed one because some
- * memory might be shared by multiple processes.
+ /*
+ * check expired. We can't refresh the existed one because some memory
+ * might be shared by multiple processes.
*/
if (check_unlink_entry(entry)) {
- /* if expired, try again. but if this entry is
- * created by me but too quickly turn to expired
- * without any error, should at least give a
- * chance to use it once.
+ /*
+ * if expired, try again. but if this entry is created by me but
+ * too quickly turn to expired without any error, should at
+ * least give a chance to use it once.
*/
if (entry != new) {
put_entry(entry);
RETURN(entry);
}
-
void mds_put_group_entry(struct mds_obd *mds, struct mds_grp_hash_entry *entry)
{
struct mds_grp_hash *hash = &_group_hash;
struct ldlm_res_id *p2_res_id,
struct lustre_handle *p2_lockh, int p2_lock_mode,
ldlm_policy_data_t *p2_policy);
-void mds_commit_cb(struct obd_device *, __u64 last_rcvd, void *data, int error);
+
int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle,
struct ptlrpc_request *req, int rc, __u32 op_data);
void mds_reconstruct_generic(struct ptlrpc_request *req);
void mds_req_from_mcd(struct ptlrpc_request *req, struct mds_client_data *mcd);
int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
- struct ll_fid *fid,
+ struct lustre_id *id,
struct lustre_handle *parent_lockh,
struct dentry **dparentp, int parent_mode,
__u64 parent_lockpart, int *update_mode,
int mds_handle(struct ptlrpc_request *req);
extern struct lvfs_callback_ops mds_lvfs_ops;
int mds_lov_clean(struct obd_device *obd);
-extern int mds_iocontrol(unsigned int cmd, struct obd_export *exp,
- int len, void *karg, void *uarg);
-extern int mds_lock_mode_for_dir(struct obd_device *, struct dentry *, int);
int mds_postrecov(struct obd_device *obd);
+extern struct lvfs_callback_ops mds_lvfs_ops;
+
+extern int mds_iocontrol(unsigned int cmd,
+ struct obd_export *exp,
+ int len, void *karg,
+ void *uarg);
+
+extern int mds_lock_mode_for_dir(struct obd_device *,
+ struct dentry *, int);
+
+int mds_fs_setup_rootid(struct obd_device *obd);
+int mds_fs_setup_virtid(struct obd_device *obd);
+
+int mds_alloc_inode_sid(struct obd_device *, struct inode *,
+ void *, struct lustre_id *);
+
+int mds_update_inode_sid(struct obd_device *, struct inode *,
+ void *, struct lustre_id *);
+
+int mds_read_inode_sid(struct obd_device *, struct inode *,
+ struct lustre_id *);
+
+int mds_update_inode_mid(struct obd_device *, struct inode *,
+ void *, struct lustre_id *);
+
+int mds_read_inode_mid(struct obd_device *, struct inode *,
+ struct lustre_id *);
+
+void mds_commit_last_fid_cb(struct obd_device *, __u64 fid,
+ void *data, int error);
+
+void mds_commit_last_transno_cb(struct obd_device *, __u64 transno,
+ void *data, int error);
+
+void mds_set_last_fid(struct obd_device *obd, __u64 fid);
#ifdef __KERNEL__
-int mds_get_md(struct obd_device *, struct inode *, void *md, int *size,
- int lock);
+int mds_get_md(struct obd_device *, struct inode *, void *md,
+ int *size, int lock);
+
int mds_pack_md(struct obd_device *, struct lustre_msg *, int offset,
struct mds_body *, struct inode *, int lock);
-void mds_pack_dentry2fid(struct ll_fid *, struct dentry *);
-void mds_pack_dentry2body(struct mds_body *b, struct dentry *dentry);
-void mds_pack_inode2fid(struct obd_device *, struct ll_fid *, struct inode *);
-void mds_pack_inode2body(struct obd_device *, struct mds_body *, struct inode *);
+
+int mds_pack_inode2id(struct obd_device *, struct lustre_id *,
+ struct inode *, int);
+
+void mds_pack_inode2body(struct obd_device *, struct mds_body *,
+ struct inode *, int);
+
+void mds_pack_dentry2id(struct obd_device *, struct lustre_id *,
+ struct dentry *, int);
+
+void mds_pack_dentry2body(struct obd_device *, struct mds_body *b,
+ struct dentry *, int);
#endif
/* mds/mds_lmv.c */
struct lustre_handle *);
int mds_lock_and_check_slave(int, struct ptlrpc_request *, struct lustre_handle *);
int mds_convert_mea_ea(struct obd_device *, struct inode *, struct lov_mds_md *, int);
+int mds_is_dir_empty(struct obd_device *, struct dentry *);
/* mds_groups.c */
int mds_group_hash_init(void);
#include <linux/lustre_lib.h>
#include "mds_internal.h"
-#include "mds_internal.h"
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
struct group_info *groups_alloc(int ngroups)
{
}
return 0;
}
-
#endif
void groups_from_buffer(struct group_info *ginfo, __u32 *gids)
}
}
-void mds_pack_dentry2fid(struct ll_fid *fid, struct dentry *dentry)
+void mds_pack_dentry2id(struct obd_device *obd,
+ struct lustre_id *id,
+ struct dentry *dentry,
+ int read_fid)
{
- fid->id = dentry->d_inum;
- fid->generation = dentry->d_generation;
- fid->mds = dentry->d_mdsnum;
+ id_ino(id) = dentry->d_inum;
+ id_gen(id) = dentry->d_generation;
+
+ if (read_fid) {
+ id_fid(id) = dentry->d_fid;
+ id_group(id) = dentry->d_mdsnum;
+ }
}
-void mds_pack_dentry2body(struct mds_body *b, struct dentry *dentry)
+void mds_pack_dentry2body(struct obd_device *obd,
+ struct mds_body *b,
+ struct dentry *dentry,
+ int read_fid)
{
- b->valid |= OBD_MD_FLID | OBD_MD_FLGENER;
- b->ino = dentry->d_inum;
- b->generation = dentry->d_generation;
- b->mds = dentry->d_mdsnum;
+ b->valid |= OBD_MD_FLID | OBD_MD_FLGENER |
+ OBD_MD_MDS;
+
+ if (read_fid)
+ b->valid |= OBD_MD_FID;
+
+ mds_pack_dentry2id(obd, &b->id1, dentry,
+ read_fid);
}
-void mds_pack_inode2fid(struct obd_device *obd, struct ll_fid *fid,
- struct inode *inode)
+int mds_pack_inode2id(struct obd_device *obd,
+ struct lustre_id *id,
+ struct inode *inode,
+ int read_fid)
{
- if (!obd || !fid || !inode) {
- printk("obd %p, fid %p, inode %p\n", obd, fid, inode);
- LBUG();
+ int rc = 0;
+ ENTRY;
+
+ if (read_fid) {
+ /* we have to avoid deadlock. */
+ if (!down_trylock(&inode->i_sem)) {
+ rc = mds_read_inode_sid(obd, inode, id);
+ up(&inode->i_sem);
+ } else {
+ rc = mds_read_inode_sid(obd, inode, id);
+ }
}
- fid->id = inode->i_ino;
- fid->generation = inode->i_generation;
- fid->f_type = (S_IFMT & inode->i_mode);
- fid->mds = obd->u.mds.mds_num;
+ if (rc == 0) {
+ id_ino(id) = inode->i_ino;
+ id_gen(id) = inode->i_generation;
+ id_type(id) = (S_IFMT & inode->i_mode);
+ }
+ RETURN(rc);
}
/* Note that we can copy all of the fields, just some will not be "valid" */
void mds_pack_inode2body(struct obd_device *obd, struct mds_body *b,
- struct inode *inode)
+ struct inode *inode, int read_fid)
{
b->valid |= OBD_MD_FLID | OBD_MD_FLCTIME | OBD_MD_FLUID |
- OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLTYPE |
- OBD_MD_FLMODE | OBD_MD_FLNLINK | OBD_MD_FLGENER |
- OBD_MD_FLATIME | OBD_MD_FLMTIME; /* bug 2020 */
-
- if (!S_ISREG(inode->i_mode))
- b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLATIME |
- OBD_MD_FLMTIME | OBD_MD_FLRDEV;
-
- b->ino = inode->i_ino;
+ OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLTYPE |
+ OBD_MD_FLMODE | OBD_MD_FLNLINK | OBD_MD_FLGENER |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME; /* bug 2020 */
+
+ if (!S_ISREG(inode->i_mode)) {
+ b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME |
+ OBD_MD_FLRDEV;
+ }
b->atime = LTIME_S(inode->i_atime);
b->mtime = LTIME_S(inode->i_mtime);
b->ctime = LTIME_S(inode->i_ctime);
b->gid = inode->i_gid;
b->flags = inode->i_flags;
b->rdev = inode->i_rdev;
+
/* Return the correct link count for orphan inodes */
if (mds_inode_is_orphan(inode)) {
b->nlink = 0;
} else {
b->nlink = inode->i_nlink;
}
- b->generation = inode->i_generation;
- b->mds = obd->u.mds.mds_num;
+ if (read_fid)
+ b->valid |= OBD_MD_FID;
+ mds_pack_inode2id(obd, &b->id1, inode, read_fid);
}
/* unpacking */
if (rec == NULL)
RETURN (-EFAULT);
- r->ur_fid1 = &rec->sa_fid;
+ r->ur_id1 = &rec->sa_id;
attr->ia_valid = rec->sa_valid;
attr->ia_mode = rec->sa_mode;
attr->ia_uid = rec->sa_uid;
}
if (req->rq_reqmsg->bufcount > offset + 2) {
- r->ur_logcookies = lustre_msg_buf(req->rq_reqmsg, offset + 2,0);
+ r->ur_logcookies = lustre_msg_buf(req->rq_reqmsg, offset + 2, 0);
if (r->ur_eadata == NULL)
RETURN (-EFAULT);
if (rec == NULL)
RETURN (-EFAULT);
- r->ur_fid1 = &rec->cr_fid;
- r->ur_fid2 = &rec->cr_replayfid;
+ r->ur_id1 = &rec->cr_id;
+ r->ur_id2 = &rec->cr_replayid;
r->ur_mode = rec->cr_mode;
r->ur_rdev = rec->cr_rdev;
r->ur_time = rec->cr_time;
if (rec == NULL)
RETURN (-EFAULT);
- r->ur_fid1 = &rec->lk_fid1;
- r->ur_fid2 = &rec->lk_fid2;
+ r->ur_id1 = &rec->lk_id1;
+ r->ur_id2 = &rec->lk_id2;
r->ur_time = rec->lk_time;
LASSERT_REQSWAB (req, offset + 1);
RETURN(-EFAULT);
r->ur_mode = rec->ul_mode;
- r->ur_fid1 = &rec->ul_fid1;
- r->ur_fid2 = &rec->ul_fid2;
+ r->ur_id1 = &rec->ul_id1;
+ r->ur_id2 = &rec->ul_id2;
r->ur_time = rec->ul_time;
LASSERT_REQSWAB (req, offset + 1);
if (rec == NULL)
RETURN(-EFAULT);
- r->ur_fid1 = &rec->rn_fid1;
- r->ur_fid2 = &rec->rn_fid2;
+ r->ur_id1 = &rec->rn_id1;
+ r->ur_id2 = &rec->rn_id2;
r->ur_time = rec->rn_time;
LASSERT_REQSWAB (req, offset + 1);
if (rec == NULL)
RETURN (-EFAULT);
- r->ur_fid1 = &rec->cr_fid;
- r->ur_fid2 = &rec->cr_replayfid;
+ r->ur_id1 = &rec->cr_id;
+ r->ur_id2 = &rec->cr_replayid;
r->ur_mode = rec->cr_mode;
r->ur_rdev = rec->cr_rdev;
r->ur_time = rec->cr_time;
int rc;
ENTRY;
- /* NB don't lustre_swab_reqbuf() here. We're just taking a peek
- * and we want to leave it to the specific unpacker once we've
- * identified the message type */
- opcodep = lustre_msg_buf (req->rq_reqmsg, offset, sizeof (*opcodep));
+ /*
+ * NB don't lustre_swab_reqbuf() here. We're just taking a peek and we
+ * want to leave it to the specific unpacker once we've identified the
+ * message type.
+ */
+ opcodep = lustre_msg_buf (req->rq_reqmsg, offset, sizeof(*opcodep));
if (opcodep == NULL)
RETURN(-EFAULT);
RETURN(-EFAULT);
}
+ rec->ur_id1 = NULL;
+ rec->ur_id2 = NULL;
rec->ur_opcode = opcode;
+
rc = mds_unpackers[opcode](req, offset, rec);
RETURN(rc);
}
get_group_info(ucred->luc_ginfo);
}
- /* everything is done if we don't allow setgroups */
+ /* everything is done if we don't allow set groups */
if (!mds_allow_setgroups())
RETURN(0);
drop_ucred_ginfo(ucred);
ucred->luc_ginfo = gnew;
} else {
- struct group_info *ginfo;
__u32 set = 0, cur = 0;
+ struct group_info *ginfo;
/* if no group info in hash, we don't
* bother createing new
* - error handling is totally missed
*/
-int mds_lmv_connect(struct obd_device *obd, char * lmv_name)
+int mds_lmv_connect(struct obd_device *obd, char *lmv_name)
{
struct mds_obd *mds = &obd->u.mds;
struct lustre_handle conn = {0};
GOTO(err_last, rc = -ENOTCONN);
}
- rc = obd_connect(&conn, mds->mds_lmv_obd, &obd->obd_uuid, OBD_OPT_MDS_CONNECTION);
+ rc = obd_connect(&conn, mds->mds_lmv_obd,
+ &obd->obd_uuid, OBD_OPT_MDS_CONNECTION);
if (rc) {
CERROR("MDS cannot connect to LMV %s (%d)\n",
lmv_name, rc);
}
/* retrieve size of EA */
- rc = obd_get_info(mds->mds_lmv_exp, strlen("mdsize"), "mdsize",
- &valsize, &value);
+ rc = obd_get_info(mds->mds_lmv_exp, strlen("mdsize"),
+ "mdsize", &valsize, &value);
if (rc)
GOTO(err_reg, rc);
mds->mds_max_mdsize = value;
/* find our number in LMV cluster */
- rc = obd_get_info(mds->mds_lmv_exp, strlen("mdsnum"), "mdsnum",
- &valsize, &value);
+ rc = obd_get_info(mds->mds_lmv_exp, strlen("mdsnum"),
+ "mdsnum", &valsize, &value);
if (rc)
GOTO(err_reg, rc);
int rc = 0;
ENTRY;
- if (mds->mds_lmv_exp)
- rc = obd_init_ea_size(mds->mds_lmv_exp, mds->mds_max_mdsize,
+ if (mds->mds_lmv_exp) {
+ rc = obd_init_ea_size(mds->mds_lmv_exp,
+ mds->mds_max_mdsize,
mds->mds_max_cookiesize);
+ }
RETURN(rc);
}
int rc = 0;
ENTRY;
+ if (!mds->mds_lmv_connected)
+ RETURN(0);
+
down(&mds->mds_lmv_sem);
if (!IS_ERR(mds->mds_lmv_obd) && mds->mds_lmv_exp != NULL) {
- LASSERT(mds->mds_lmv_connected != 0);
- mds->mds_lmv_connected = 0;
+ LASSERT(mds->mds_lmv_connected);
+
obd_register_observer(mds->mds_lmv_obd, NULL);
- /* if obd_disconnect fails (probably because the export was
- * disconnected by class_disconnect_exports) then we just need
- * to drop our ref. */
+ if (flags & OBD_OPT_FORCE) {
+ struct obd_device *lmv_obd;
+ struct obd_ioctl_data ioc_data = { 0 };
+
+ lmv_obd = class_exp2obd(mds->mds_lmv_exp);
+ if (lmv_obd == NULL)
+ GOTO(out, rc = 0);
+
+ /*
+ * making disconnecting lmv stuff do not send anything
+ * to all remote MDSs from LMV. This is needed to
+ * prevent possible hanging with endless recovery, when
+ * MDS sends disconnect to already disconnected
+ * target. Probably this is wrong, but client does the
+ * same in --force mode and I do not see why can't we do
+ * it here. --umka.
+ */
+ lmv_obd->obd_no_recov = 1;
+ obd_iocontrol(IOC_OSC_SET_ACTIVE, mds->mds_lmv_exp,
+ sizeof(ioc_data), &ioc_data, NULL);
+ }
+
+ /*
+ * if obd_disconnect() fails (probably because the export was
+ * disconnected by class_disconnect_exports()) then we just need
+ * to drop our ref.
+ */
+ mds->mds_lmv_connected = 0;
rc = obd_disconnect(mds->mds_lmv_exp, flags);
if (rc)
class_export_put(mds->mds_lmv_exp);
-
+
+ out:
mds->mds_lmv_exp = NULL;
mds->mds_lmv_obd = NULL;
}
up(&mds->mds_lmv_sem);
-
RETURN(rc);
}
__u16 mds;
__u32 ino;
__u32 generation;
+ __u32 fid;
char name[0];
};
#define DIR_PAD 4
#define DIR_ROUND (DIR_PAD - 1)
-#define DIR_REC_LEN(name_len) (((name_len) + 12 + DIR_ROUND) & ~DIR_ROUND)
+#define DIR_REC_LEN(name_len) (((name_len) + 16 + DIR_ROUND) & ~DIR_ROUND)
/* this struct holds dir entries for particular MDS to be flushed */
struct dir_cache {
struct mds_obd *mds = &dc->obd->u.mds;
struct dir_entry *de;
struct dentry *dentry;
- char * end;
+ char *end;
end = buf + PAGE_SIZE;
de = (struct dir_entry *) buf;
while ((char *) de < end && de->namelen) {
/* lookup an inode */
LASSERT(de->namelen <= 255);
- dentry = ll_lookup_one_len(de->name, dc->dentry, de->namelen);
+ dentry = ll_lookup_one_len(de->name, dc->dentry,
+ de->namelen);
if (IS_ERR(dentry)) {
CERROR("can't lookup %*s: %d\n", de->namelen,
de->name, (int) PTR_ERR(dentry));
goto next;
}
if (dentry->d_inode != NULL) {
+ int rc;
+ struct lustre_id sid;
+
+ down(&dentry->d_inode->i_sem);
+ rc = mds_read_inode_sid(dc->obd,
+ dentry->d_inode, &sid);
+ up(&dentry->d_inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, "
+ "inode %lu, rc %d\n",
+ dentry->d_inode->i_ino, rc);
+ goto next;
+ }
+
+ de->fid = id_fid(&sid);
de->mds = mds->mds_num;
de->ino = dentry->d_inode->i_ino;
de->generation = dentry->d_inode->i_generation;
} else if (dentry->d_flags & DCACHE_CROSS_REF) {
- de->mds = dentry->d_mdsnum;
+ de->fid = dentry->d_fid;
de->ino = dentry->d_inum;
+ de->mds = dentry->d_mdsnum;
de->generation = dentry->d_generation;
} else {
CERROR("can't lookup %*s\n", de->namelen, de->name);
/* lookup an inode */
LASSERT(de->namelen <= 255);
- dentry = ll_lookup_one_len(de->name, dc->dentry,
+ dentry = ll_lookup_one_len(de->name, dc->dentry,
de->namelen);
if (IS_ERR(dentry)) {
CERROR("can't lookup %*s: %d\n", de->namelen,
- de->name, (int) PTR_ERR(dentry));
+ de->name, (int) PTR_ERR(dentry));
goto next;
}
rc = fsfilt_del_dir_entry(dc->obd, dentry);
RETURN(0);
}
-static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
- ino_t ino, unsigned int d_type)
+static int filldir(void * __buf, const char * name, int namlen,
+ loff_t offset, ino_t ino, unsigned int d_type)
{
struct dirsplit_control *dc = __buf;
struct mds_obd *mds = &dc->obd->u.mds;
char *n;
ENTRY;
- if (name[0] == '.' && (namlen == 1 ||
- (namlen == 2 && name[1] == '.'))) {
+ if (name[0] == '.' &&
+ (namlen == 1 || (namlen == 2 && name[1] == '.'))) {
/* skip special entries */
RETURN(0);
}
}
int scan_and_distribute(struct obd_device *obd, struct dentry *dentry,
- struct mea *mea)
+ struct mea *mea)
{
struct inode *dir = dentry->d_inode;
struct dirsplit_control dc;
OBD_ALLOC(file_name, nlen);
if (!file_name)
RETURN(-ENOMEM);
- i = sprintf(file_name, "__iopen__/0x%lx", dentry->d_inode->i_ino);
+
+ i = sprintf(file_name, "__iopen__/0x%lx",
+ dentry->d_inode->i_ino);
file = filp_open(file_name, O_RDONLY, 0);
if (IS_ERR(file)) {
RETURN(err);
}
-#define MAX_DIR_SIZE (64 * 1024)
-
-#define I_NON_SPLITTABLE 256
+#define MAX_DIR_SIZE (64 * 1024)
+#define I_NON_SPLITTABLE (256)
int mds_splitting_expected(struct obd_device *obd, struct dentry *dentry)
{
/* clustered MD ? */
if (!mds->mds_lmv_obd)
- RETURN(MDS_NO_SPLITTABLE);
+ return MDS_NO_SPLITTABLE;
/* inode exist? */
if (dentry->d_inode == NULL)
return MDS_NO_SPLITTABLE;
/* don't split root directory */
- if (dentry->d_inode->i_ino == mds->mds_rootfid.id)
+ if (dentry->d_inode->i_ino == id_ino(&mds->mds_rootid))
return MDS_NO_SPLITTABLE;
/* large enough to be splitted? */
rc = MDS_NO_SPLITTABLE;
/* mark to skip subsequent checks */
dentry->d_inode->i_flags |= I_NON_SPLITTABLE;
+ OBD_FREE(mea, size);
} else {
/* may be splitted */
rc = MDS_EXPECT_SPLIT;
}
- if (mea)
- OBD_FREE(mea, size);
- RETURN(rc);
+ return rc;
}
/*
struct mea *tmea = NULL;
struct obdo *oa = NULL;
int rc, mea_size = 0;
+ struct lustre_id id;
void *handle;
ENTRY;
if (update_mode != LCK_EX)
return 0;
+
/* TODO: optimization possible - we already may have mea here */
rc = mds_splitting_expected(obd, dentry);
if (rc == MDS_NO_SPLITTABLE)
RETURN(rc);
}
if (*mea == NULL)
- RETURN(-EINVAL);
+ RETURN(-ENOMEM);
(*mea)->mea_count = nstripes;
if (!oa)
RETURN(-ENOMEM);
- oa->o_id = dir->i_ino;
oa->o_generation = dir->i_generation;
obdo_from_inode(oa, dir, OBD_MD_FLTYPE | OBD_MD_FLATIME |
oa->o_gr = FILTER_GROUP_FIRST_MDS + mds->mds_num;
oa->o_valid |= OBD_MD_FLID | OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
oa->o_mode = dir->i_mode;
+ oa->o_id = dir->i_ino;
+
+ down(&dir->i_sem);
+ rc = mds_read_inode_sid(obd, dir, &id);
+ up(&dir->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, inode %lu, "
+ "rc %d.\n", dir->i_ino, rc);
+ GOTO(err_oa, rc);
+ }
+ oa->o_fid = id_fid(&id);
CDEBUG(D_OTHER, "%s: create subdirs with mode %o, uid %u, gid %u\n",
- obd->obd_name, dir->i_mode, dir->i_uid, dir->i_gid);
+ obd->obd_name, dir->i_mode, dir->i_uid, dir->i_gid);
rc = obd_create(mds->mds_lmv_exp, oa,
(struct lov_stripe_md **)mea, NULL);
- if (rc)
+ if (rc) {
+ CERROR("Can't create remote inode, rc = %d\n", rc);
GOTO(err_oa, rc);
+ }
+ LASSERT(id_fid(&(*mea)->mea_ids[0]));
CDEBUG(D_OTHER, "%d dirobjects created\n", (int)(*mea)->mea_count);
/* 2) update dir attribute */
CERROR("fsfilt_start() failed: %d\n", (int) PTR_ERR(handle));
GOTO(err_oa, rc = PTR_ERR(handle));
}
-
+
rc = fsfilt_set_md(obd, dir, handle, *mea, mea_size);
if (rc) {
up(&dir->i_sem);
return 0;
}
-struct dentry *filter_fid2dentry(struct obd_device *obd,
- struct dentry *dir_dentry,
- obd_gr group, obd_id id);
+struct dentry *filter_id2dentry(struct obd_device *obd,
+ struct dentry *dir_dentry,
+ obd_gr group, obd_id id);
int mds_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
int objcount, struct obd_ioobj *obj,
struct niobuf_local *res,
struct obd_trans_info *oti)
{
- struct mds_obd *mds = &exp->exp_obd->u.mds;
struct niobuf_remote *rnb;
struct niobuf_local *lnb = NULL;
int rc = 0, i, tot_bytes = 0;
unsigned long now = jiffies;
struct dentry *dentry;
- struct ll_fid fid;
+ struct lustre_id id;
ENTRY;
LASSERT(objcount == 1);
LASSERT(obj->ioo_bufcnt > 0);
memset(res, 0, niocount * sizeof(*res));
- fid.id = obj->ioo_id;
- fid.generation = obj->ioo_gr;
- dentry = mds_fid2dentry(mds, &fid, NULL);
+ id_fid(&id) = 0;
+ id_group(&id) = 0;
+ id_ino(&id) = obj->ioo_id;
+ id_gen(&id) = obj->ioo_gr;
+
+ dentry = mds_id2dentry(exp->exp_obd, &id, NULL);
if (IS_ERR(dentry)) {
CERROR("can't get dentry for "LPU64"/%u: %d\n",
- fid.id, fid.generation, (int) PTR_ERR(dentry));
+ id.li_stc.u.e3s.l3s_ino, id.li_stc.u.e3s.l3s_gen,
+ (int)PTR_ERR(dentry));
GOTO(cleanup, rc = (int) PTR_ERR(dentry));
}
while ((char *) de < end && de->namelen) {
err = fsfilt_add_dir_entry(obd, res->dentry, de->name,
de->namelen, de->ino,
- de->generation, de->mds);
+ de->generation, de->mds,
+ de->fid);
if (err) {
CERROR("can't add dir entry %*s->%u/%u/%u"
- " to %lu/%u: %d\n",
- de->namelen, de->name,
- de->mds, (unsigned) de->ino,
+ " to %lu/%u: %d\n", de->namelen,
+ de->name, de->mds, (unsigned)de->ino,
(unsigned) de->generation,
res->dentry->d_inode->i_ino,
res->dentry->d_inode->i_generation,
struct lookup_intent it;
struct mea *mea = NULL;
int mea_size, rc;
+ int handle_size;
+ ENTRY;
LASSERT(rlockh != NULL);
LASSERT(dentry != NULL);
/* clustered MD ? */
if (!mds->mds_lmv_obd)
- return 0;
+ RETURN(0);
/* a dir can be splitted only */
if (!S_ISDIR(dentry->d_inode->i_mode))
- return 0;
+ RETURN(0);
- rc = mds_get_lmv_attr(obd, dentry->d_inode, &mea, &mea_size);
+ rc = mds_get_lmv_attr(obd, dentry->d_inode,
+ &mea, &mea_size);
if (rc)
- return rc;
+ RETURN(rc);
if (mea == NULL)
- return 0;
- if (mea->mea_count == 0) {
+ RETURN(0);
+
+ if (mea->mea_count == 0)
/* this is slave object */
GOTO(cleanup, rc = 0);
- }
- CDEBUG(D_OTHER, "%s: lock slaves for %lu/%lu\n", obd->obd_name,
- (unsigned long) dentry->d_inode->i_ino,
- (unsigned long) dentry->d_inode->i_generation);
+ CDEBUG(D_OTHER, "%s: lock slaves for %lu/%lu\n",
+ obd->obd_name, (unsigned long)dentry->d_inode->i_ino,
+ (unsigned long)dentry->d_inode->i_generation);
- OBD_ALLOC(*rlockh, sizeof(struct lustre_handle) * mea->mea_count);
+ handle_size = sizeof(struct lustre_handle) *
+ mea->mea_count;
+
+ OBD_ALLOC(*rlockh, handle_size);
if (*rlockh == NULL)
GOTO(cleanup, rc = -ENOMEM);
- memset(*rlockh, 0, sizeof(struct lustre_handle) * mea->mea_count);
+ memset(*rlockh, 0, handle_size);
memset(&op_data, 0, sizeof(op_data));
+
op_data.mea1 = mea;
it.it_op = IT_UNLINK;
- rc = md_enqueue(mds->mds_lmv_exp, LDLM_IBITS, &it, LCK_EX, &op_data,
- *rlockh, NULL, 0, ldlm_completion_ast, mds_blocking_ast,
- NULL);
+
+ rc = md_enqueue(mds->mds_lmv_exp, LDLM_IBITS, &it, LCK_EX,
+ &op_data, *rlockh, NULL, 0, ldlm_completion_ast,
+ mds_blocking_ast, NULL);
cleanup:
OBD_FREE(mea, mea_size);
RETURN(rc);
return -ENOTEMPTY;
}
+/* checks if passed dentry points to empty dir. */
int mds_is_dir_empty(struct obd_device *obd, struct dentry *dentry)
{
struct ide_tracking it;
OBD_ALLOC(file_name, nlen);
if (!file_name)
RETURN(-ENOMEM);
- i = sprintf(file_name, "__iopen__/0x%lx", dentry->d_inode->i_ino);
+
+ LASSERT(dentry->d_inode != NULL);
+ i = sprintf(file_name, "__iopen__/0x%lx",
+ dentry->d_inode->i_ino);
file = filp_open(file_name, O_RDONLY, 0);
if (IS_ERR(file)) {
CERROR("Can't swab mds_body\n");
GOTO(cleanup, rc = -EFAULT);
}
- CDEBUG(D_OTHER, "%s: check slave %lu/%lu\n", obd->obd_name,
- (unsigned long) body->fid1.id,
- (unsigned long) body->fid1.generation);
- dentry = mds_fid2locked_dentry(obd, &body->fid1, NULL, LCK_EX, lockh,
- &update_mode, NULL, 0,
- MDS_INODELOCK_UPDATE);
+ CDEBUG(D_OTHER, "%s: check slave "DLID4"\n", obd->obd_name,
+ OLID4(&body->id1));
+
+ dentry = mds_id2locked_dentry(obd, &body->id1, NULL, LCK_EX,
+ lockh, &update_mode, NULL, 0,
+ MDS_INODELOCK_UPDATE);
if (IS_ERR(dentry)) {
CERROR("can't find inode: %d\n", (int) PTR_ERR(dentry));
GOTO(cleanup, rc = PTR_ERR(dentry));
RETURN(0);
old = (struct mea_old *) lmm;
- rc = sizeof(struct ll_fid) * old->mea_count + sizeof(struct mea_old);
+
+ rc = sizeof(struct lustre_id) * old->mea_count +
+ sizeof(struct mea_old);
+
if (old->mea_count > 256 || old->mea_master > 256 || lmmsize < rc
|| old->mea_master > old->mea_count) {
CWARN("unknown MEA format, dont convert it\n");
}
CWARN("converting MEA EA on %lu/%u from V0 to V1 (%u/%u)\n",
- inode->i_ino, inode->i_generation, old->mea_count, old->mea_master);
+ inode->i_ino, inode->i_generation, old->mea_count,
+ old->mea_master);
- size = sizeof(struct ll_fid) * old->mea_count + sizeof(struct mea);
+ size = sizeof(struct lustre_id) * old->mea_count +
+ sizeof(struct mea);
+
OBD_ALLOC(new, size);
if (new == NULL)
RETURN(-ENOMEM);
new->mea_count = old->mea_count;
new->mea_master = old->mea_master;
for (i = 0; i < new->mea_count; i++)
- new->mea_fids[i] = old->mea_fids[i];
+ new->mea_ids[i] = old->mea_ids[i];
handle = fsfilt_start(obd, inode, FSFILT_OP_SETATTR, NULL);
if (IS_ERR(handle)) {
struct rw_semaphore **lock, int *lock_count)
{
struct obd_device *obd = ctxt->loc_obd;
- struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
+ struct obd_device *lov_obd = obd->u.mds.mds_lov_obd;
struct llog_ctxt *lctxt;
int rc;
ENTRY;
struct llog_gen *gen, struct obd_uuid *uuid)
{
struct obd_device *obd = ctxt->loc_obd;
- struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
+ struct obd_device *lov_obd = obd->u.mds.mds_lov_obd;
struct llog_ctxt *lctxt;
int rc;
ENTRY;
void *data)
{
struct obd_device *obd = ctxt->loc_obd;
- struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
+ struct obd_device *lov_obd = obd->u.mds.mds_lov_obd;
struct llog_ctxt *lctxt;
int rc;
ENTRY;
int lock_count = 0;
ENTRY;
- if (IS_ERR(mds->mds_osc_obd))
- RETURN(PTR_ERR(mds->mds_osc_obd));
+ if (IS_ERR(mds->mds_lov_obd))
+ RETURN(PTR_ERR(mds->mds_lov_obd));
RETURN(0);
- rc = obd_unpackmd(mds->mds_osc_exp, &lsm,
- lmm, lmm_size);
+ rc = obd_unpackmd(mds->mds_lov_exp, &lsm, lmm, lmm_size);
if (rc < 0)
RETURN(rc);
cookies_size / sizeof(struct llog_cookie), NULL,
res ? &lcl->lcl_locks[0] : NULL, &lock_count);
- obd_free_memmd(mds->mds_osc_exp, &lsm);
+ obd_free_memmd(mds->mds_lov_exp, &lsm);
if (res && (rc <= 0 || lock_count == 0)) {
OBD_FREE(lcl, size);
int mds_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
struct obd_device *tgt, int count, struct llog_catid *logid)
{
- struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
+ struct obd_device *lov_obd = obd->u.mds.mds_lov_obd;
int rc;
ENTRY;
int mds_llog_finish(struct obd_device *obd, struct obd_llogs *llogs, int count)
{
- struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
+ struct obd_device *lov_obd = obd->u.mds.mds_lov_obd;
int rc;
ENTRY;
memcpy(&oa.o_inline, ost_uuid, sizeof(*ost_uuid));
oa.o_valid |= OBD_MD_FLINLINE;
}
- rc = obd_create(mds->mds_osc_exp, &oa, &empty_ea, &oti);
+ rc = obd_create(mds->mds_lov_exp, &oa, &empty_ea, &oti);
RETURN(rc);
}
LASSERT(mds->mds_lov_objids != NULL);
- rc = obd_set_info(mds->mds_osc_exp, strlen("next_id"), "next_id",
+ rc = obd_set_info(mds->mds_lov_exp, strlen("next_id"), "next_id",
mds->mds_lov_desc.ld_tgt_count, mds->mds_lov_objids);
RETURN(rc);
}
int rc;
ENTRY;
- rc = obd_set_info(mds->mds_osc_exp, strlen("growth_count"),
+ rc = obd_set_info(mds->mds_lov_exp, strlen("growth_count"),
"growth_count", sizeof(count), &count);
RETURN(rc);
int rc, i;
ENTRY;
- if (IS_ERR(mds->mds_osc_obd))
- RETURN(PTR_ERR(mds->mds_osc_obd));
+ if (IS_ERR(mds->mds_lov_obd))
+ RETURN(PTR_ERR(mds->mds_lov_obd));
- if (mds->mds_osc_obd)
+ if (mds->mds_lov_obd)
RETURN(0);
spin_lock_init(&mds->mds_lov_lock);
- mds->mds_osc_obd = class_name2obd(lov_name);
- if (!mds->mds_osc_obd) {
+ mds->mds_lov_obd = class_name2obd(lov_name);
+ if (!mds->mds_lov_obd) {
CERROR("MDS cannot locate LOV %s\n", lov_name);
- mds->mds_osc_obd = ERR_PTR(-ENOTCONN);
+ mds->mds_lov_obd = ERR_PTR(-ENOTCONN);
RETURN(-ENOTCONN);
}
CDEBUG(D_HA, "obd: %s osc: %s lov_name: %s\n",
- obd->obd_name, mds->mds_osc_obd->obd_name, lov_name);
+ obd->obd_name, mds->mds_lov_obd->obd_name, lov_name);
- rc = obd_connect(&conn, mds->mds_osc_obd, &obd->obd_uuid,
+ rc = obd_connect(&conn, mds->mds_lov_obd, &obd->obd_uuid,
mds->mds_num + FILTER_GROUP_FIRST_MDS);
if (rc) {
CERROR("MDS cannot connect to LOV %s (%d)\n", lov_name, rc);
- mds->mds_osc_obd = ERR_PTR(rc);
+ mds->mds_lov_obd = ERR_PTR(rc);
RETURN(rc);
}
- mds->mds_osc_exp = class_conn2export(&conn);
+ mds->mds_lov_exp = class_conn2export(&conn);
- rc = obd_register_observer(mds->mds_osc_obd, obd);
+ rc = obd_register_observer(mds->mds_lov_obd, obd);
if (rc) {
CERROR("MDS cannot register as observer of LOV %s (%d)\n",
lov_name, rc);
GOTO(err_discon, rc);
}
- rc = mds_lov_update_desc(obd, mds->mds_osc_exp);
+ rc = mds_lov_update_desc(obd, mds->mds_lov_exp);
if (rc)
GOTO(err_reg, rc);
* we need to populate the objids array from the real OST values */
if (!mds->mds_lov_objids_valid) {
int size = sizeof(obd_id) * mds->mds_lov_desc.ld_tgt_count;
- rc = obd_get_info(mds->mds_osc_exp, strlen("last_id"),
+ rc = obd_get_info(mds->mds_lov_exp, strlen("last_id"),
"last_id", &size, mds->mds_lov_objids);
if (!rc) {
for (i = 0; i < mds->mds_lov_desc.ld_tgt_count; i++)
RETURN(rc);
err_reg:
- obd_register_observer(mds->mds_osc_obd, NULL);
+ obd_register_observer(mds->mds_lov_obd, NULL);
err_discon:
- obd_disconnect(mds->mds_osc_exp, 0);
- mds->mds_osc_exp = NULL;
- mds->mds_osc_obd = ERR_PTR(rc);
+ obd_disconnect(mds->mds_lov_exp, 0);
+ mds->mds_lov_exp = NULL;
+ mds->mds_lov_obd = ERR_PTR(rc);
RETURN(rc);
}
int rc = 0;
ENTRY;
- if (!IS_ERR(mds->mds_osc_obd) && mds->mds_osc_exp != NULL) {
+ if (!IS_ERR(mds->mds_lov_obd) && mds->mds_lov_exp != NULL) {
/* cleanup all llogging subsystems */
rc = obd_llog_finish(obd, &obd->obd_llogs,
mds->mds_lov_desc.ld_tgt_count);
if (rc)
CERROR("failed to cleanup llogging subsystems\n");
- obd_register_observer(mds->mds_osc_obd, NULL);
+ obd_register_observer(mds->mds_lov_obd, NULL);
- rc = obd_disconnect(mds->mds_osc_exp, flags);
+ rc = obd_disconnect(mds->mds_lov_exp, flags);
/* if obd_disconnect fails (probably because the
* export was disconnected by class_disconnect_exports)
* then we just need to drop our ref. */
if (rc != 0)
- class_export_put(mds->mds_osc_exp);
- mds->mds_osc_exp = NULL;
- mds->mds_osc_obd = NULL;
+ class_export_put(mds->mds_lov_exp);
+ mds->mds_lov_exp = NULL;
+ mds->mds_lov_obd = NULL;
}
RETURN(rc);
CATLIST);
group = FILTER_GROUP_FIRST_MDS + mds->mds_num;
valsize = sizeof(group);
- rc2 = obd_set_info(mds->mds_osc_exp, strlen("mds_conn"),
+ rc2 = obd_set_info(mds->mds_lov_exp, strlen("mds_conn"),
"mds_conn", valsize, &group);
if (!rc)
rc = rc2;
old_count = mds->mds_lov_desc.ld_tgt_count;
- rc = mds_lov_update_desc(obd, mds->mds_osc_exp);
+ rc = mds_lov_update_desc(obd, mds->mds_lov_exp);
if (rc)
RETURN(rc);
ctxt = llog_get_context(&obd->obd_llogs, LLOG_CONFIG_ORIG_CTXT);
rc = class_config_process_llog(ctxt, name, &cfg);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- if (rc == 0) {
+ if (rc == 0)
mds->mds_config_version = version;
- }
CWARN("Finished applying configuration log %s: %d\n", name, rc);
OBD_FREE(name, namelen);
CDEBUG(D_INODE, "converting LOV EA on %lu/%u from V0 to V1\n",
inode->i_ino, inode->i_generation);
- rc = obd_unpackmd(obd->u.mds.mds_osc_exp, &lsm, lmm, lmm_size);
+ rc = obd_unpackmd(obd->u.mds.mds_lov_exp, &lsm, lmm, lmm_size);
if (rc < 0)
GOTO(conv_end, rc);
- rc = obd_packmd(obd->u.mds.mds_osc_exp, &lmm, lsm);
+ rc = obd_packmd(obd->u.mds.mds_lov_exp, &lmm, lsm);
if (rc < 0)
GOTO(conv_free, rc);
lmm_size = rc;
rc = err ? err : lmm_size;
GOTO(conv_free, rc);
conv_free:
- obd_free_memmd(obd->u.mds.mds_osc_exp, &lsm);
+ obd_free_memmd(obd->u.mds.mds_lov_exp, &lsm);
conv_end:
return rc;
}
struct lustre_msg *msg, int offset)
{
struct mds_obd *mds = &obd->u.mds;
- struct obd_export *osc_exp = mds->mds_osc_exp;
+ struct obd_export *osc_exp = mds->mds_lov_exp;
struct lov_mds_md *lmm= NULL;
struct lov_stripe_md *lsm = NULL;
struct obdo *oa;
/* replay case */
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
- LASSERT (rec->ur_fid2->id);
+ LASSERT(id_ino(rec->ur_id2));
body->valid |= OBD_MD_FLBLKSZ | OBD_MD_FLEASIZE;
lmm_size = rec->ur_eadatalen;
lmm = rec->ur_eadata;
/* check if things like lfs setstripe are sending us the ea */
if (rec->ur_flags & MDS_OPEN_HAS_EA) {
rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE,
- mds->mds_osc_exp,
+ mds->mds_lov_exp,
0, &lsm, rec->ur_eadata);
if (rc)
GOTO(out_oa, rc);
* striping for CMD. -p */
}
LASSERT(oa->o_gr >= FILTER_GROUP_FIRST_MDS);
- rc = obd_create(mds->mds_osc_exp, oa, &lsm, &oti);
+ rc = obd_create(mds->mds_lov_exp, oa, &lsm, &oti);
if (rc) {
int level = D_ERROR;
if (rc == -ENOSPC)
GOTO(out_oa, rc);
}
} else {
- rc = obd_iocontrol(OBD_IOC_LOV_SETEA, mds->mds_osc_exp,
+ rc = obd_iocontrol(OBD_IOC_LOV_SETEA, mds->mds_lov_exp,
0, &lsm, rec->ur_eadata);
if (rc) {
GOTO(out_oa, rc);
oa->o_size = inode->i_size;
obdo_from_inode(oa, inode, OBD_MD_FLTYPE|OBD_MD_FLATIME|
OBD_MD_FLMTIME| OBD_MD_FLCTIME| OBD_MD_FLSIZE);
- rc = obd_setattr(mds->mds_osc_exp, oa, lsm, &oti);
+ rc = obd_setattr(mds->mds_lov_exp, oa, lsm, &oti);
if (rc) {
CERROR("error setting attrs for inode %lu: rc %d\n",
inode->i_ino, rc);
LASSERT(lsm && lsm->lsm_object_id);
lmm = NULL;
- rc = obd_packmd(mds->mds_osc_exp, &lmm, lsm);
- if (!rec->ur_fid2->id)
- obd_free_memmd(mds->mds_osc_exp, &lsm);
+ rc = obd_packmd(mds->mds_lov_exp, &lmm, lsm);
+ if (!id_ino(rec->ur_id2))
+ obd_free_memmd(mds->mds_lov_exp, &lsm);
LASSERT(rc >= 0);
lmm_size = rc;
body->eadatasize = rc;
LASSERT(lmm_bufsize >= lmm_size);
memcpy(lmm_buf, lmm, lmm_size);
- obd_free_diskmd(mds->mds_osc_exp, &lmm);
+ obd_free_diskmd(mds->mds_lov_exp, &lmm);
out_oa:
oti_free_cookies(&oti);
obdo_free(oa);
struct dentry *parent, *dchild;
struct ldlm_reply *rep;
struct mds_body *body;
- int rc;
struct list_head *t;
int put_child = 1;
+ int rc;
ENTRY;
LASSERT(offset == 3); /* only called via intent */
return; /* error looking up parent or child */
}
- parent = mds_fid2dentry(mds, rec->ur_fid1, NULL);
- LASSERTF(!IS_ERR(parent), "fid "LPU64"/%u rc %ld\n", rec->ur_fid1->id,
- rec->ur_fid1->generation, PTR_ERR(parent));
+ parent = mds_id2dentry(obd, rec->ur_id1, NULL);
+ LASSERTF(!IS_ERR(parent), "lid "DLID4" rc %ld\n",
+ OLID4(rec->ur_id1), PTR_ERR(parent));
- dchild = ll_lookup_one_len(rec->ur_name, parent, rec->ur_namelen - 1);
- LASSERTF(!IS_ERR(dchild), "parent "LPU64"/%u child %s rc %ld\n",
- rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name,
- PTR_ERR(dchild));
+ dchild = ll_lookup_one_len(rec->ur_name, parent,
+ rec->ur_namelen - 1);
+ LASSERTF(!IS_ERR(dchild), "parent "DLID4" child %s rc %ld\n",
+ OLID4(rec->ur_id1), rec->ur_name, PTR_ERR(dchild));
if (!dchild->d_inode)
GOTO(out_dput, 0); /* child not present to open */
req->rq_status)
GOTO(out_dput, 0);
- mds_pack_inode2fid(obd, &body->fid1, dchild->d_inode);
- mds_pack_inode2body(obd, body, dchild->d_inode);
+ /* get lock (write for O_CREAT, read otherwise) */
+ mds_pack_inode2body(obd, body, dchild->d_inode, 0);
if (S_ISREG(dchild->d_inode->i_mode)) {
rc = mds_pack_md(obd, req->rq_repmsg, 2, body,
dchild->d_inode, 1);
RETURN(rc);
}
-static int mds_open_by_fid(struct ptlrpc_request *req, struct ll_fid *fid,
- struct mds_body *body, int flags,
- struct mds_update_record *rec,struct ldlm_reply *rep)
+static int mds_open_by_id(struct ptlrpc_request *req,
+ struct lustre_id *id,
+ struct mds_body *body, int flags,
+ struct mds_update_record *rec,
+ struct ldlm_reply *rep)
{
struct mds_obd *mds = mds_req2mds(req);
struct inode *pending_dir = mds->mds_pending_dir->d_inode;
struct dentry *dchild;
- char fidname[LL_FID_NAMELEN];
- int fidlen = 0, rc;
+ char idname[LL_ID_NAMELEN];
+ int idlen = 0, rc;
void *handle = NULL;
ENTRY;
down(&pending_dir->i_sem);
- fidlen = ll_fid2str(fidname, fid->id, fid->generation);
- dchild = lookup_one_len(fidname, mds->mds_pending_dir, fidlen);
+
+ idlen = ll_id2str(idname, id_ino(id), id_gen(id));
+
+ dchild = lookup_one_len(idname, mds->mds_pending_dir,
+ idlen);
if (IS_ERR(dchild)) {
up(&pending_dir->i_sem);
rc = PTR_ERR(dchild);
- CERROR("error looking up %s in PENDING: rc = %d\n",fidname, rc);
+ CERROR("error looking up %s in PENDING: rc = %d\n",
+ idname, rc);
RETURN(rc);
}
if (dchild->d_inode != NULL) {
up(&pending_dir->i_sem);
mds_inode_set_orphan(dchild->d_inode);
- mds_pack_inode2fid(req2obd(req), &body->fid1, dchild->d_inode);
- mds_pack_inode2body(req2obd(req), body, dchild->d_inode);
+ mds_pack_inode2body(req2obd(req), body, dchild->d_inode, 0);
intent_set_disposition(rep, DISP_LOOKUP_EXECD);
intent_set_disposition(rep, DISP_LOOKUP_POS);
CWARN("Orphan %s found and opened in PENDING directory\n",
- fidname);
+ idname);
goto open;
}
dput(dchild);
up(&pending_dir->i_sem);
- /* We didn't find it in PENDING so it isn't an orphan. See
- * if it was a regular inode that was previously created. */
- dchild = mds_fid2dentry(mds, fid, NULL);
+ /*
+ * we didn't find it in PENDING so it isn't an orphan. See if it was a
+ * regular inode that was previously created.
+ */
+ dchild = mds_id2dentry(req2obd(req), id, NULL);
if (IS_ERR(dchild))
RETURN(PTR_ERR(dchild));
- mds_pack_inode2fid(req2obd(req), &body->fid1, dchild->d_inode);
- mds_pack_inode2body(req2obd(req), body, dchild->d_inode);
+ mds_pack_inode2body(req2obd(req), body, dchild->d_inode, 0);
intent_set_disposition(rep, DISP_LOOKUP_EXECD);
intent_set_disposition(rep, DISP_LOOKUP_POS);
reply_body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*reply_body));
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- rc = mds_open_by_fid(req, &request_body->fid1, reply_body,
- request_body->flags, NULL, NULL);
+ rc = mds_open_by_id(req, &request_body->id1, reply_body,
+ request_body->flags, NULL, NULL);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
RETURN(rc);
}
-/* Get a lock on the ino to sync with creation WRT inode reuse (bug 2029).
- * If child_lockh is NULL we just get the lock as a barrier to wait for
- * other holders of this lock, and drop it right away again. */
+/*
+ * get a lock on the ino to sync with creation WRT inode reuse (bug 2029). If
+ * child_lockh is NULL we just get the lock as a barrier to wait for other
+ * holders of this lock, and drop it right away again.
+ */
int mds_lock_new_child(struct obd_device *obd, struct inode *inode,
struct lustre_handle *child_lockh)
{
- struct ldlm_res_id child_res_id = { .name = { inode->i_ino, 0, 1, 0 } };
+ struct ldlm_res_id child_res_id = { .name = { 0, 0, 0, 0 } };
struct lustre_handle lockh;
+ struct lustre_id sid;
int lock_flags = 0;
int rc;
+ down(&inode->i_sem);
+ rc = mds_read_inode_sid(obd, inode, &sid);
+ up(&inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, err = %d\n", rc);
+ RETURN(rc);
+ }
+
+ child_res_id.name[0] = id_fid(&sid);
+ child_res_id.name[1] = id_group(&sid);
+ child_res_id.name[2] = 1;
+
if (child_lockh == NULL)
child_lockh = &lockh;
rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace, child_res_id,
LDLM_PLAIN, NULL, LCK_EX, &lock_flags,
- mds_blocking_ast, ldlm_completion_ast, NULL, NULL,
- NULL, 0, NULL, child_lockh);
+ mds_blocking_ast, ldlm_completion_ast, NULL,
+ NULL, NULL, 0, NULL, child_lockh);
if (rc != ELDLM_OK)
CERROR("ldlm_cli_enqueue: %d\n", rc);
else if (child_lockh == &lockh)
int mea_size, update_mode;
ENTRY;
- DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u name %*s mode %o",
- rec->ur_fid1->id, rec->ur_fid1->generation,
- rec->ur_namelen - 1, rec->ur_name, rec->ur_mode);
+ DEBUG_REQ(D_INODE, req, "parent "DLID4" name %*s mode %o",
+ OLID4(rec->ur_id1), rec->ur_namelen - 1, rec->ur_name,
+ rec->ur_mode);
parent_lockh[0].cookie = 0;
parent_lockh[1].cookie = 0;
}
MDS_CHECK_RESENT(req, reconstruct_open(rec, offset, req, child_lockh));
-
MDS_UPDATE_COUNTER(mds, MDS_OPEN_COUNT);
- /* Step 0: If we are passed a fid, then we assume the client already
- * opened this file and is only replaying the RPC, so we open the
- * inode by fid (at some large expense in security). */
+ /*
+ * Step 0: If we are passed a id, then we assume the client already
+ * opened this file and is only replaying the RPC, so we open the inode
+ * by fid (at some large expense in security).
+ */
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
- CDEBUG(D_HA, "open fid "LPU64"/%u name %*s mode %o\n",
- rec->ur_fid2->id, rec->ur_fid2->generation,
- rec->ur_namelen - 1, rec->ur_name, rec->ur_mode);
+ CDEBUG(D_HA, "open obj "DLID4" name %*s mode %o\n",
+ OLID4(rec->ur_id2), rec->ur_namelen - 1,
+ rec->ur_name, rec->ur_mode);
- LASSERT(rec->ur_fid2->id);
+ LASSERT(id_ino(rec->ur_id2));
- rc = mds_open_by_fid(req, rec->ur_fid2, body, rec->ur_flags,
- rec, rep);
+ rc = mds_open_by_id(req, rec->ur_id2, body, rec->ur_flags,
+ rec, rep);
if (rc != -ENOENT)
RETURN(rc);
+
/* We didn't find the correct inode on disk either, so we
* need to re-create it via a regular replay. */
LASSERT(rec->ur_flags & MDS_OPEN_CREAT);
} else {
- LASSERT(!rec->ur_fid2->id);
+ LASSERT(!id_ino(rec->ur_id2));
}
LASSERT(offset == 3); /* If we got here, we must be called via intent */
}
if (rec->ur_namelen == 1) {
- /* client (LMV) wants to open the file by fid */
- CDEBUG(D_OTHER, "OPEN by fid %u/%u/%u\n",
- (unsigned) rec->ur_fid1->mds,
- (unsigned) rec->ur_fid1->id,
- (unsigned) rec->ur_fid1->generation);
- dchild = mds_fid2dentry(mds, rec->ur_fid1, NULL);
+ /* client (LMV) wants to open the file by id */
+ CDEBUG(D_OTHER, "OPEN by id "DLID4"\n", OLID4(rec->ur_id1));
+ dchild = mds_id2dentry(obd, rec->ur_id1, NULL);
if (IS_ERR(dchild)) {
rc = PTR_ERR(dparent);
- CERROR("child lookup by a fid error %d\n", rc);
+ CERROR("child lookup by an id error %d\n", rc);
GOTO(cleanup, rc);
}
goto got_child;
}
- dparent = mds_fid2locked_dentry(obd, rec->ur_fid1, NULL, parent_mode,
- parent_lockh, &update_mode, rec->ur_name,
- rec->ur_namelen - 1,
- MDS_INODELOCK_UPDATE);
+ dparent = mds_id2locked_dentry(obd, rec->ur_id1, NULL, parent_mode,
+ parent_lockh, &update_mode, rec->ur_name,
+ rec->ur_namelen - 1, MDS_INODELOCK_UPDATE);
if (IS_ERR(dparent)) {
rc = PTR_ERR(dparent);
if (rc != -ENOENT)
- CERROR("parent lookup error %d\n", rc);
+ CERROR("parent lookup for "DLID4" failed, error %d\n",
+ OLID4(rec->ur_id1), rc);
GOTO(cleanup, rc);
}
LASSERT(dparent->d_inode != NULL);
GOTO(cleanup, rc);
if (mea != NULL) {
- /* dir is already splitted, check is requested filename
- * should live at this MDS or at another one */
+ /*
+ * dir is already splitted, check is requested filename should *
+ * live at this MDS or at another one.
+ */
int i;
i = mea_name2idx(mea, rec->ur_name, rec->ur_namelen - 1);
- if (mea->mea_master != mea->mea_fids[i].mds) {
+ if (mea->mea_master != id_group(&mea->mea_ids[i])) {
CDEBUG(D_OTHER,
"%s: inapropriate MDS(%d) for %lu/%u:%s."
- " should be %d(%d)\n", obd->obd_name,
+ " should be %lu(%d)\n", obd->obd_name,
mea->mea_master, dparent->d_inode->i_ino,
dparent->d_inode->i_generation, rec->ur_name,
- mea->mea_fids[i].mds, i);
+ (unsigned long)id_group(&mea->mea_ids[i]), i);
GOTO(cleanup, rc = -ERESTART);
}
}
struct ldlm_res_id res_id = { . name = {0} };
ldlm_policy_data_t policy;
int flags = 0;
- CDEBUG(D_OTHER, "cross reference: %lu/%lu/%lu\n",
- (unsigned long) dchild->d_mdsnum,
- (unsigned long) dchild->d_inum,
- (unsigned long) dchild->d_generation);
- body->valid |= OBD_MD_FLID | OBD_MD_MDS;
- body->fid1.id = dchild->d_inum;
- body->fid1.mds = dchild->d_mdsnum;
- body->fid1.generation = dchild->d_generation;
+
+ mds_pack_dentry2body(obd, body, dchild, 1);
intent_set_disposition(rep, DISP_LOOKUP_POS);
- res_id.name[0] = dchild->d_inum;
- res_id.name[1] = dchild->d_generation;
+
+ CDEBUG(D_OTHER, "cross reference: "DLID4"\n",
+ OLID4(&body->id1));
+
+ res_id.name[0] = dchild->d_fid;
+ res_id.name[1] = dchild->d_mdsnum;
+
policy.l_inodebits.bits = MDS_INODELOCK_LOOKUP;
rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace,
res_id, LDLM_IBITS, &policy,
- LCK_PR, &flags,
- mds_blocking_ast,
+ LCK_PR, &flags, mds_blocking_ast,
ldlm_completion_ast, NULL, NULL,
NULL, 0, NULL, child_lockh);
#ifdef S_PDIROPS
else
intent_set_disposition(rep, DISP_LOOKUP_NEG);
- /*Step 3: If the child was negative, and we're supposed to, create it.*/
+ /* Step 3: If the child was negative, and we're supposed to, create it.*/
if (dchild->d_inode == NULL) {
- unsigned long ino = rec->ur_fid2->id;
+ unsigned long ino;
struct iattr iattr;
struct inode *inode;
- rc = mds_try_to_split_dir(obd, dparent, &mea, 0, update_mode);
+
+ ino = (unsigned long)id_ino(rec->ur_id2);
+
+ rc = mds_try_to_split_dir(obd, dparent, &mea, 0,
+ update_mode);
+
CDEBUG(D_OTHER, "%s: splitted %lu/%u - %d\n",
obd->obd_name, dparent->d_inode->i_ino,
dparent->d_inode->i_generation, rc);
+
if (rc > 0) {
/* dir got splitted */
GOTO(cleanup, rc = -ERESTART);
}
if (!(rec->ur_flags & MDS_OPEN_CREAT)) {
- /* It's negative and we weren't supposed to create it */
+ /*
+ * dentry is negative and we weren't supposed to create
+ * object, get out of here.
+ */
GOTO(cleanup, rc = -ENOENT);
}
dp.p_ptr = req;
dp.p_inum = ino;
- rc = ll_vfs_create(dparent->d_inode, dchild, rec->ur_mode,NULL);
+ rc = ll_vfs_create(dparent->d_inode, dchild, rec->ur_mode, NULL);
if (dchild->d_fsdata == (void *)(unsigned long)ino)
dchild->d_fsdata = NULL;
inode = dchild->d_inode;
if (ino) {
LASSERT(ino == inode->i_ino);
- /* Written as part of setattr */
- inode->i_generation = rec->ur_fid2->generation;
+
+ /* written as part of setattr */
+ inode->i_generation = id_gen(rec->ur_id2);
CDEBUG(D_HA, "recreated ino %lu with gen %u\n",
inode->i_ino, inode->i_generation);
}
LTIME_S(iattr.ia_ctime) = rec->ur_time;
LTIME_S(iattr.ia_mtime) = rec->ur_time;
- iattr.ia_uid = rec->_ur_fsuid;
+ iattr.ia_uid = rec->ur_fsuid;
if (dparent->d_inode->i_mode & S_ISGID)
iattr.ia_gid = dparent->d_inode->i_gid;
else
- iattr.ia_gid = rec->_ur_fsgid;
+ iattr.ia_gid = rec->ur_fsgid;
iattr.ia_valid = ATTR_UID | ATTR_GID | ATTR_ATIME |
ATTR_MTIME | ATTR_CTIME;
else
MDS_UPDATE_COUNTER(mds, MDS_CREATE_COUNT);
+ down(&dchild->d_inode->i_sem);
+ if (ino) {
+ rc = mds_update_inode_sid(obd, dchild->d_inode,
+ handle, rec->ur_id2);
+ if (rc) {
+ CERROR("mds_update_inode_sid() failed, "
+ "rc = %d\n", rc);
+ }
+ id_assign_fid(&body->id1, rec->ur_id2);
+
+ /*
+ * make sure, that fid is up-to-date.
+ */
+ mds_set_last_fid(obd, id_fid(rec->ur_id2));
+ } else {
+ rc = mds_alloc_inode_sid(obd, dchild->d_inode,
+ handle, &body->id1);
+ if (rc) {
+ CERROR("mds_alloc_inode_sid() failed, "
+ "rc = %d\n", rc);
+ }
+ }
+ up(&dchild->d_inode->i_sem);
+
if (!(rec->ur_flags & O_EXCL)) { /* bug 3313 */
rc = fsfilt_commit(obd, dchild->d_inode->i_sb,
dchild->d_inode, handle, 0);
}
acc_mode = 0; /* Don't check for permissions */
+
+ /*
+ * we do not read fid from EA here, because it is already
+ * updated and thus we avoid not needed IO, locking, etc.
+ */
+ body->valid |= OBD_MD_FID;
+ mds_pack_inode2body(obd, body, dchild->d_inode, 0);
+ } else {
+ mds_pack_inode2body(obd, body, dchild->d_inode, 1);
}
LASSERTF(!mds_inode_is_orphan(dchild->d_inode),
"dchild %*s (%p) inode %p\n", dchild->d_name.len,
dchild->d_name.name, dchild, dchild->d_inode);
- mds_pack_inode2fid(obd, &body->fid1, dchild->d_inode);
- mds_pack_inode2body(obd, body, dchild->d_inode);
-
if (S_ISREG(dchild->d_inode->i_mode)) {
/* Check permissions etc */
rc = ll_permission(dchild->d_inode, acc_mode, NULL);
}
/* Step 5: mds_open it */
- rc = mds_finish_open(req, dchild, body, rec->ur_flags, &handle, rec,
- rep);
+ rc = mds_finish_open(req, dchild, body, rec->ur_flags, &handle,
+ rec, rep);
GOTO(cleanup, rc);
cleanup:
err);
}
} else if (created) {
-#if 0
mds_lock_new_child(obd, dchild->d_inode, NULL);
-#endif
}
l_dput(dchild);
case 1:
int unlink_orphan)
{
struct inode *inode = mfd->mfd_dentry->d_inode;
- char fidname[LL_FID_NAMELEN];
- int last_orphan, fidlen, rc = 0, cleanup_phase = 0;
+ char idname[LL_ID_NAMELEN];
+ int last_orphan, idlen, rc = 0, cleanup_phase = 0;
struct dentry *pending_child = NULL;
struct mds_obd *mds = &obd->u.mds;
struct inode *pending_dir = mds->mds_pending_dir->d_inode;
reply_body = lustre_msg_buf(req->rq_repmsg, 0,
sizeof(*reply_body));
- fidlen = ll_fid2str(fidname, inode->i_ino, inode->i_generation);
- CDEBUG(D_INODE, "inode %p ino %s nlink %d orphan %d\n", inode, fidname,
- inode->i_nlink, mds_orphan_open_count(inode));
+ idlen = ll_id2str(idname, inode->i_ino, inode->i_generation);
+ CDEBUG(D_INODE, "inode %p ino %s nlink %d orphan %d\n", inode,
+ idname, inode->i_nlink, mds_orphan_open_count(inode));
+
last_orphan = mds_orphan_open_dec_test(inode) &&
- mds_inode_is_orphan(inode);
+ mds_inode_is_orphan(inode);
UP_WRITE_I_ALLOC_SEM(inode);
/* this is half of the actual "close" */
if (obd->obd_recovering) {
CDEBUG(D_HA, "not remove orphan %s until recovery"
- " is over\n", fidname);
+ " is over\n", idname);
GOTO(out, rc);
}
- CDEBUG(D_HA, "destroying orphan object %s\n", fidname);
+ CDEBUG(D_HA, "destroying orphan object %s\n", idname);
if ((S_ISREG(inode->i_mode) && inode->i_nlink != 1) ||
(S_ISDIR(inode->i_mode) && inode->i_nlink != 2))
CERROR("found \"orphan\" %s %s with link count %d\n",
S_ISREG(inode->i_mode) ? "file" : "dir",
- fidname, inode->i_nlink);
- /* Sadly, there is no easy way to save pending_child from
- * mds_reint_unlink() into mfd, so we need to re-lookup,
- * but normally it will still be in the dcache. */
+ idname, inode->i_nlink);
+ /*
+ * sadly, there is no easy way to save pending_child from
+ * mds_reint_unlink() into mfd, so we need to re-lookup, but
+ * normally it will still be in the dcache.
+ */
down(&pending_dir->i_sem);
- cleanup_phase = 1; /* up(&pending_dir->i_sem) when finished */
- pending_child = lookup_one_len(fidname, mds->mds_pending_dir,
- fidlen);
+ cleanup_phase = 1; /* up(i_sem) when finished */
+ pending_child = lookup_one_len(idname, mds->mds_pending_dir,
+ idlen);
if (IS_ERR(pending_child))
GOTO(cleanup, rc = PTR_ERR(pending_child));
LASSERT(pending_child->d_inode != NULL);
else
rc = vfs_unlink(pending_dir, pending_child);
if (rc)
- CERROR("error unlinking orphan %s: rc %d\n",fidname,rc);
+ CERROR("error unlinking orphan %s: rc %d\n",
+ idname, rc);
if (req != NULL && req->rq_repmsg != NULL &&
(reply_body->valid & OBD_MD_FLEASIZE) &&
GOTO(cleanup, rc = PTR_ERR(handle));
rc = fsfilt_setattr(obd, mfd->mfd_dentry, handle, &iattr, 0);
if (rc)
- CERROR("error in setattr(%s): rc %d\n", fidname, rc);
+ CERROR("error in setattr(%s): rc %d\n", idname, rc);
}
out:
/* If other clients have this file open for write, rc will be > 0 */
mfd = mds_handle2mfd(&body->handle);
if (mfd == NULL) {
DEBUG_REQ(D_ERROR, req, "no handle for file close ino "LPD64
- ": cookie "LPX64, body->fid1.id, body->handle.cookie);
+ ": cookie "LPX64, body->id1.li_stc.u.e3s.l3s_ino,
+ body->handle.cookie);
req->rq_status = -ESTALE;
RETURN(-ESTALE);
}
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
LASSERT(body != NULL);
- mds_pack_inode2fid(obd, &body->fid1, inode);
- mds_pack_inode2body(obd, body, inode);
+ mds_pack_inode2body(obd, body, inode, 0);
mds_pack_md(obd, req->rq_repmsg, 1, body, inode, MDS_PACK_MD_LOCK);
}
spin_lock(&med->med_open_lock);
#include <linux/lustre_fsfilt.h>
#include "mds_internal.h"
-void mds_commit_cb(struct obd_device *obd, __u64 transno, void *data,
- int error)
-{
- obd_transno_commit_cb(obd, transno, error);
-}
-
struct mds_logcancel_data {
struct lov_mds_md *mlcd_lmm;
int mlcd_size;
struct llog_cookie mlcd_cookies[0];
};
-
-static void mds_cancel_cookies_cb(struct obd_device *obd, __u64 transno,
- void *cb_data, int error)
+static void mds_cancel_cookies_cb(struct obd_device *obd,
+ __u64 transno, void *cb_data,
+ int error)
{
struct mds_logcancel_data *mlcd = cb_data;
struct lov_stripe_md *lsm = NULL;
CDEBUG(D_HA, "cancelling %d cookies\n",
(int)(mlcd->mlcd_cookielen / sizeof(*mlcd->mlcd_cookies)));
- rc = obd_unpackmd(obd->u.mds.mds_osc_exp, &lsm, mlcd->mlcd_lmm,
+ rc = obd_unpackmd(obd->u.mds.mds_lov_exp, &lsm, mlcd->mlcd_lmm,
mlcd->mlcd_eadatalen);
if (rc < 0) {
CERROR("bad LSM cancelling %d log cookies: rc %d\n",
struct ptlrpc_request *req, int rc, __u32 op_data)
{
struct mds_export_data *med = &req->rq_export->exp_mds_data;
- struct mds_client_data *mcd = med->med_mcd;
struct obd_device *obd = req->rq_export->exp_obd;
- int err;
+ struct mds_client_data *mcd = med->med_mcd;
+ int err, log_pri = D_HA;
__u64 transno;
loff_t off;
- int log_pri = D_HA;
ENTRY;
/* if the export has already been failed, we have no last_rcvd slot */
if (req->rq_export->exp_failed) {
CERROR("committing transaction for disconnected client\n");
if (handle)
- GOTO(commit, rc);
+ GOTO(out_commit, rc);
RETURN(rc);
}
mcd->mcd_last_result = cpu_to_le32(rc);
mcd->mcd_last_data = cpu_to_le32(op_data);
-
- fsfilt_add_journal_cb(req->rq_export->exp_obd, mds->mds_sb,
- transno, handle, mds_commit_cb, NULL);
+ fsfilt_add_journal_cb(obd, mds->mds_sb, transno, handle,
+ mds_commit_last_transno_cb, NULL);
- err = fsfilt_write_record(obd, mds->mds_rcvd_filp, mcd, sizeof(*mcd),
- &off, 0);
+ err = fsfilt_write_record(obd, mds->mds_rcvd_filp, mcd,
+ sizeof(*mcd), &off, 0);
if (err) {
log_pri = D_ERROR;
"wrote trans #"LPU64" client %s at idx %u: err = %d",
transno, mcd->mcd_uuid, med->med_idx, err);
+ err = mds_update_last_fid(obd, handle, 0);
+ if (err) {
+ log_pri = D_ERROR;
+ if (rc == 0)
+ rc = err;
+ }
+
err = mds_lov_write_objids(obd);
if (err) {
log_pri = D_ERROR;
}
CDEBUG(log_pri, "wrote objids: err = %d\n", err);
-commit:
+out_commit:
err = fsfilt_commit(obd, mds->mds_sb, inode, handle, 0);
if (err) {
CERROR("error committing transaction: %d\n", err);
/* times */
if ((ia_valid & (ATTR_MTIME|ATTR_ATIME)) == (ATTR_MTIME|ATTR_ATIME)) {
- if (rec->_ur_fsuid != inode->i_uid &&
+ if (rec->ur_fsuid != inode->i_uid &&
(error = ll_permission(inode, MAY_WRITE, NULL)) != 0)
RETURN(error);
}
int offset, struct ptlrpc_request *req)
{
struct mds_export_data *med = &req->rq_export->exp_mds_data;
- struct mds_obd *obd = &req->rq_export->exp_obd->u.mds;
- struct dentry *de;
struct mds_body *body;
+ struct dentry *de;
mds_req_from_mcd(req, med->med_mcd);
- de = mds_fid2dentry(obd, rec->ur_fid1, NULL);
+ de = mds_id2dentry(req2obd(req), rec->ur_id1, NULL);
if (IS_ERR(de)) {
LASSERT(PTR_ERR(de) == req->rq_status);
return;
}
- body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
- mds_pack_inode2fid(req2obd(req), &body->fid1, de->d_inode);
- mds_pack_inode2body(req2obd(req), body, de->d_inode);
+ body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
+ mds_pack_inode2body(req2obd(req), body, de->d_inode, 0);
/* Don't return OST-specific attributes if we didn't just set them */
if (rec->ur_iattr.ia_valid & ATTR_SIZE)
*
* We use the ATTR_FROM_OPEN flag to tell these cases apart. */
static int mds_reint_setattr(struct mds_update_record *rec, int offset,
- struct ptlrpc_request *req,
- struct lustre_handle *lh)
+ struct ptlrpc_request *req, struct lustre_handle *lh)
{
struct mds_obd *mds = mds_req2mds(req);
struct obd_device *obd = req->rq_export->exp_obd;
int parent_mode;
void *handle = NULL;
struct mds_logcancel_data *mlcd = NULL;
- int rc = 0, cleanup_phase = 0, err, locked = 0;
+ int rc = 0, cleanup_phase = 0, err;
+ int locked = 0;
ENTRY;
LASSERT(offset == 1);
- DEBUG_REQ(D_INODE, req, "setattr "LPU64"/%u %x", rec->ur_fid1->id,
- rec->ur_fid1->generation, rec->ur_iattr.ia_valid);
+ DEBUG_REQ(D_INODE, req, "setattr "LPU64"/%u %x",
+ id_ino(rec->ur_id1), id_gen(rec->ur_id1),
+ rec->ur_iattr.ia_valid);
MDS_CHECK_RESENT(req, reconstruct_reint_setattr(rec, offset, req));
MDS_UPDATE_COUNTER(mds, MDS_SETATTR_COUNT);
if (rec->ur_iattr.ia_valid & ATTR_FROM_OPEN) {
- de = mds_fid2dentry(mds, rec->ur_fid1, NULL);
+ de = mds_id2dentry(obd, rec->ur_id1, NULL);
if (IS_ERR(de))
GOTO(cleanup, rc = PTR_ERR(de));
} else {
__u64 lockpart = MDS_INODELOCK_UPDATE;
- if (rec->ur_iattr.ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID) )
+ if (rec->ur_iattr.ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))
lockpart |= MDS_INODELOCK_LOOKUP;
- de = mds_fid2locked_dentry(obd, rec->ur_fid1, NULL, LCK_PW,
- lockh, &parent_mode, NULL, 0, lockpart);
+ de = mds_id2locked_dentry(obd, rec->ur_id1, NULL, LCK_PW,
+ lockh, &parent_mode, NULL, 0, lockpart);
if (IS_ERR(de))
GOTO(cleanup, rc = PTR_ERR(de));
locked = 1;
if (rc < 0)
GOTO(cleanup, rc);
- rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE,
- mds->mds_osc_exp, 0, &lsm, rec->ur_eadata);
+ rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE, mds->mds_lov_exp,
+ 0, &lsm, rec->ur_eadata);
if (rc)
GOTO(cleanup, rc);
- obd_free_memmd(mds->mds_osc_exp, &lsm);
+ obd_free_memmd(mds->mds_lov_exp, &lsm);
rc = fsfilt_set_md(obd, inode, handle, rec->ur_eadata,
rec->ur_eadatalen);
}
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
- mds_pack_inode2fid(obd, &body->fid1, inode);
- mds_pack_inode2body(obd, body, inode);
+ mds_pack_inode2body(obd, body, inode, 0);
+ body->id1 = *rec->ur_id1;
/* Don't return OST-specific attributes if we didn't just set them */
if (rec->ur_iattr.ia_valid & ATTR_SIZE)
if (rec->ur_iattr.ia_valid & (ATTR_ATIME | ATTR_ATIME_SET))
body->valid |= OBD_MD_FLATIME;
- if (rc == 0 && rec->ur_cookielen && !IS_ERR(mds->mds_osc_obd)) {
+ if (rc == 0 && rec->ur_cookielen && !IS_ERR(mds->mds_lov_obd)) {
OBD_ALLOC(mlcd, sizeof(*mlcd) + rec->ur_cookielen +
rec->ur_eadatalen);
if (mlcd) {
struct ptlrpc_request *req)
{
struct mds_export_data *med = &req->rq_export->exp_mds_data;
- struct mds_obd *obd = &req->rq_export->exp_obd->u.mds;
struct dentry *parent, *child;
struct mds_body *body;
ENTRY;
return;
}
- parent = mds_fid2dentry(obd, rec->ur_fid1, NULL);
+ parent = mds_id2dentry(req2obd(req), rec->ur_id1, NULL);
LASSERT(!IS_ERR(parent));
- child = ll_lookup_one_len(rec->ur_name, parent, rec->ur_namelen - 1);
+ child = ll_lookup_one_len(rec->ur_name, parent,
+ rec->ur_namelen - 1);
LASSERT(!IS_ERR(child));
if ((child->d_flags & DCACHE_CROSS_REF)) {
LASSERTF(child->d_inode == NULL, "BUG 3869\n");
- body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
- mds_pack_dentry2fid(&body->fid1, child);
- mds_pack_dentry2body(body, child);
- body->valid |= OBD_MD_MDS;
+ body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
+ mds_pack_dentry2body(req2obd(req), body, child, 1);
} else if (child->d_inode == NULL) {
- DEBUG_REQ(D_ERROR, req, "parent "LPU64"/%u name %s mode %o",
- rec->ur_fid1->id, rec->ur_fid1->generation,
- rec->ur_name, rec->ur_mode);
+ DEBUG_REQ(D_ERROR, req, "parent "DLID4" name %s mode %o",
+ OLID4(rec->ur_id1), rec->ur_name, rec->ur_mode);
LASSERTF(child->d_inode != NULL, "BUG 3869\n");
} else {
- body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
- mds_pack_inode2fid(req2obd(req), &body->fid1, child->d_inode);
- mds_pack_inode2body(req2obd(req), body, child->d_inode);
+ body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
+ mds_pack_inode2body(req2obd(req), body, child->d_inode, 1);
}
l_dput(parent);
l_dput(child);
ENTRY;
LASSERT(offset == 1);
- LASSERT(!strcmp(req->rq_export->exp_obd->obd_type->typ_name, LUSTRE_MDS_NAME));
+
+ LASSERT(!strcmp(req->rq_export->exp_obd->obd_type->typ_name,
+ LUSTRE_MDS_NAME));
DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u name %s mode %o",
- rec->ur_fid1->id, rec->ur_fid1->generation,
+ id_ino(rec->ur_id1), id_gen(rec->ur_id1),
rec->ur_name, rec->ur_mode);
MDS_CHECK_RESENT(req, reconstruct_reint_create(rec, offset, req));
-
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_CREATE))
GOTO(cleanup, rc = -ESTALE);
- dparent = mds_fid2locked_dentry(obd, rec->ur_fid1, NULL, LCK_PW, lockh,
- &parent_mode, rec->ur_name,
- rec->ur_namelen - 1, MDS_INODELOCK_UPDATE);
+ dparent = mds_id2locked_dentry(obd, rec->ur_id1, NULL, LCK_PW,
+ lockh, &parent_mode, rec->ur_name,
+ rec->ur_namelen - 1, MDS_INODELOCK_UPDATE);
if (IS_ERR(dparent)) {
rc = PTR_ERR(dparent);
CERROR("parent lookup error %d\n", rc);
GOTO(cleanup, rc);
if (mea != NULL) {
- /* dir is already splitted, check is requested filename
- * should live at this MDS or at another one */
- int i;
- i = mea_name2idx(mea, rec->ur_name, rec->ur_namelen - 1);
- if (mea->mea_master != mea->mea_fids[i].mds) {
+ /*
+ * dir is already splitted, check is requested filename should
+ * live at this MDS or at another one.
+ */
+ int i = mea_name2idx(mea, rec->ur_name, rec->ur_namelen - 1);
+ if (mea->mea_master != id_group(&mea->mea_ids[i])) {
CDEBUG(D_OTHER, "inapropriate MDS(%d) for %lu/%u:%s."
- " should be %d(%d)\n",
+ " should be %lu(%d)\n",
mea->mea_master, dparent->d_inode->i_ino,
dparent->d_inode->i_generation, rec->ur_name,
- mea->mea_fids[i].mds, i);
+ (unsigned long)id_group(&mea->mea_ids[i]), i);
GOTO(cleanup, rc = -ERESTART);
}
}
- dchild = ll_lookup_one_len(rec->ur_name, dparent, rec->ur_namelen - 1);
+ dchild = ll_lookup_one_len(rec->ur_name, dparent,
+ rec->ur_namelen - 1);
if (IS_ERR(dchild)) {
rc = PTR_ERR(dchild);
- CERROR("child lookup error %d\n", rc);
+ CERROR("Can't find "DLID4"/%s, error %d\n",
+ OLID4(rec->ur_id1), rec->ur_name, rc);
GOTO(cleanup, rc);
}
rec->ur_mode |= S_ISGID;
}
+ /*
+ * here inode number should be used only in the case of replaying. It is
+ * needed to check if object already created in the case of creating
+ * remote inode.
+ */
dchild->d_fsdata = (void *)&dp;
- dp.p_inum = (unsigned long)rec->ur_fid2->id;
+ dp.p_inum = (unsigned long)id_ino(rec->ur_id2);
dp.p_ptr = req;
switch (type) {
break;
}
case S_IFDIR:{
- int nstripes = 0;
- int i;
+ int i, nstripes = 0;
+ struct lustre_id sid;
- /* as Peter asked, mkdir() should distribute new directories
+ /*
+ * as Peter asked, mkdir() should distribute new directories
* over the whole cluster in order to distribute namespace
* processing load. first, we calculate which MDS to use to put
- * new directory's inode in. */
+ * new directory's inode in.
+ */
i = mds_choose_mdsnum(obd, rec->ur_name, rec->ur_namelen - 1,
rec->ur_flags);
if (i == mds->mds_num) {
GOTO(cleanup, rc = PTR_ERR(handle));
rc = vfs_mkdir(dir, dchild, rec->ur_mode);
+ if (rc) {
+ CERROR("Can't create dir %s, rc = %d\n",
+ dchild->d_name.name, rc);
+ GOTO(cleanup, rc);
+ }
+ down(&dchild->d_inode->i_sem);
+ if (dp.p_inum) {
+ rc = mds_update_inode_sid(obd, dchild->d_inode,
+ handle, rec->ur_id2);
+ if (rc) {
+ CERROR("mds_update_inode_sid() failed, inode %lu, "
+ "rc %d\n", dchild->d_inode->i_ino, rc);
+ }
+
+ /*
+ * make sure, that fid is up-to-date.
+ */
+ mds_set_last_fid(obd, id_fid(rec->ur_id2));
+ } else {
+ rc = mds_alloc_inode_sid(obd, dchild->d_inode,
+ handle, &sid);
+ if (rc) {
+ CERROR("mds_alloc_inode_sid() failed, inode %lu, "
+ "rc %d\n", dchild->d_inode->i_ino, rc);
+ }
+ }
+ up(&dchild->d_inode->i_sem);
+
+ if (rc)
+ GOTO(cleanup, rc);
+
if (rec->ur_eadata)
nstripes = *(u16 *)rec->ur_eadata;
if (rc == 0 && nstripes) {
- /* we pass LCK_EX to split routine to
- * signalthat we have exclusive access
- * to the directory. simple because
- * nobody knows it already exists -bzzz */
+ /* we pass LCK_EX to split routine to signal,
+ * that we have exclusive access to the
+ * directory. Simple because nobody knows it
+ * already exists -bzzz */
rc = mds_try_to_split_dir(obd, dchild,
NULL, nstripes,
LCK_EX);
/* first, create that inode */
oa = obdo_alloc();
- LASSERT(oa != NULL);
+ if (!oa)
+ GOTO(cleanup, rc = -ENOMEM);
+
oa->o_mds = i;
oa->o_easize = 0;
+
if (rec->ur_eadata) {
/* user asks for creating splitted dir */
oa->o_easize = *((u16 *) rec->ur_eadata);
obdo_from_inode(oa, dir, OBD_MD_FLTYPE | OBD_MD_FLATIME |
OBD_MD_FLMTIME | OBD_MD_FLCTIME |
OBD_MD_FLUID | OBD_MD_FLGID);
+
oa->o_mode = dir->i_mode;
+
CDEBUG(D_OTHER, "%s: create dir on MDS %u\n",
- obd->obd_name, i);
+ obd->obd_name, i);
+
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
+ /*
+ * here inode number and generation are
+ * important, as this is replay request and we
+ * need them to check if such an object is
+ * already created.
+ */
CDEBUG(D_HA, "%s: replay dir creation %*s -> %u/%u\n",
obd->obd_name, rec->ur_namelen - 1,
- rec->ur_name, (unsigned) rec->ur_fid2->id,
- (unsigned) rec->ur_fid2->generation);
- oa->o_id = rec->ur_fid2->id;
- oa->o_generation = rec->ur_fid2->generation;
+ rec->ur_name, (unsigned)id_ino(rec->ur_id2),
+ (unsigned)id_gen(rec->ur_id2));
+ oa->o_id = id_ino(rec->ur_id2);
+ oa->o_fid = id_fid(rec->ur_id2);
+ oa->o_generation = id_gen(rec->ur_id2);
oa->o_flags |= OBD_FL_RECREATE_OBJS;
}
+ /* before obd_create() is called, o_fid is not known. */
rc = obd_create(mds->mds_lmv_exp, oa, NULL, NULL);
if (rc) {
CERROR("can't create remote inode: %d\n", rc);
DEBUG_REQ(D_ERROR, req, "parent "LPU64"/%u name %s mode %o",
- rec->ur_fid1->id, rec->ur_fid1->generation,
+ id_ino(rec->ur_id1), id_gen(rec->ur_id1),
rec->ur_name, rec->ur_mode);
obdo_free(oa);
GOTO(cleanup, rc);
obdo_free(oa);
GOTO(cleanup, rc = PTR_ERR(handle));
}
+
+ /* creating local dentry for remote inode. */
rc = fsfilt_add_dir_entry(obd, dparent, rec->ur_name,
- rec->ur_namelen - 1,
- oa->o_id, oa->o_generation,
- i);
- LASSERT(rc == 0);
+ rec->ur_namelen - 1, oa->o_id,
+ oa->o_generation, i, oa->o_fid);
+
+ if (rc) {
+ CERROR("Can't create local entry %*s for "
+ "remote inode.\n", rec->ur_namelen - 1,
+ rec->ur_name);
+ GOTO(cleanup, rc);
+ }
/* fill reply */
- body = lustre_msg_buf(req->rq_repmsg, 0,
- sizeof (*body));
- body->valid |= OBD_MD_FLID | OBD_MD_MDS;
- body->fid1.id = oa->o_id;
- body->fid1.mds = i;
- body->fid1.generation = oa->o_generation;
+ body = lustre_msg_buf(req->rq_repmsg,
+ 0, sizeof(*body));
+ body->valid |= OBD_MD_FLID | OBD_MD_MDS |
+ OBD_MD_FID;
+
+ id_group(&body->id1) = i;
+ id_ino(&body->id1) = oa->o_id;
+ id_fid(&body->id1) = oa->o_fid;
+ id_gen(&body->id1) = oa->o_generation;
obdo_free(oa);
} else {
/* requested name exists in the directory */
}
/* In case we stored the desired inum in here, we want to clean up. */
- if (dchild->d_fsdata == (void *)(unsigned long)rec->ur_fid2->id)
+ if (dchild->d_fsdata == (void *)(unsigned long)id_ino(rec->ur_id2))
dchild->d_fsdata = NULL;
if (rc) {
GOTO(cleanup, rc);
} else if (dchild->d_inode) {
struct iattr iattr;
- struct inode *inode = dchild->d_inode;
struct mds_body *body;
+ struct inode *inode = dchild->d_inode;
created = 1;
+ iattr.ia_uid = rec->ur_fsuid;
LTIME_S(iattr.ia_atime) = rec->ur_time;
LTIME_S(iattr.ia_ctime) = rec->ur_time;
LTIME_S(iattr.ia_mtime) = rec->ur_time;
- iattr.ia_uid = rec->_ur_fsuid;
+
if (dir->i_mode & S_ISGID)
iattr.ia_gid = dir->i_gid;
else
- iattr.ia_gid = rec->_ur_fsgid;
+ iattr.ia_gid = rec->ur_fsgid;
+
iattr.ia_valid = ATTR_UID | ATTR_GID | ATTR_ATIME |
ATTR_MTIME | ATTR_CTIME;
- if (rec->ur_fid2->id) {
- LASSERT(rec->ur_fid2->id == inode->i_ino);
- inode->i_generation = rec->ur_fid2->generation;
- /* Dirtied and committed by the upcoming setattr. */
+ if (id_ino(rec->ur_id2)) {
+ LASSERT(id_ino(rec->ur_id2) == inode->i_ino);
+ inode->i_generation = id_gen(rec->ur_id2);
+
+ if (type != S_IFDIR) {
+ /*
+ * updating inode self id, as inode already
+ * exists and we should make sure, its sid will
+ * be the same as we reveived.
+ */
+ down(&inode->i_sem);
+ rc = mds_update_inode_sid(obd, inode,
+ handle, rec->ur_id2);
+ up(&inode->i_sem);
+ if (rc) {
+ CERROR("Can't update inode self id, "
+ "rc = %d.\n", rc);
+ }
+
+ /*
+ * make sure, that fid is up-to-date.
+ */
+ mds_set_last_fid(obd, id_fid(rec->ur_id2));
+ }
+
+ /* dirtied and committed by the upcoming setattr. */
CDEBUG(D_INODE, "recreated ino %lu with gen %u\n",
inode->i_ino, inode->i_generation);
} else {
-#if 0
struct lustre_handle child_ino_lockh;
-#endif
CDEBUG(D_INODE, "created ino %lu with gen %x\n",
inode->i_ino, inode->i_generation);
-#if 0
- /* The inode we were allocated may have just been freed
- * by an unlink operation. We take this lock to
- * synchronize against the matching reply-ack-lock taken
- * in unlink, to avoid replay problems if this reply
- * makes it out to the client but the unlink's does not.
- * See bug 2029 for more detail.*/
- rc = mds_lock_new_child(obd, inode, &child_ino_lockh);
- if (rc != ELDLM_OK) {
- CERROR("error locking for unlink/create sync: "
- "%d\n", rc);
- } else {
- ldlm_lock_decref(&child_ino_lockh, LCK_EX);
+ if (type != S_IFDIR) {
+ struct lustre_id sid;
+
+ /*
+ * allocate new id for @inode if it is not dir,
+ * because for dir it was already done.
+ */
+ down(&inode->i_sem);
+ rc = mds_alloc_inode_sid(obd, inode,
+ handle, &sid);
+ up(&inode->i_sem);
+ if (rc) {
+ CERROR("mds_alloc_inode_sid() failed, "
+ "inode %lu, rc %d\n", inode->i_ino,
+ rc);
+ }
+ }
+
+ if (rc == 0) {
+ /*
+ * the inode we were allocated may have just
+ * been freed by an unlink operation. We take
+ * this lock to synchronize against the matching
+ * reply-ack-lock taken in unlink, to avoid
+ * replay problems if this reply makes it out to
+ * the client but the unlink's does not. See
+ * bug 2029 for more detail.
+ */
+ rc = mds_lock_new_child(obd, inode, &child_ino_lockh);
+ if (rc != ELDLM_OK) {
+ CERROR("error locking for unlink/create sync: "
+ "%d\n", rc);
+ } else {
+ ldlm_lock_decref(&child_ino_lockh, LCK_EX);
+ }
}
-#endif
}
rc = fsfilt_setattr(obd, dchild, handle, &iattr, 0);
else
MDS_UPDATE_COUNTER(mds, MDS_CREATE_COUNT);
- body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
- mds_pack_inode2fid(obd, &body->fid1, inode);
- mds_pack_inode2body(obd, body, inode);
+ body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
+ mds_pack_inode2body(obd, body, inode, 1);
}
EXIT;
return 0;
}
-static int res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2,
- ldlm_policy_data_t *p1, ldlm_policy_data_t *p2)
+static inline int
+res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2,
+ ldlm_policy_data_t *p1, ldlm_policy_data_t *p2)
{
int i;
for (i = 0; i < RES_NAME_SIZE; i++) {
- /* return 1 here, because enqueue_ordered will skip resources
- * of all zeroes if they're sorted to the end of the list. */
+ /*
+ * this is needed to make zeroed res_id entries to be put at the
+ * end of list in *ordered_locks() .
+ */
if (res1->name[i] == 0 && res2->name[i] != 0)
return 1;
if (res2->name[i] == 0 && res1->name[i] != 0)
return 0;
-
if (res1->name[i] > res2->name[i])
return 1;
if (res1->name[i] < res2->name[i])
struct lustre_handle *p2_lockh, int p2_lock_mode,
ldlm_policy_data_t *p2_policy)
{
+ int lock_modes[2] = { p1_lock_mode, p2_lock_mode };
struct ldlm_res_id *res_id[2] = { p1_res_id, p2_res_id };
struct lustre_handle *handles[2] = { p1_lockh, p2_lockh };
- int lock_modes[2] = { p1_lock_mode, p2_lock_mode };
ldlm_policy_data_t *policies[2] = { p1_policy, p2_policy };
int rc, flags;
ENTRY;
LASSERT(p1_res_id != NULL && p2_res_id != NULL);
- CDEBUG(D_INFO, "locks before: "LPU64"/"LPU64"\n", res_id[0]->name[0],
- res_id[1]->name[0]);
+ CDEBUG(D_INFO, "locks before: "LPU64"/"LPU64"\n",
+ res_id[0]->name[0], res_id[1]->name[0]);
if (res_gt(p1_res_id, p2_res_id, p1_policy, p2_policy)) {
handles[1] = p1_lockh;
res_id[0]->name[0], res_id[1]->name[0], res_id[2]->name[0],
res_id[3]->name[0]);
- /* simple insertion sort - we have at most 4 elements */
+ /*
+ * simple insertion sort - we have at most 4 elements. Note, that zeroed
+ * res_id should be at the end of list after sorting is finished.
+ */
for (i = 1; i < 4; i++) {
j = i - 1;
dlm_handles[4] = dlm_handles[i];
/* XXX we could send ASTs on all these locks first before blocking? */
for (i = 0; i < 4; i++) {
flags = 0;
+
+ /*
+ * nevertheless zeroed res_ids should be at the end of list, and
+ * could use break here, I think, that it is more correctly for
+ * clear understanding of code to have continue here, as it
+ * clearly means, that zeroed res_id should be skipped and does
+ * not mean, that if we meet zeroed res_id we should stop
+ * locking loop.
+ */
if (res_id[i]->name[0] == 0)
continue;
+
if (i != 0 &&
!memcmp(res_id[i], res_id[i-1], sizeof(*res_id[i])) &&
(policies[i]->l_inodebits.bits &
struct dentry **dchildp, int child_mode,
ldlm_policy_data_t *child_policy,
const char *name, int namelen,
- struct ldlm_res_id *maxres)
+ struct ldlm_res_id *maxres,
+ unsigned long child_ino,
+ __u32 child_gen)
{
+ struct lustre_id sid;
struct dentry *vchild, *dchild = *dchildp;
int rc = 0, cleanup_phase = 2; /* parent, child locks */
ENTRY;
GOTO(cleanup, rc = PTR_ERR(vchild));
if ((vchild->d_flags & DCACHE_CROSS_REF)) {
- if (child_res_id->name[0] == vchild->d_inum &&
- child_res_id->name[1] == vchild->d_generation) {
- if (dchild != NULL)
+ if (child_gen == vchild->d_generation &&
+ child_ino == vchild->d_inum) {
+ if (dchild)
l_dput(dchild);
*dchildp = vchild;
RETURN(0);
if (likely((vchild->d_inode == NULL && child_res_id->name[0] == 0) ||
(vchild->d_inode != NULL &&
- child_res_id->name[0] == vchild->d_inode->i_ino &&
- child_res_id->name[1] == vchild->d_inode->i_generation))) {
- if (dchild != NULL)
+ child_gen == vchild->d_inode->i_generation &&
+ child_ino == vchild->d_inode->i_ino))) {
+ if (dchild)
l_dput(dchild);
*dchildp = vchild;
-
RETURN(0);
}
vchild->d_inode, dchild ? dchild->d_inode : 0,
vchild->d_inode ? vchild->d_inode->i_ino : 0,
child_res_id->name[0]);
+
if (child_res_id->name[0] != 0)
ldlm_lock_decref(child_lockh, child_mode);
if (dchild)
if (dchild->d_inode || (dchild->d_flags & DCACHE_CROSS_REF)) {
int flags = 0;
+
if (dchild->d_inode) {
- child_res_id->name[0] = dchild->d_inode->i_ino;
- child_res_id->name[1] = dchild->d_inode->i_generation;
+ down(&dchild->d_inode->i_sem);
+ rc = mds_read_inode_sid(obd, dchild->d_inode, &sid);
+ up(&dchild->d_inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, inode %lu,"
+ " rc %d\n", dchild->d_inode->i_ino, rc);
+ GOTO(cleanup, rc);
+ }
+ child_res_id->name[0] = id_fid(&sid);
+ child_res_id->name[1] = id_group(&sid);
} else {
- child_res_id->name[0] = dchild->d_inum;
- child_res_id->name[1] = dchild->d_generation;
+ child_res_id->name[0] = dchild->d_fid;
+ child_res_id->name[1] = dchild->d_mdsnum;
}
if (res_gt(parent_res_id, child_res_id, NULL, NULL) ||
memset(child_res_id, 0, sizeof(*child_res_id));
}
- EXIT;
cleanup:
if (rc) {
switch(cleanup_phase) {
ldlm_lock_decref(parent_lockh, parent_mode);
}
}
- return rc;
+ RETURN(rc);
}
int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
- struct ll_fid *fid,
+ struct lustre_id *id,
struct lustre_handle *parent_lockh,
struct dentry **dparentp, int parent_mode,
__u64 parent_lockpart, int *update_mode,
struct dentry **dchildp, int child_mode,
__u64 child_lockpart)
{
- struct ldlm_res_id child_res_id = { .name = {0} };
- struct ldlm_res_id parent_res_id = { .name = {0} };
ldlm_policy_data_t parent_policy = {.l_inodebits = { parent_lockpart }};
ldlm_policy_data_t child_policy = {.l_inodebits = { child_lockpart }};
- struct inode *inode;
+ struct ldlm_res_id parent_res_id = { .name = {0} };
+ struct ldlm_res_id child_res_id = { .name = {0} };
int rc = 0, cleanup_phase = 0;
+ unsigned long child_ino;
+ struct lustre_id sid;
+ __u32 child_gen = 0;
+ struct inode *inode;
ENTRY;
/* Step 1: Lookup parent */
- *dparentp = mds_fid2dentry(mds, fid, NULL);
+ *dparentp = mds_id2dentry(obd, id, NULL);
if (IS_ERR(*dparentp)) {
rc = PTR_ERR(*dparentp);
*dparentp = NULL;
CDEBUG(D_INODE, "parent ino %lu, name %s\n",
(*dparentp)->d_inode->i_ino, name);
- parent_res_id.name[0] = (*dparentp)->d_inode->i_ino;
- parent_res_id.name[1] = (*dparentp)->d_inode->i_generation;
+ parent_res_id.name[0] = id_fid(id);
+ parent_res_id.name[1] = id_group(id);
+
#ifdef S_PDIROPS
parent_lockh[1].cookie = 0;
if (name && IS_PDIROPS((*dparentp)->d_inode)) {
struct ldlm_res_id res_id = { .name = {0} };
ldlm_policy_data_t policy;
int flags = 0;
+
*update_mode = mds_lock_mode_for_dir(obd, *dparentp, parent_mode);
if (*update_mode) {
- res_id.name[0] = (*dparentp)->d_inode->i_ino;
- res_id.name[1] = (*dparentp)->d_inode->i_generation;
+ res_id.name[0] = id_fid(id);
+ res_id.name[1] = id_group(id);
policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
+
rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace,
res_id, LDLM_IBITS, &policy,
*update_mode, &flags,
}
parent_res_id.name[2] = full_name_hash(name, namelen - 1);
- CDEBUG(D_INFO, "take lock on %lu:%u:"LPX64"\n",
- (*dparentp)->d_inode->i_ino,
- (*dparentp)->d_inode->i_generation,
+
+ CDEBUG(D_INFO, "take lock on %lu:%lu:"LPX64"\n",
+ (unsigned long)id_fid(id), (unsigned long)id_group(id),
parent_res_id.name[2]);
}
#endif
}
if ((*dchildp)->d_flags & DCACHE_CROSS_REF) {
- /* inode lives on another MDS: return * mds/ino/gen
- * and LOOKUP lock. drop possible UPDATE lock! */
+ /*
+ * inode lives on another MDS: return * fid/mdsnum and LOOKUP
+ * lock. Drop possible UPDATE lock!
+ */
child_policy.l_inodebits.bits &= ~MDS_INODELOCK_UPDATE;
child_policy.l_inodebits.bits |= MDS_INODELOCK_LOOKUP;
- child_res_id.name[0] = (*dchildp)->d_inum;
- child_res_id.name[1] = (*dchildp)->d_generation;
+
+ child_res_id.name[0] = (*dchildp)->d_fid;
+ child_res_id.name[1] = (*dchildp)->d_mdsnum;
+ child_gen = (*dchildp)->d_generation;
+ child_ino = (*dchildp)->d_inum;
goto retry_locks;
}
if (inode == NULL)
goto retry_locks;
- child_res_id.name[0] = inode->i_ino;
- child_res_id.name[1] = inode->i_generation;
-
+ down(&inode->i_sem);
+ rc = mds_read_inode_sid(obd, inode, &sid);
+ up(&inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, inode %lu, "
+ "rc %d\n", inode->i_ino, rc);
+ iput(inode);
+ GOTO(cleanup, rc);
+ }
+
+ child_res_id.name[0] = id_fid(&sid);
+ child_res_id.name[1] = id_group(&sid);
+ child_gen = inode->i_generation;
+ child_ino = inode->i_ino;
iput(inode);
retry_locks:
cleanup_phase = 2; /* child dentry */
/* Step 3: Lock parent and child in resource order. If child doesn't
- * exist, we still have to lock the parent and re-lookup. */
- rc = enqueue_ordered_locks(obd,&parent_res_id,parent_lockh,parent_mode,
+ * exist, we still have to lock the parent and re-lookup. */
+ rc = enqueue_ordered_locks(obd, &parent_res_id, parent_lockh, parent_mode,
&parent_policy, &child_res_id, child_lockh,
child_mode, &child_policy);
if (rc)
rc = mds_verify_child(obd, &parent_res_id, parent_lockh, *dparentp,
parent_mode, &child_res_id, child_lockh,
dchildp, child_mode, &child_policy,
- name, namelen, &parent_res_id);
+ name, namelen, &parent_res_id,
+ child_ino, child_gen);
if (rc > 0)
goto retry_locks;
if (rc < 0) {
ldlm_lock_decref(parent_lockh + 1, *update_mode);
#endif
l_dput(*dparentp);
- default: ;
}
}
- return rc;
+ RETURN(rc);
}
void mds_reconstruct_generic(struct ptlrpc_request *req)
struct inode *pending_dir = mds->mds_pending_dir->d_inode;
struct inode *inode = dentry->d_inode;
struct dentry *pending_child;
- char fidname[LL_FID_NAMELEN];
- int fidlen = 0, rc, mode;
+ char idname[LL_ID_NAMELEN];
+ int idlen = 0, rc, mode;
ENTRY;
LASSERT(inode != NULL);
#endif
LASSERT(down_trylock(&pending_dir->i_sem) != 0);
- fidlen = ll_fid2str(fidname, inode->i_ino, inode->i_generation);
+ idlen = ll_id2str(idname, inode->i_ino, inode->i_generation);
CDEBUG(D_INODE, "pending destroy of %dx open %d linked %s %s = %s\n",
mds_orphan_open_count(inode), inode->i_nlink,
S_ISDIR(inode->i_mode) ? "dir" :
- S_ISREG(inode->i_mode) ? "file" : "other",rec->ur_name,fidname);
+ S_ISREG(inode->i_mode) ? "file" : "other",
+ rec->ur_name, idname);
if (mds_orphan_open_count(inode) == 0 || inode->i_nlink != 0)
RETURN(0);
- pending_child = lookup_one_len(fidname, mds->mds_pending_dir, fidlen);
+ pending_child = lookup_one_len(idname, mds->mds_pending_dir, idlen);
if (IS_ERR(pending_child))
RETURN(PTR_ERR(pending_child));
}
int mds_create_local_dentry(struct mds_update_record *rec,
- struct obd_device *obd)
+ struct obd_device *obd)
{
struct mds_obd *mds = &obd->u.mds;
- struct inode *fids_dir = mds->mds_fids_dir->d_inode;
- int fidlen = 0, rc, cleanup_phase = 0;
+ struct inode *id_dir = mds->mds_id_dir->d_inode;
+ int idlen = 0, rc, cleanup_phase = 0;
struct dentry *new_child = NULL;
- char *fidname = rec->ur_name;
+ char *idname = rec->ur_name;
struct dentry *child = NULL;
struct lustre_handle lockh[2] = {{0}, {0}};
+ struct lustre_id sid;
void *handle;
ENTRY;
- down(&fids_dir->i_sem);
- fidlen = ll_fid2str(fidname, rec->ur_fid1->id, rec->ur_fid1->generation);
- CDEBUG(D_OTHER, "look for local dentry '%s' for %u/%u\n",
- fidname, (unsigned) rec->ur_fid1->id,
- (unsigned) rec->ur_fid1->generation);
+ down(&id_dir->i_sem);
+ idlen = ll_id2str(idname, id_ino(rec->ur_id1),
+ id_gen(rec->ur_id1));
+
+ CDEBUG(D_OTHER, "look for local dentry '%s' for "DLID4"\n",
+ idname, OLID4(rec->ur_id1));
- new_child = lookup_one_len(fidname, mds->mds_fids_dir, fidlen);
- up(&fids_dir->i_sem);
+ new_child = ll_lookup_one_len(idname, mds->mds_id_dir,
+ idlen);
+ up(&id_dir->i_sem);
if (IS_ERR(new_child)) {
- CERROR("can't lookup %s: %d\n", fidname,
- (int) PTR_ERR(new_child));
+ CERROR("can't lookup %s: %d\n", idname,
+ (int) PTR_ERR(new_child));
GOTO(cleanup, rc = PTR_ERR(new_child));
}
cleanup_phase = 1;
+ down(&id_dir->i_sem);
+ rc = mds_read_inode_sid(obd, id_dir, &sid);
+ up(&id_dir->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, inode %lu, "
+ "rc %d\n", id_dir->i_ino, rc);
+ GOTO(cleanup, rc);
+ }
+
if (new_child->d_inode != NULL) {
/* nice. we've already have local dentry! */
CDEBUG(D_OTHER, "found dentry in FIDS/: %u/%u\n",
- (unsigned) new_child->d_inode->i_ino,
- (unsigned) new_child->d_inode->i_generation);
- rec->ur_fid1->id = fids_dir->i_ino;
- rec->ur_fid1->generation = fids_dir->i_generation;
- rec->ur_namelen = fidlen + 1;
+ (unsigned)new_child->d_inode->i_ino,
+ (unsigned)new_child->d_inode->i_generation);
+
+ id_ino(rec->ur_id1) = id_dir->i_ino;
+ id_gen(rec->ur_id1) = id_dir->i_generation;
+ rec->ur_namelen = idlen + 1;
+
+ id_fid(rec->ur_id1) = id_fid(&sid);
+ id_group(rec->ur_id1) = id_group(&sid);
+
GOTO(cleanup, rc = 0);
}
d_drop(new_child);
if (rec->ur_mode & MDS_MODE_DONT_LOCK) {
- child = mds_fid2dentry(mds, rec->ur_fid1, NULL);
+ child = mds_id2dentry(obd, rec->ur_id1, NULL);
} else {
- child = mds_fid2locked_dentry(obd, rec->ur_fid1, NULL,
- LCK_EX, lockh, NULL, NULL, 0,
- MDS_INODELOCK_UPDATE);
+ child = mds_id2locked_dentry(obd, rec->ur_id1, NULL,
+ LCK_EX, lockh, NULL, NULL, 0,
+ MDS_INODELOCK_UPDATE);
}
if (IS_ERR(child)) {
}
cleanup_phase = 2;
- handle = fsfilt_start(obd, fids_dir, FSFILT_OP_LINK, NULL);
+ handle = fsfilt_start(obd, id_dir, FSFILT_OP_LINK, NULL);
if (IS_ERR(handle))
GOTO(cleanup, rc = PTR_ERR(handle));
- rc = fsfilt_add_dir_entry(obd, mds->mds_fids_dir, fidname, fidlen,
- rec->ur_fid1->id, rec->ur_fid1->generation,
- mds->mds_num);
+ rc = fsfilt_add_dir_entry(obd, mds->mds_id_dir, idname,
+ idlen, id_ino(rec->ur_id1),
+ id_gen(rec->ur_id1), mds->mds_num,
+ id_fid(rec->ur_id1));
if (rc)
CERROR("error linking orphan %lu/%lu to FIDS: rc = %d\n",
- (unsigned long) child->d_inode->i_ino,
- (unsigned long) child->d_inode->i_generation, rc);
+ (unsigned long)child->d_inode->i_ino,
+ (unsigned long)child->d_inode->i_generation, rc);
else {
if (S_ISDIR(child->d_inode->i_mode)) {
- fids_dir->i_nlink++;
- mark_inode_dirty(fids_dir);
+ id_dir->i_nlink++;
+ mark_inode_dirty(id_dir);
}
mark_inode_dirty(child->d_inode);
}
- fsfilt_commit(obd, mds->mds_sb, fids_dir, handle, 0);
+ fsfilt_commit(obd, mds->mds_sb, id_dir, handle, 0);
- rec->ur_fid1->id = fids_dir->i_ino;
- rec->ur_fid1->generation = fids_dir->i_generation;
- rec->ur_namelen = fidlen + 1;
+ id_ino(rec->ur_id1) = id_dir->i_ino;
+ id_gen(rec->ur_id1) = id_dir->i_generation;
+ rec->ur_namelen = idlen + 1;
+ id_fid(rec->ur_id1) = id_fid(&sid);
+ id_group(rec->ur_id1) = id_group(&sid);
cleanup:
switch(cleanup_phase) {
case 2:
}
static int mds_copy_unlink_reply(struct ptlrpc_request *master,
- struct ptlrpc_request *slave)
+ struct ptlrpc_request *slave)
{
void *cookie, *cookie2;
struct mds_body *body2;
body2 = lustre_msg_buf(master->rq_repmsg, 0, sizeof (*body));
LASSERT(body2 != NULL);
- if (!(body->valid & (OBD_MD_FLID | OBD_MD_FLGENER))) {
+ if (!(body->valid & (OBD_MD_FLID | OBD_MD_FLGENER)))
RETURN(0);
- }
memcpy(body2, body, sizeof(*body));
body2->valid &= ~OBD_MD_FLCOOKIE;
RETURN(0);
}
-static int mds_reint_unlink_remote(struct mds_update_record *rec, int offset,
- struct ptlrpc_request *req,
+static int mds_reint_unlink_remote(struct mds_update_record *rec,
+ int offset, struct ptlrpc_request *req,
struct lustre_handle *parent_lockh,
- int update_mode,
- struct dentry *dparent,
+ int update_mode, struct dentry *dparent,
struct lustre_handle *child_lockh,
struct dentry *dchild)
{
struct obd_device *obd = req->rq_export->exp_obd;
struct mds_obd *mds = mds_req2mds(req);
- struct mdc_op_data op_data;
- int rc = 0, cleanup_phase = 0;
struct ptlrpc_request *request = NULL;
+ int rc = 0, cleanup_phase = 0;
+ struct mdc_op_data op_data;
void *handle;
ENTRY;
LASSERT(offset == 1 || offset == 3);
- DEBUG_REQ(D_INODE, req, "unlink %*s (remote inode %u/%u/%u)",
- rec->ur_namelen - 1, rec->ur_name, (unsigned)dchild->d_mdsnum,
- (unsigned) dchild->d_inum, (unsigned) dchild->d_generation);
- if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)
- DEBUG_REQ(D_HA, req, "unlink %*s (remote inode %u/%u/%u)",
- rec->ur_namelen - 1, rec->ur_name,
- (unsigned)dchild->d_mdsnum,
- (unsigned) dchild->d_inum,
- (unsigned) dchild->d_generation);
-
/* time to drop i_nlink on remote MDS */
memset(&op_data, 0, sizeof(op_data));
- op_data.fid1.mds = dchild->d_mdsnum;
- op_data.fid1.id = dchild->d_inum;
- op_data.fid1.generation = dchild->d_generation;
+ mds_pack_dentry2id(obd, &op_data.id1, dchild, 1);
op_data.create_mode = rec->ur_mode;
+
+ DEBUG_REQ(D_INODE, req, "unlink %*s (remote inode "DLID4")",
+ rec->ur_namelen - 1, rec->ur_name, OLID4(&op_data.id1));
+
+ if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
+ DEBUG_REQ(D_HA, req, "unlink %*s (remote inode "DLID4")",
+ rec->ur_namelen - 1, rec->ur_name, OLID4(&op_data.id1));
+ }
+
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)
op_data.create_mode |= MDS_MODE_REPLAY;
+
rc = md_unlink(mds->mds_lmv_exp, &op_data, &request);
cleanup_phase = 2;
+
if (request) {
if (rc == 0)
mds_copy_unlink_reply(req, request);
ptlrpc_req_finished(request);
}
+
if (rc == 0) {
handle = fsfilt_start(obd, dparent->d_inode, FSFILT_OP_RMDIR,
NULL);
rc = mds_finish_transno(mds, dparent->d_inode, handle, req,
rc, 0);
}
+ EXIT;
cleanup:
req->rq_status = rc;
struct inode *child_inode = NULL;
struct lustre_handle parent_lockh[2] = {{0}, {0}};
struct lustre_handle child_lockh = {0};
-#if 0
struct lustre_handle child_reuse_lockh = {0};
-#endif
- struct lustre_handle * slave_lockh = NULL;
+ struct lustre_handle *slave_lockh = NULL;
+ char idname[LL_ID_NAMELEN];
struct llog_create_locks *lcl = NULL;
- char fidname[LL_FID_NAMELEN];
void *handle = NULL;
int rc = 0, cleanup_phase = 0;
- int unlink_by_fid = 0;
+ int unlink_by_id = 0;
int update_mode;
ENTRY;
LASSERT(offset == 1 || offset == 3);
DEBUG_REQ(D_INODE, req, "parent ino "LPU64"/%u, child %s",
- rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name);
+ id_ino(rec->ur_id1), id_gen(rec->ur_id1),
+ rec->ur_name);
MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
if (rec->ur_namelen == 1) {
/* this is request to drop i_nlink on local inode */
- unlink_by_fid = 1;
- rec->ur_name = fidname;
+ unlink_by_id = 1;
+ rec->ur_name = idname;
rc = mds_create_local_dentry(rec, obd);
if (rc == -ENOENT || (rec->ur_mode & MDS_MODE_REPLAY)) {
DEBUG_REQ(D_HA, req,
- "drop nlink on inode %u/%u/%u (replay)",
- (unsigned) rec->ur_fid1->mds,
- (unsigned) rec->ur_fid1->id,
- (unsigned) rec->ur_fid1->generation);
+ "drop nlink on inode "DLID4" (replay)",
+ OLID4(rec->ur_id1));
req->rq_status = 0;
RETURN(0);
}
}
if (rec->ur_mode & MDS_MODE_DONT_LOCK) {
- /* master mds for directory asks slave removing
- * inode is already locked */
- dparent = mds_fid2locked_dentry(obd, rec->ur_fid1, NULL,
+ /* master mds for directory asks slave removing inode is already
+ * locked */
+ dparent = mds_id2locked_dentry(obd, rec->ur_id1, NULL,
LCK_PW, parent_lockh,
&update_mode, rec->ur_name,
rec->ur_namelen,
MDS_INODELOCK_UPDATE);
if (IS_ERR(dparent))
GOTO(cleanup, rc = PTR_ERR(dparent));
- dchild = ll_lookup_one_len(rec->ur_name, dparent,
+ dchild = ll_lookup_one_len(rec->ur_name, dparent,
rec->ur_namelen - 1);
if (IS_ERR(dchild))
GOTO(cleanup, rc = PTR_ERR(dchild));
LASSERT(dchild->d_inode != NULL);
LASSERT(S_ISDIR(dchild->d_inode->i_mode));
} else {
- rc = mds_get_parent_child_locked(obd, mds, rec->ur_fid1,
+ rc = mds_get_parent_child_locked(obd, mds, rec->ur_id1,
parent_lockh, &dparent,
LCK_PW, MDS_INODELOCK_UPDATE,
&update_mode, rec->ur_name,
if (dchild->d_flags & DCACHE_CROSS_REF) {
/* we should have parent lock only here */
- LASSERT(unlink_by_fid == 0);
+ LASSERT(unlink_by_id == 0);
LASSERT(dchild->d_mdsnum != mds->mds_num);
mds_reint_unlink_remote(rec, offset, req, parent_lockh,
update_mode, dparent, &child_lockh, dchild);
if (rc)
GOTO(cleanup, rc);
-#if 0
/* Step 4: Get a lock on the ino to sync with creation WRT inode
* reuse (see bug 2029). */
rc = mds_lock_new_child(obd, child_inode, &child_reuse_lockh);
if (rc != ELDLM_OK)
GOTO(cleanup, rc);
-#endif
cleanup_phase = 3; /* child inum lock */
OBD_FAIL_WRITE(OBD_FAIL_MDS_REINT_UNLINK_WRITE, dparent->d_inode->i_sb);
down(&mds->mds_pending_dir->d_inode->i_sem);
cleanup_phase = 5; /* up(&pending_dir->i_sem) */
} else if (S_ISREG(child_inode->i_mode)) {
- mds_pack_inode2fid(obd, &body->fid1, child_inode);
- mds_pack_inode2body(obd, body, child_inode);
- mds_pack_md(obd, req->rq_repmsg, offset + 1, body,
- child_inode, MDS_PACK_MD_LOCK);
+ mds_pack_inode2body(obd, body, child_inode, 0);
+ mds_pack_md(obd, req->rq_repmsg, offset + 1,
+ body, child_inode, MDS_PACK_MD_LOCK);
}
}
rc = mds_finish_transno(mds, dparent ? dparent->d_inode : NULL,
handle, req, rc, 0);
if (!rc)
- (void)obd_set_info(mds->mds_osc_exp, strlen("unlinked"),
+ (void)obd_set_info(mds->mds_lov_exp, strlen("unlinked"),
"unlinked", 0, NULL);
switch(cleanup_phase) {
case 5: /* pending_dir semaphore */
if (lcl != NULL)
ptlrpc_save_llog_lock(req, lcl);
case 3: /* child ino-reuse lock */
-#if 0
if (rc && body != NULL) {
// Don't unlink the OST objects if the MDS unlink failed
body->valid = 0;
ldlm_lock_decref(&child_reuse_lockh, LCK_EX);
else
ptlrpc_save_lock(req, &child_reuse_lockh, LCK_EX);
-#endif
case 2: /* child lock */
mds_unlock_slave_objs(obd, dchild, slave_lockh);
if (child_lockh.cookie)
* to service requests from remote MDS to increment i_nlink
*/
static int mds_reint_link_acquire(struct mds_update_record *rec,
- int offset, struct ptlrpc_request *req,
- struct lustre_handle *lh)
+ int offset, struct ptlrpc_request *req,
+ struct lustre_handle *lh)
{
struct obd_device *obd = req->rq_export->exp_obd;
struct ldlm_res_id src_res_id = { .name = {0} };
int flags = 0;
ENTRY;
- DEBUG_REQ(D_INODE, req, "%s: request to acquire i_nlinks %u/%u/%u\n",
- obd->obd_name, (unsigned) rec->ur_fid1->mds,
- (unsigned) rec->ur_fid1->id,
- (unsigned) rec->ur_fid1->generation);
+ DEBUG_REQ(D_INODE, req, "%s: request to acquire i_nlinks "DLID4"\n",
+ obd->obd_name, OLID4(rec->ur_id1));
- /* Step 1: Lookup the source inode and target directory by FID */
- de_src = mds_fid2dentry(mds, rec->ur_fid1, NULL);
+ /* Step 1: Lookup the source inode and target directory by ID */
+ de_src = mds_id2dentry(obd, rec->ur_id1, NULL);
if (IS_ERR(de_src))
GOTO(cleanup, rc = PTR_ERR(de_src));
cleanup_phase = 1; /* source dentry */
- src_res_id.name[0] = de_src->d_inode->i_ino;
- src_res_id.name[1] = de_src->d_inode->i_generation;
+ src_res_id.name[0] = id_fid(rec->ur_id1);
+ src_res_id.name[1] = id_group(rec->ur_id1);
policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace,
- src_res_id, LDLM_IBITS, &policy,
- LCK_EX, &flags, mds_blocking_ast,
- ldlm_completion_ast, NULL, NULL,
- NULL, 0, NULL, &src_lockh);
+ src_res_id, LDLM_IBITS, &policy,
+ LCK_EX, &flags, mds_blocking_ast,
+ ldlm_completion_ast, NULL, NULL,
+ NULL, 0, NULL, &src_lockh);
if (rc != ELDLM_OK)
GOTO(cleanup, rc = -ENOLCK);
cleanup_phase = 2; /* lock */
int update_mode;
ENTRY;
-#define fmt "%s: request to link %u/%u/%u:%*s to foreign inode %u/%u/%u\n"
- DEBUG_REQ(D_INODE, req, fmt, obd->obd_name,
- (unsigned) rec->ur_fid2->mds,
- (unsigned) rec->ur_fid2->id,
- (unsigned) rec->ur_fid2->generation,
- rec->ur_namelen - 1, rec->ur_name,
- (unsigned) rec->ur_fid1->mds,
- (unsigned) rec->ur_fid1->id,
- (unsigned)rec->ur_fid1->generation);
-
- de_tgt_dir = mds_fid2locked_dentry(obd, rec->ur_fid2, NULL, LCK_EX,
- tgt_dir_lockh, &update_mode,
- rec->ur_name, rec->ur_namelen - 1,
- MDS_INODELOCK_UPDATE);
+ DEBUG_REQ(D_INODE, req, "%s: request to link "DLID4
+ ":%*s to foreign inode "DLID4"\n", obd->obd_name,
+ OLID4(rec->ur_id2), rec->ur_namelen - 1, rec->ur_name,
+ OLID4(rec->ur_id1));
+
+ de_tgt_dir = mds_id2locked_dentry(obd, rec->ur_id2, NULL, LCK_EX,
+ tgt_dir_lockh, &update_mode,
+ rec->ur_name, rec->ur_namelen - 1,
+ MDS_INODELOCK_UPDATE);
if (IS_ERR(de_tgt_dir))
GOTO(cleanup, rc = PTR_ERR(de_tgt_dir));
cleanup_phase = 1;
- op_data.fid1 = *(rec->ur_fid1);
+ op_data.id1 = *(rec->ur_id1);
op_data.namelen = 0;
op_data.name = NULL;
rc = md_link(mds->mds_lmv_exp, &op_data, &request);
}
rc = fsfilt_add_dir_entry(obd, de_tgt_dir, rec->ur_name,
- rec->ur_namelen - 1, rec->ur_fid1->id,
- rec->ur_fid1->generation, rec->ur_fid1->mds);
+ rec->ur_namelen - 1, id_ino(rec->ur_id1),
+ id_gen(rec->ur_id1), id_group(rec->ur_id1),
+ id_fid(rec->ur_id1));
cleanup_phase = 3;
cleanup:
LASSERT(offset == 1);
DEBUG_REQ(D_INODE, req, "original "LPU64"/%u to "LPU64"/%u %s",
- rec->ur_fid1->id, rec->ur_fid1->generation,
- rec->ur_fid2->id, rec->ur_fid2->generation, rec->ur_name);
+ id_ino(rec->ur_id1), id_gen(rec->ur_id1),
+ id_ino(rec->ur_id2), id_gen(rec->ur_id2),
+ rec->ur_name);
MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
-
MDS_UPDATE_COUNTER(mds, MDS_LINK_COUNT);
// memset(tgt_dir_lockh, 0, 2*sizeof(tgt_dir_lockh[0]));
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_LINK))
GOTO(cleanup, rc = -ENOENT);
- if (rec->ur_fid1->mds != mds->mds_num) {
+ if (id_group(rec->ur_id1) != mds->mds_num) {
rc = mds_reint_link_to_remote(rec, offset, req, lh);
RETURN(rc);
}
RETURN(rc);
}
- /* Step 1: Lookup the source inode and target directory by FID */
- de_src = mds_fid2dentry(mds, rec->ur_fid1, NULL);
+ /* Step 1: Lookup the source inode and target directory by ID */
+ de_src = mds_id2dentry(obd, rec->ur_id1, NULL);
if (IS_ERR(de_src))
GOTO(cleanup, rc = PTR_ERR(de_src));
cleanup_phase = 1; /* source dentry */
- de_tgt_dir = mds_fid2dentry(mds, rec->ur_fid2, NULL);
+ de_tgt_dir = mds_id2dentry(obd, rec->ur_id2, NULL);
if (IS_ERR(de_tgt_dir)) {
rc = PTR_ERR(de_tgt_dir);
de_tgt_dir = NULL;
cleanup_phase = 2; /* target directory dentry */
CDEBUG(D_INODE, "linking %*s/%s to inode %lu\n",
- de_tgt_dir->d_name.len, de_tgt_dir->d_name.name, rec->ur_name,
- de_src->d_inode->i_ino);
+ de_tgt_dir->d_name.len, de_tgt_dir->d_name.name,
+ rec->ur_name, de_src->d_inode->i_ino);
/* Step 2: Take the two locks */
- src_res_id.name[0] = de_src->d_inode->i_ino;
- src_res_id.name[1] = de_src->d_inode->i_generation;
- tgt_dir_res_id.name[0] = de_tgt_dir->d_inode->i_ino;
- tgt_dir_res_id.name[1] = de_tgt_dir->d_inode->i_generation;
+ src_res_id.name[0] = id_fid(rec->ur_id1);
+ src_res_id.name[1] = id_group(rec->ur_id1);
+ tgt_dir_res_id.name[0] = id_fid(rec->ur_id2);
+ tgt_dir_res_id.name[1] = id_group(rec->ur_id2);
+
#ifdef S_PDIROPS
if (IS_PDIROPS(de_tgt_dir->d_inode)) {
int flags = 0;
tgt_dir_res_id.name[2] = full_name_hash(rec->ur_name,
rec->ur_namelen - 1);
- CDEBUG(D_INFO, "take lock on %lu:%u:"LPX64"\n",
- de_tgt_dir->d_inode->i_ino,
- de_tgt_dir->d_inode->i_generation,
+ CDEBUG(D_INFO, "take lock on %lu:%lu:"LPX64"\n",
+ (unsigned long)id_fid(rec->ur_id2),
+ (unsigned long)id_group(rec->ur_id2),
tgt_dir_res_id.name[2]);
}
#endif
rc = enqueue_ordered_locks(obd, &src_res_id, &src_lockh, LCK_EX,
- &src_policy,
- &tgt_dir_res_id, tgt_dir_lockh, LCK_EX,
- &tgt_dir_policy);
+ &src_policy, &tgt_dir_res_id, tgt_dir_lockh,
+ LCK_EX, &tgt_dir_policy);
if (rc)
GOTO(cleanup, rc);
cleanup_phase = 3; /* locks */
/* Step 3: Lookup the child */
- dchild = ll_lookup_one_len(rec->ur_name, de_tgt_dir, rec->ur_namelen-1);
+ dchild = ll_lookup_one_len(rec->ur_name, de_tgt_dir,
+ rec->ur_namelen - 1);
if (IS_ERR(dchild)) {
rc = PTR_ERR(dchild);
if (rc != -EPERM && rc != -EACCES)
*/
static int mds_get_parents_children_locked(struct obd_device *obd,
struct mds_obd *mds,
- struct ll_fid *p1_fid,
+ struct lustre_id *p1_id,
struct dentry **de_srcdirp,
- struct ll_fid *p2_fid,
+ struct lustre_id *p2_id,
struct dentry **de_tgtdirp,
int parent_mode,
const char *old_name, int old_len,
MDS_INODELOCK_UPDATE}};
struct ldlm_res_id *maxres_src, *maxres_tgt;
struct inode *inode;
+ __u32 child1_gen = 0;
+ __u32 child2_gen = 0;
+ unsigned long child1_ino;
+ unsigned long child2_ino;
int rc = 0, cleanup_phase = 0;
ENTRY;
/* Step 1: Lookup the source directory */
- *de_srcdirp = mds_fid2dentry(mds, p1_fid, NULL);
+ *de_srcdirp = mds_id2dentry(obd, p1_id, NULL);
if (IS_ERR(*de_srcdirp))
GOTO(cleanup, rc = PTR_ERR(*de_srcdirp));
cleanup_phase = 1; /* source directory dentry */
- p1_res_id.name[0] = (*de_srcdirp)->d_inode->i_ino;
- p1_res_id.name[1] = (*de_srcdirp)->d_inode->i_generation;
+ p1_res_id.name[0] = id_fid(p1_id);
+ p1_res_id.name[1] = id_group(p1_id);
/* Step 2: Lookup the target directory */
- if (memcmp(p1_fid, p2_fid, sizeof(*p1_fid)) == 0) {
+ if (id_equal_stc(p1_id, p2_id)) {
*de_tgtdirp = dget(*de_srcdirp);
} else {
- *de_tgtdirp = mds_fid2dentry(mds, p2_fid, NULL);
+ *de_tgtdirp = mds_id2dentry(obd, p2_id, NULL);
if (IS_ERR(*de_tgtdirp)) {
rc = PTR_ERR(*de_tgtdirp);
*de_tgtdirp = NULL;
cleanup_phase = 2; /* target directory dentry */
- p2_res_id.name[0] = (*de_tgtdirp)->d_inode->i_ino;
- p2_res_id.name[1] = (*de_tgtdirp)->d_inode->i_generation;
+ p2_res_id.name[0] = id_fid(p2_id);
+ p2_res_id.name[1] = id_group(p2_id);
#ifdef S_PDIROPS
dlm_handles[5].cookie = 0;
dlm_handles[6].cookie = 0;
+
if (IS_PDIROPS((*de_srcdirp)->d_inode)) {
- /* Get a temp lock on just ino, gen to flush client cache and
- * to protect dirs from concurrent splitting */
- rc = enqueue_ordered_locks(obd, &p1_res_id, &(dlm_handles[5]),
+ /*
+ * get a temp lock on just fid, group to flush client cache and
+ * to protect dirs from concurrent splitting.
+ */
+ rc = enqueue_ordered_locks(obd, &p1_res_id, &dlm_handles[5],
LCK_PW, &p_policy, &p2_res_id,
- &(dlm_handles[6]),LCK_PW,&p_policy);
+ &dlm_handles[6], LCK_PW, &p_policy);
if (rc != ELDLM_OK)
GOTO(cleanup, rc);
+
p1_res_id.name[2] = full_name_hash(old_name, old_len - 1);
p2_res_id.name[2] = full_name_hash(new_name, new_len - 1);
- CDEBUG(D_INFO, "take locks on %lu:%u:"LPX64", %lu:%u:"LPX64"\n",
- (*de_srcdirp)->d_inode->i_ino,
- (*de_srcdirp)->d_inode->i_generation, p1_res_id.name[2],
- (*de_tgtdirp)->d_inode->i_ino,
- (*de_tgtdirp)->d_inode->i_generation, p2_res_id.name[2]);
+
+ CDEBUG(D_INFO, "take locks on "
+ LPX64":"LPX64":"LPX64", "LPX64":"LPX64":"LPX64"\n",
+ p1_res_id.name[0], p1_res_id.name[1], p1_res_id.name[2],
+ p2_res_id.name[0], p2_res_id.name[1], p2_res_id.name[2]);
}
cleanup_phase = 3;
#endif
/* Step 3: Lookup the source child entry */
- *de_oldp = ll_lookup_one_len(old_name, *de_srcdirp, old_len - 1);
+ *de_oldp = ll_lookup_one_len(old_name, *de_srcdirp,
+ old_len - 1);
if (IS_ERR(*de_oldp)) {
rc = PTR_ERR(*de_oldp);
CERROR("old child lookup error (%*s): %d\n",
cleanup_phase = 4; /* original name dentry */
inode = (*de_oldp)->d_inode;
-
if (inode != NULL) {
+ struct lustre_id sid;
+
inode = igrab(inode);
if (inode == NULL)
GOTO(cleanup, rc = -ENOENT);
- c1_res_id.name[0] = inode->i_ino;
- c1_res_id.name[1] = inode->i_generation;
+ down(&inode->i_sem);
+ rc = mds_read_inode_sid(obd, inode, &sid);
+ up(&inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, inode %lu, "
+ "rc %d\n", inode->i_ino, rc);
+ iput(inode);
+ GOTO(cleanup, rc);
+ }
+
+ c1_res_id.name[0] = id_fid(&sid);
+ c1_res_id.name[1] = id_group(&sid);
+ child1_gen = inode->i_generation;
+ child1_ino = inode->i_ino;
iput(inode);
} else if ((*de_oldp)->d_flags & DCACHE_CROSS_REF) {
- c1_res_id.name[0] = (*de_oldp)->d_inum;
- c1_res_id.name[1] = (*de_oldp)->d_generation;
+ c1_res_id.name[0] = (*de_oldp)->d_fid;
+ c1_res_id.name[1] = (*de_oldp)->d_mdsnum;
+ child1_gen = (*de_oldp)->d_generation;
+ child1_ino = (*de_oldp)->d_inum;
+ } else {
+ GOTO(cleanup, rc = -ENOENT);
}
/* Step 4: Lookup the target child entry */
- *de_newp = ll_lookup_one_len(new_name, *de_tgtdirp, new_len - 1);
+ *de_newp = ll_lookup_one_len(new_name, *de_tgtdirp,
+ new_len - 1);
if (IS_ERR(*de_newp)) {
rc = PTR_ERR(*de_newp);
CERROR("new child lookup error (%*s): %d\n",
cleanup_phase = 5; /* target dentry */
inode = (*de_newp)->d_inode;
-
- if (inode == NULL)
- goto retry_locks;
-
if (inode != NULL) {
+ struct lustre_id sid;
+
inode = igrab(inode);
if (inode == NULL)
goto retry_locks;
- c2_res_id.name[0] = inode->i_ino;
- c2_res_id.name[1] = inode->i_generation;
+ down(&inode->i_sem);
+ rc = mds_read_inode_sid(obd, inode, &sid);
+ up(&inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, inode %lu, "
+ "rc %d\n", inode->i_ino, rc);
+ GOTO(cleanup, rc);
+ }
+
+ c2_res_id.name[0] = id_fid(&sid);
+ c2_res_id.name[1] = id_group(&sid);
+ child2_gen = inode->i_generation;
+ child2_ino = inode->i_ino;
iput(inode);
} else if ((*de_newp)->d_flags & DCACHE_CROSS_REF) {
- c2_res_id.name[0] = (*de_newp)->d_inum;
- c2_res_id.name[1] = (*de_newp)->d_generation;
+ c2_res_id.name[0] = (*de_newp)->d_fid;
+ c2_res_id.name[1] = (*de_newp)->d_mdsnum;
+ child2_gen = (*de_newp)->d_generation;
+ child2_ino = (*de_newp)->d_inum;
}
retry_locks:
maxres_tgt = &p2_res_id;
cleanup_phase = 5; /* target dentry */
- if (c1_res_id.name[0] != 0 && res_gt(&c1_res_id, &p1_res_id, NULL,NULL))
+ if (c1_res_id.name[0] != 0 && res_gt(&c1_res_id, &p1_res_id, NULL, NULL))
maxres_src = &c1_res_id;
- if (c2_res_id.name[0] != 0 && res_gt(&c2_res_id, &p2_res_id, NULL,NULL))
+ if (c2_res_id.name[0] != 0 && res_gt(&c2_res_id, &p2_res_id, NULL, NULL))
maxres_tgt = &c2_res_id;
- rc = enqueue_4ordered_locks(obd, &p1_res_id,&dlm_handles[0],parent_mode,
+ rc = enqueue_4ordered_locks(obd, &p1_res_id, &dlm_handles[0], parent_mode,
&p_policy,
&p2_res_id, &dlm_handles[1], parent_mode,
&p_policy,
rc = mds_verify_child(obd, &p1_res_id, &dlm_handles[0], *de_srcdirp,
parent_mode, &c1_res_id, &dlm_handles[2],
de_oldp, child_mode, &c1_policy, old_name,old_len,
- maxres_tgt);
+ maxres_tgt, child1_ino, child1_gen);
if (rc) {
if (c2_res_id.name[0] != 0)
ldlm_lock_decref(&dlm_handles[3], child_mode);
rc = mds_verify_child(obd, &p2_res_id, &dlm_handles[1], *de_tgtdirp,
parent_mode, &c2_res_id, &dlm_handles[3],
de_newp, child_mode, &c2_policy, new_name,
- new_len, maxres_src);
+ new_len, maxres_src, child2_ino, child2_gen);
if (rc) {
ldlm_lock_decref(&dlm_handles[2], child_mode);
ldlm_lock_decref(&dlm_handles[0], parent_mode);
ldlm_lock_decref(&dlm_handles[3], child_mode);
if (c1_res_id.name[0] != 0)
ldlm_lock_decref(&dlm_handles[2], child_mode);
- ldlm_lock_decref(&dlm_handles[1], parent_mode);
- ldlm_lock_decref(&dlm_handles[0], parent_mode);
+ if (dlm_handles[1].cookie != 0)
+ ldlm_lock_decref(&dlm_handles[1], parent_mode);
+ if (dlm_handles[0].cookie != 0)
+ ldlm_lock_decref(&dlm_handles[0], parent_mode);
case 5: /* target dentry */
l_dput(*de_newp);
case 4: /* source dentry */
return rc;
}
-
+
+/*
+ * checks if dentry can be removed. This function also handles cross-ref
+ * dentries.
+ */
+static int mds_check_for_rename(struct obd_device *obd,
+ struct dentry *dentry)
+{
+ struct mds_obd *mds = &obd->u.mds;
+ struct lustre_handle *rlockh;
+ struct ptlrpc_request *req;
+ struct mdc_op_data op_data;
+ struct lookup_intent it;
+ int handle_size, rc = 0;
+ ENTRY;
+
+ LASSERT(dentry != NULL);
+
+ if (dentry->d_inode) {
+ if (S_ISDIR(dentry->d_inode->i_mode) &&
+ !mds_is_dir_empty(obd, dentry))
+ rc = -ENOTEMPTY;
+ } else {
+ LASSERT((dentry->d_flags & DCACHE_CROSS_REF));
+ handle_size = sizeof(struct lustre_handle);
+
+ OBD_ALLOC(rlockh, handle_size);
+ if (rlockh == NULL)
+ RETURN(-ENOMEM);
+
+ memset(rlockh, 0, handle_size);
+ memset(&op_data, 0, sizeof(op_data));
+ mds_pack_dentry2id(obd, &op_data.id1, dentry, 1);
+
+ it.it_op = IT_UNLINK;
+ rc = md_enqueue(mds->mds_lmv_exp, LDLM_IBITS, &it, LCK_EX,
+ &op_data, rlockh, NULL, 0, ldlm_completion_ast,
+ mds_blocking_ast, NULL);
+
+ if (rc)
+ RETURN(rc);
+
+ if (rlockh->cookie != 0)
+ ldlm_lock_decref(rlockh, LCK_EX);
+
+ if (it.d.lustre.it_data) {
+ req = (struct ptlrpc_request *)it.d.lustre.it_data;
+ ptlrpc_req_finished(req);
+ }
+
+ if (it.d.lustre.it_status)
+ rc = it.d.lustre.it_status;
+ OBD_FREE(rlockh, handle_size);
+ }
+ RETURN(rc);
+}
+
static int mds_add_local_dentry(struct mds_update_record *rec, int offset,
- struct ptlrpc_request *req, struct dentry *dentry,
- struct dentry *de_dir,
- struct dentry *de)
+ struct ptlrpc_request *req, struct lustre_id *id,
+ struct dentry *de_dir, struct dentry *de,
+ int del_cross_ref)
{
struct obd_device *obd = req->rq_export->exp_obd;
struct mds_obd *mds = mds_req2mds(req);
void *handle = NULL;
int rc = 0;
ENTRY;
-
+
if (de->d_inode) {
/*
* name exists and points to local inode try to unlink this name
* and create new one.
*/
CDEBUG(D_OTHER, "%s: %s points to local inode %lu/%lu\n",
- obd->obd_name, rec->ur_tgt,
- (unsigned long)de->d_inode->i_ino,
+ obd->obd_name, rec->ur_tgt, (unsigned long)de->d_inode->i_ino,
(unsigned long)de->d_inode->i_generation);
+
+ /* checking if we can remove local dentry. */
+ rc = mds_check_for_rename(obd, de);
+ if (rc)
+ GOTO(cleanup, rc);
+
handle = fsfilt_start(obd, de_dir->d_inode,
FSFILT_OP_RENAME, NULL);
if (IS_ERR(handle))
if (rc)
GOTO(cleanup, rc);
} else if (de->d_flags & DCACHE_CROSS_REF) {
- /* name exists and points to remove inode */
- CDEBUG(D_OTHER, "%s: %s points to remote inode %lu/%lu/%lu\n",
- obd->obd_name, rec->ur_tgt, (unsigned long)de->d_mdsnum,
- (unsigned long)de->d_inum,
- (unsigned long)de->d_generation);
- handle = fsfilt_start(obd, de_dir->d_inode,
- FSFILT_OP_RENAME, NULL);
- if (IS_ERR(handle))
- GOTO(cleanup, rc = PTR_ERR(handle));
- rc = fsfilt_del_dir_entry(req->rq_export->exp_obd, de);
+ struct lustre_id de_id;
+
+ /* name exists and points to remote inode */
+ mds_pack_dentry2id(obd, &de_id, de, 1);
+
+ CDEBUG(D_OTHER, "%s: %s points to remote inode "DLID4"\n",
+ obd->obd_name, rec->ur_tgt, OLID4(&de_id));
+
+ /* checking if we can remove local dentry. */
+ rc = mds_check_for_rename(obd, de);
if (rc)
GOTO(cleanup, rc);
+
+ /*
+ * to be fully POSIX compatible, we should add one more check:
+ *
+ * if de_new is subdir of dir rec->ur_id1. If so - return
+ * -EINVAL.
+ *
+ * I do not know how to implement it right now, because
+ * inodes/dentries for new and old names lie on different MDS,
+ * so add this notice here just to make it visible for the rest
+ * of developers and do not forget about. And when this check
+ * will be added, del_cross_ref should gone, that is local
+ * dentry is able to be removed if all checks passed.
+ *
+ * Currently -EEXISTS is returned by fsfilt_add_dir_entry() what
+ * is not fully correct. --umka
+ */
+
+ if (del_cross_ref) {
+ handle = fsfilt_start(obd, de_dir->d_inode,
+ FSFILT_OP_RENAME, NULL);
+ if (IS_ERR(handle))
+ GOTO(cleanup, rc = PTR_ERR(handle));
+ rc = fsfilt_del_dir_entry(req->rq_export->exp_obd, de);
+ if (rc)
+ GOTO(cleanup, rc);
+ }
+
} else {
/* name doesn't exist. the simplest case. */
handle = fsfilt_start(obd, de_dir->d_inode,
if (IS_ERR(handle))
GOTO(cleanup, rc = PTR_ERR(handle));
}
-
+
rc = fsfilt_add_dir_entry(obd, de_dir, rec->ur_tgt,
- rec->ur_tgtlen - 1, dentry->d_inum,
- dentry->d_generation, dentry->d_mdsnum);
+ rec->ur_tgtlen - 1, id_ino(id),
+ id_gen(id), id_group(id), id_fid(id));
if (rc) {
CERROR("add_dir_entry() returned error %d\n", rc);
GOTO(cleanup, rc);
}
-
+
cleanup:
EXIT;
rc = mds_finish_transno(mds, de_dir ? de_dir->d_inode : NULL,
handle, req, rc, 0);
-
+
RETURN(rc);
}
static int mds_del_local_dentry(struct mds_update_record *rec, int offset,
- struct ptlrpc_request *req,
- struct dentry *dentry, struct dentry *de_dir,
+ struct ptlrpc_request *req, struct dentry *de_dir,
struct dentry *de)
{
struct obd_device *obd = req->rq_export->exp_obd;
void *handle = NULL;
int rc = 0;
ENTRY;
-
+
handle = fsfilt_start(obd, de_dir->d_inode, FSFILT_OP_UNLINK, NULL);
if (IS_ERR(handle))
GOTO(cleanup, rc = PTR_ERR(handle));
rc = fsfilt_del_dir_entry(obd, de);
d_drop(de);
-
+
cleanup:
EXIT;
rc = mds_finish_transno(mds, de_dir ? de_dir->d_inode : NULL,
RETURN(0);
}
-
static int mds_reint_rename_create_name(struct mds_update_record *rec,
int offset, struct ptlrpc_request *req)
{
+ struct lustre_handle parent_lockh[2] = {{0}, {0}};
struct obd_device *obd = req->rq_export->exp_obd;
- struct dentry *de_srcdir = NULL;
- struct dentry *de_new = NULL;
struct mds_obd *mds = mds_req2mds(req);
- struct lustre_handle parent_lockh[2] = {{0}, {0}};
struct lustre_handle child_lockh = {0};
+ struct dentry *de_tgtdir = NULL;
+ struct dentry *de_new = NULL;
int cleanup_phase = 0;
- void *handle = NULL;
int update_mode, rc = 0;
ENTRY;
- /* another MDS executing rename operation has asked us
- * to create target name. such a creation should destroy
- * existing target name */
-
- CDEBUG(D_OTHER, "%s: request to create name %s for %lu/%lu/%lu\n",
- obd->obd_name, rec->ur_tgt,
- (unsigned long) rec->ur_fid1->mds,
- (unsigned long) rec->ur_fid1->id,
- (unsigned long) rec->ur_fid1->generation);
+ /*
+ * another MDS executing rename operation has asked us to create target
+ * name. such a creation should destroy existing target name.
+ */
+ CDEBUG(D_OTHER, "%s: request to create name %s for "DLID4"\n",
+ obd->obd_name, rec->ur_tgt, OLID4(rec->ur_id1));
/* first, lookup the target */
child_lockh.cookie = 0;
- rc = mds_get_parent_child_locked(obd, mds, rec->ur_fid2, parent_lockh,
- &de_srcdir,LCK_PW,MDS_INODELOCK_UPDATE,
+
+ rc = mds_get_parent_child_locked(obd, mds, rec->ur_id2, parent_lockh,
+ &de_tgtdir, LCK_PW, MDS_INODELOCK_UPDATE,
&update_mode, rec->ur_tgt, rec->ur_tgtlen,
&child_lockh, &de_new, LCK_EX,
MDS_INODELOCK_LOOKUP);
cleanup_phase = 1;
- LASSERT(de_srcdir);
- LASSERT(de_srcdir->d_inode);
+ LASSERT(de_tgtdir);
+ LASSERT(de_tgtdir->d_inode);
LASSERT(de_new);
- if (de_new->d_inode) {
- /* name exists and points to local inode
- * try to unlink this name and create new one */
- CERROR("%s: %s points to local inode %lu/%lu\n",
- obd->obd_name, rec->ur_tgt,
- (unsigned long) de_new->d_inode->i_ino,
- (unsigned long) de_new->d_inode->i_generation);
- handle = fsfilt_start(obd, de_srcdir->d_inode,
- FSFILT_OP_RENAME, NULL);
- if (IS_ERR(handle))
- GOTO(cleanup, rc = PTR_ERR(handle));
- rc = fsfilt_del_dir_entry(req->rq_export->exp_obd, de_new);
- if (rc)
- GOTO(cleanup, rc);
- } else if (de_new->d_flags & DCACHE_CROSS_REF) {
- /* name exists adn points to remove inode */
- CERROR("%s: %s points to remote inode %lu/%lu/%lu\n",
- obd->obd_name, rec->ur_tgt,
- (unsigned long) de_new->d_mdsnum,
- (unsigned long) de_new->d_inum,
- (unsigned long) de_new->d_generation);
- } else {
- /* name doesn't exist. the simplest case */
- handle = fsfilt_start(obd, de_srcdir->d_inode,
- FSFILT_OP_LINK, NULL);
- if (IS_ERR(handle))
- GOTO(cleanup, rc = PTR_ERR(handle));
- }
-
- cleanup_phase = 2;
- rc = fsfilt_add_dir_entry(obd, de_srcdir, rec->ur_tgt,
- rec->ur_tgtlen - 1, rec->ur_fid1->id,
- rec->ur_fid1->generation, rec->ur_fid1->mds);
- if (rc)
- CERROR("add_dir_entry() returned error %d\n", rc);
+ rc = mds_add_local_dentry(rec, offset, req, rec->ur_id1,
+ de_tgtdir, de_new, 0);
+
+ GOTO(cleanup, rc);
cleanup:
EXIT;
- rc = mds_finish_transno(mds, de_srcdir ? de_srcdir->d_inode : NULL,
- handle, req, rc, 0);
- switch(cleanup_phase) {
- case 2:
- case 1:
+
+ if (cleanup_phase == 1) {
#ifdef S_PDIROPS
- if (parent_lockh[1].cookie != 0)
- ldlm_lock_decref(&parent_lockh[1], update_mode);
+ if (parent_lockh[1].cookie != 0)
+ ldlm_lock_decref(&parent_lockh[1], update_mode);
#endif
- ldlm_lock_decref(&parent_lockh[0], LCK_PW);
- if (child_lockh.cookie != 0)
- ldlm_lock_decref(&child_lockh, LCK_EX);
- l_dput(de_new);
- l_dput(de_srcdir);
- break;
- default:
- LBUG();
+ ldlm_lock_decref(&parent_lockh[0], LCK_PW);
+ if (child_lockh.cookie != 0)
+ ldlm_lock_decref(&child_lockh, LCK_EX);
+ l_dput(de_new);
+ l_dput(de_tgtdir);
}
req->rq_status = rc;
-
RETURN(0);
}
int update_mode, rc = 0;
ENTRY;
- CDEBUG(D_OTHER, "%s: move name %s onto another mds%u\n",
- obd->obd_name, rec->ur_name, rec->ur_fid2->mds + 1);
+ CDEBUG(D_OTHER, "%s: move name %s onto another mds #%lu\n",
+ obd->obd_name, rec->ur_name, (unsigned long)id_group(rec->ur_id2));
memset(&opdata, 0, sizeof(opdata));
child_lockh.cookie = 0;
- rc = mds_get_parent_child_locked(obd, mds, rec->ur_fid1, parent_lockh,
- &de_srcdir,LCK_PW,MDS_INODELOCK_UPDATE,
+ rc = mds_get_parent_child_locked(obd, mds, rec->ur_id1, parent_lockh,
+ &de_srcdir, LCK_PW, MDS_INODELOCK_UPDATE,
&update_mode, rec->ur_name,
rec->ur_namelen, &child_lockh, &de_old,
LCK_EX, MDS_INODELOCK_LOOKUP);
LASSERT(de_srcdir->d_inode);
LASSERT(de_old);
- /* we already know the target should be created on another MDS
- * so, we have to request that MDS to do it */
+ /*
+ * we already know the target should be created on another MDS so, we
+ * have to request that MDS to do it.
+ */
- /* prepare source fid */
+ /* prepare source id */
if (de_old->d_flags & DCACHE_CROSS_REF) {
LASSERT(de_old->d_inode == NULL);
CDEBUG(D_OTHER, "request to move remote name\n");
- opdata.fid1.mds = de_old->d_mdsnum;
- opdata.fid1.id = de_old->d_inum;
- opdata.fid1.generation = de_old->d_generation;
+ mds_pack_dentry2id(obd, &opdata.id1, de_old, 1);
} else if (de_old->d_inode == NULL) {
/* oh, source doesn't exist */
GOTO(cleanup, rc = -ENOENT);
} else {
- LASSERT(de_old->d_inode != NULL);
+ struct lustre_id sid;
+ struct inode *inode = de_old->d_inode;
+
+ LASSERT(inode != NULL);
CDEBUG(D_OTHER, "request to move local name\n");
- opdata.fid1.mds = mds->mds_num;
- opdata.fid1.id = de_old->d_inode->i_ino;
- opdata.fid1.generation = de_old->d_inode->i_generation;
+ id_ino(&opdata.id1) = inode->i_ino;
+ id_group(&opdata.id1) = mds->mds_num;
+ id_gen(&opdata.id1) = inode->i_generation;
+
+ down(&inode->i_sem);
+ rc = mds_read_inode_sid(obd, inode, &sid);
+ up(&inode->i_sem);
+ if (rc) {
+ CERROR("Can't read inode self id, "
+ "inode %lu, rc = %d\n",
+ inode->i_ino, rc);
+ GOTO(cleanup, rc);
+ }
+
+ id_fid(&opdata.id1) = id_fid(&sid);
}
- opdata.fid2 = *(rec->ur_fid2);
- rc = md_rename(mds->mds_lmv_exp, &opdata, NULL, 0, rec->ur_tgt,
- rec->ur_tgtlen - 1, &req2);
+ opdata.id2 = *rec->ur_id2;
+ rc = md_rename(mds->mds_lmv_exp, &opdata, NULL, 0,
+ rec->ur_tgt, rec->ur_tgtlen - 1, &req2);
if (rc)
GOTO(cleanup, rc);
- rc = mds_del_local_dentry(rec, offset, req, NULL, de_srcdir, de_old);
+ rc = mds_del_local_dentry(rec, offset, req, de_srcdir,
+ de_old);
cleanup:
- EXIT;
-
if (req2)
ptlrpc_req_finished(req2);
req->rq_status = rc;
RETURN(0);
-
}
static int mds_reint_rename(struct mds_update_record *rec, int offset,
struct llog_create_locks *lcl = NULL;
struct lov_mds_md *lmm = NULL;
int rc = 0, cleanup_phase = 0;
-
void *handle = NULL;
ENTRY;
LASSERT(offset == 1);
- DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u %s to "LPU64"/%u %s",
- rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name,
- rec->ur_fid2->id, rec->ur_fid2->generation, rec->ur_tgt);
+ DEBUG_REQ(D_INODE, req, "parent "DLID4" %s to "DLID4" %s",
+ OLID4(rec->ur_id1), rec->ur_name, OLID4(rec->ur_id2),
+ rec->ur_tgt);
MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
RETURN(rc);
}
- if (rec->ur_fid2->mds != mds->mds_num) {
+ /* check if new name should be located on remote target. */
+ if (id_group(rec->ur_id2) != mds->mds_num) {
rc = mds_reint_rename_to_remote(rec, offset, req);
RETURN(rc);
}
- rc = mds_get_parents_children_locked(obd, mds, rec->ur_fid1, &de_srcdir,
- rec->ur_fid2, &de_tgtdir, LCK_PW,
+ rc = mds_get_parents_children_locked(obd, mds, rec->ur_id1, &de_srcdir,
+ rec->ur_id2, &de_tgtdir, LCK_PW,
rec->ur_name, rec->ur_namelen,
&de_old, rec->ur_tgt,
rec->ur_tgtlen, &de_new,
GOTO(cleanup, rc);
cleanup_phase = 1; /* parent(s), children, locks */
-
old_inode = de_old->d_inode;
new_inode = de_new->d_inode;
/* sanity check for src inode */
if (de_old->d_flags & DCACHE_CROSS_REF) {
LASSERT(de_old->d_inode == NULL);
-
+
/*
* in the case of cross-ref dir, we can perform this check only
* if child and parent lie on the same mds. This is because
- * otherwise they can have the same inodes.
+ * otherwise they can have the same inode numbers.
*/
if (de_old->d_mdsnum == mds->mds_num) {
if (de_old->d_inum == de_srcdir->d_inode->i_ino ||
de_old->d_inode->i_ino == de_tgtdir->d_inode->i_ino)
GOTO(cleanup, rc = -EINVAL);
}
-
+
/* sanity check for dest inode */
if (de_new->d_flags & DCACHE_CROSS_REF) {
LASSERT(new_inode == NULL);
-
+
/* the same check about target dentry. */
if (de_new->d_mdsnum == mds->mds_num) {
if (de_new->d_inum == de_srcdir->d_inode->i_ino ||
de_new->d_inum == de_tgtdir->d_inode->i_ino)
GOTO(cleanup, rc = -EINVAL);
}
-
+
/*
* regular files usualy do not have ->rename() implemented. But
* we handle only this case when @de_new is cross-ref entry,
(new_inode->i_ino == de_srcdir->d_inode->i_ino ||
new_inode->i_ino == de_tgtdir->d_inode->i_ino))
GOTO(cleanup, rc = -EINVAL);
+
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+ /*
+ * check if we are moving old entry into its child. 2.6 does not check
+ * for this in vfs_rename() anymore.
+ */
+ if (is_subdir(de_new, de_old))
+ GOTO(cleanup, rc = -EINVAL);
+#endif
+
/* check if inodes point to each other. */
if (!(de_old->d_flags & DCACHE_CROSS_REF) &&
!(de_new->d_flags & DCACHE_CROSS_REF) &&
old_inode == new_inode)
GOTO(cleanup, rc = 0);
- /* if we are about to remove the target at first, pass the EA of
- * that inode to client to perform and cleanup on OST */
+ /*
+ * if we are about to remove the target at first, pass the EA of that
+ * inode to client to perform and cleanup on OST.
+ */
body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
LASSERT(body != NULL);
/* child i_alloc_sem protects orphan_dec_test && is_orphan race */
if (new_inode)
DOWN_READ_I_ALLOC_SEM(new_inode);
+
cleanup_phase = 2; /* up(&new_inode->i_sem) when finished */
if (new_inode && ((S_ISDIR(new_inode->i_mode) &&
down(&mds->mds_pending_dir->d_inode->i_sem);
cleanup_phase = 3; /* up(&pending_dir->i_sem) */
} else if (S_ISREG(new_inode->i_mode)) {
- mds_pack_inode2fid(obd, &body->fid1, new_inode);
- mds_pack_inode2body(obd, body, new_inode);
- mds_pack_md(obd, req->rq_repmsg, 1, body, new_inode,
- MDS_PACK_MD_LOCK);
+ mds_pack_inode2body(obd, body, new_inode, 0);
+ mds_pack_md(obd, req->rq_repmsg, 1, body,
+ new_inode, MDS_PACK_MD_LOCK);
}
}
OBD_FAIL_WRITE(OBD_FAIL_MDS_REINT_RENAME_WRITE,
de_srcdir->d_inode->i_sb);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- /* Check if we are moving old entry into its child. 2.6 does not
- check for this in vfs_rename() anymore */
- if (is_subdir(de_new, de_old))
- GOTO(cleanup, rc = -EINVAL);
-#endif
if (de_old->d_flags & DCACHE_CROSS_REF) {
- rc = mds_add_local_dentry(rec, offset, req, de_old, de_tgtdir,
- de_new);
+ struct lustre_id old_id;
+
+ mds_pack_dentry2id(obd, &old_id, de_old, 1);
+
+ rc = mds_add_local_dentry(rec, offset, req, &old_id,
+ de_tgtdir, de_new, 1);
if (rc)
GOTO(cleanup, rc);
-
- rc = mds_del_local_dentry(rec, offset, req, de_old, de_srcdir,
+
+ rc = mds_del_local_dentry(rec, offset, req, de_srcdir,
de_old);
GOTO(cleanup, rc);
}
GOTO(cleanup, rc);
cleanup:
- rc = mds_finish_transno(mds, de_tgtdir ? de_tgtdir->d_inode : NULL,
+ EXIT;
+ rc = mds_finish_transno(mds, (de_tgtdir ? de_tgtdir->d_inode : NULL),
handle, req, rc, 0);
+
switch (cleanup_phase) {
case 3:
up(&mds->mds_pending_dir->d_inode->i_sem);
if (lmm_size == 0)
RETURN(0);
- rc = obd_unpackmd(mds->mds_osc_exp, &lsm, lmm, lmm_size);
+ rc = obd_unpackmd(mds->mds_lov_exp, &lsm, lmm, lmm_size);
if (rc < 0) {
CERROR("Error unpack md %p\n", lmm);
RETURN(rc);
oti.oti_logcookies = logcookies;
}
- rc = obd_destroy(mds->mds_osc_exp, oa, lsm, &oti);
+ rc = obd_destroy(mds->mds_lov_exp, oa, lsm, &oti);
obdo_free(oa);
if (rc)
CDEBUG(D_INODE, "destroy orphan objid 0x"LPX64" on ost error "
"%d\n", lsm->lsm_object_id, rc);
out_free_memmd:
- obd_free_memmd(mds->mds_osc_exp, &lsm);
+ obd_free_memmd(mds->mds_lov_exp, &lsm);
RETURN(rc);
}
int rc, err;
ENTRY;
- LASSERT(mds->mds_osc_obd != NULL);
+ LASSERT(mds->mds_lov_obd != NULL);
OBD_ALLOC(lmm, mds->mds_max_mdsize);
if (lmm == NULL)
struct inode *child_inode, *pending_dir = mds->mds_pending_dir->d_inode;
struct l_linux_dirent *dirent, *n;
struct list_head dentry_list;
- char d_name[LL_FID_NAMELEN];
+ char d_name[LL_ID_NAMELEN];
__u64 i = 0;
int rc = 0, item = 0, namlen;
ENTRY;
atomic_set(&export->exp_refcount, 2);
atomic_set(&export->exp_rpc_count, 0);
export->exp_obd = obd;
+ export->exp_flags = 0;
INIT_LIST_HEAD(&export->exp_outstanding_replies);
/* XXX this should be in LDLM init */
INIT_LIST_HEAD(&export->exp_ldlm_data.led_held_locks);
LASSERT(atomic_read(&import->imp_refcount) > 0);
LASSERT(atomic_read(&import->imp_refcount) < 0x5a5a5a);
+
if (!atomic_dec_and_test(&import->imp_refcount)) {
EXIT;
return;
}
CDEBUG(D_IOCTL, "destroying import %p\n", import);
-
- ptlrpc_put_connection_superhack(import->imp_connection);
+
+ if (import->imp_connection)
+ ptlrpc_put_connection_superhack(import->imp_connection);
while (!list_empty(&import->imp_conn_list)) {
struct obd_import_conn *imp_conn;
imp_conn = list_entry(import->imp_conn_list.next,
struct obd_import_conn, oic_item);
list_del(&imp_conn->oic_item);
- ptlrpc_put_connection_superhack(imp_conn->oic_conn);
+ if (imp_conn->oic_conn)
+ ptlrpc_put_connection_superhack(imp_conn->oic_conn);
OBD_FREE(imp_conn, sizeof(*imp_conn));
}
CDEBUG(D_IOCTL, "disconnect: cookie "LPX64"\n",
export->exp_handle.h_cookie);
- if (export->exp_handle.h_cookie == 0x5a5a5a5a5a5a5a5a) {
+ if (export->exp_handle.h_cookie == LL_POISON) {
CERROR("disconnecting freed export %p, ignoring\n", export);
} else {
class_unlink_export(export);
static void class_disconnect_export_list(struct list_head *list, int flags)
{
- int rc;
- struct lustre_handle fake_conn;
struct obd_export *fake_exp, *exp;
+ struct lustre_handle fake_conn;
+ int rc;
ENTRY;
/* Move all of the exports from obd_exports to a work list, en masse. */
CDEBUG(D_HA,
"exp %p export uuid == obd uuid, don't discon\n",
exp);
- /* Need to delete this now so we don't end up pointing
- * to work_list later when this export is cleaned up. */
+ /*
+ * need to delete this now so we don't end up pointing
+ * to work_list later when this export is cleaned up.
+ */
list_del_init(&exp->exp_obd_chain);
class_export_put(exp);
continue;
class_export_put(exp);
continue;
}
+
rc = obd_disconnect(fake_exp, flags);
class_export_put(exp);
if (rc) {
#include <linux/lustre_fsfilt.h>
#if defined(LPROCFS) && defined(__KERNEL__)
-
struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head,
const char *name)
{
}
/* lprocfs API calls */
-
int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list,
void *data)
{
LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpin);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
+ LPROCFS_OBD_OP_INIT(num_private_stats, stats, getready);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_ea_size);
for (i = num_private_stats; i < num_stats; i++) {
- /* If this LBUGs, it is likely that an obd
- * operation was added to struct obd_ops in
- * <linux/obd.h>, and that the corresponding line item
- * LPROCFS_OBD_OP_INIT(.., .., opname)
+ /* if this LBUGs, it is likely that an obd operation was added
+ * to struct obd_ops in <linux/obd.h>, and that the
+ * corresponding line item LPROCFS_OBD_OP_INIT(.., .., opname)
* is missing from the list above. */
if (stats->ls_percpu[0]->lp_cntr[i].lc_name == NULL) {
CERROR("Missing obd_stat initializer obd_op "
RETURN(NULL);
}
-int class_add_profile(int proflen, char *prof, int osclen, char *osc,
- int mdclen, char *mdc)
+int class_add_profile(int proflen, char *prof,
+ int lovlen, char *lov,
+ int lmvlen, char *lmv)
{
struct lustre_profile *lprof;
int err = 0;
GOTO(out, err = -ENOMEM);
memcpy(lprof->lp_profile, prof, proflen);
- LASSERT(osclen == (strlen(osc) + 1));
- OBD_ALLOC(lprof->lp_osc, osclen);
+ LASSERT(lovlen == (strlen(lov) + 1));
+ OBD_ALLOC(lprof->lp_lov, lovlen);
if (lprof->lp_profile == NULL)
GOTO(out, err = -ENOMEM);
- memcpy(lprof->lp_osc, osc, osclen);
+ memcpy(lprof->lp_lov, lov, lovlen);
- if (mdclen > 0) {
- LASSERT(mdclen == (strlen(mdc) + 1));
- OBD_ALLOC(lprof->lp_mdc, mdclen);
- if (lprof->lp_mdc == NULL)
+ if (lmvlen > 0) {
+ LASSERT(lmvlen == (strlen(lmv) + 1));
+ OBD_ALLOC(lprof->lp_lmv, lmvlen);
+ if (lprof->lp_lmv == NULL)
GOTO(out, err = -ENOMEM);
- memcpy(lprof->lp_mdc, mdc, mdclen);
+ memcpy(lprof->lp_lmv, lmv, lmvlen);
}
list_add(&lprof->lp_list, &lustre_profile_list);
if (lprof) {
list_del(&lprof->lp_list);
OBD_FREE(lprof->lp_profile, strlen(lprof->lp_profile) + 1);
- OBD_FREE(lprof->lp_osc, strlen(lprof->lp_osc) + 1);
- if (lprof->lp_mdc)
- OBD_FREE(lprof->lp_mdc, strlen(lprof->lp_mdc) + 1);
+ OBD_FREE(lprof->lp_lov, strlen(lprof->lp_lov) + 1);
+ if (lprof->lp_lmv)
+ OBD_FREE(lprof->lp_lmv, strlen(lprof->lp_lmv) + 1);
OBD_FREE(lprof, sizeof *lprof);
}
}
* dir_dentry is NULL, we do a read lock while we do the lookup to
* avoid races with create/destroy and such changing the directory
* internal to the filesystem code. */
-struct dentry *filter_fid2dentry(struct obd_device *obd,
- struct dentry *dir_dentry,
- obd_gr group, obd_id id)
+struct dentry *filter_id2dentry(struct obd_device *obd,
+ struct dentry *dir_dentry,
+ obd_gr group, obd_id id)
{
struct dentry *dparent = dir_dentry;
struct dentry *dchild;
GOTO(cleanup, rc);
}
rc = filter_group_set_fs_flags(obd, group);
- if (rc != 0) {
+ if (rc != 0) {
CERROR("can't set kml flags %u\n", group);
GOTO(cleanup, rc);
}
if (oa->o_valid & OBD_MD_FLGROUP)
group = oa->o_gr;
- dchild = filter_fid2dentry(obd, NULL, group, oa->o_id);
+ dchild = filter_id2dentry(obd, NULL, group, oa->o_id);
if (IS_ERR(dchild)) {
CERROR("%s error looking up object: "LPU64"\n", what, oa->o_id);
obd_gr group, int *num)
{
struct dentry *dchild = NULL, *dparent = NULL;
- struct filter_obd *filter;
int err = 0, rc = 0, recreate_obj = 0, i;
- __u64 next_id;
+ struct filter_obd *filter;
void *handle = NULL;
void *lock = NULL;
+ __u64 next_id;
ENTRY;
filter = &obd->u.filter;
/*only do precreate rec record. so clean kml flags here*/
fsfilt_clear_fs_flags(obd, dparent->d_inode, SM_DO_REC);
- dchild = filter_fid2dentry(obd, dparent, group, next_id);
+ dchild = filter_id2dentry(obd, dparent, group, next_id);
if (IS_ERR(dchild))
GOTO(cleanup, rc = PTR_ERR(dchild));
cleanup_phase = 2;
static int filter_destroy(struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md *ea, struct obd_trans_info *oti)
{
- struct obd_device *obd;
- struct filter_obd *filter;
+ int rc, rc2, cleanup_phase = 0, have_prepared = 0;
struct dentry *dchild = NULL, *dparent = NULL;
+ struct llog_cookie *fcc = NULL;
struct lvfs_run_ctxt saved;
+ struct filter_obd *filter;
+ struct obd_device *obd;
void *handle = NULL;
- struct llog_cookie *fcc = NULL;
- int rc, rc2, cleanup_phase = 0, have_prepared = 0;
void *lock = NULL;
struct iattr iattr;
ENTRY;
GOTO(cleanup, rc = PTR_ERR(dparent));
cleanup_phase = 1;
- dchild = filter_fid2dentry(obd, dparent, oa->o_gr, oa->o_id);
+ dchild = filter_id2dentry(obd, dparent, oa->o_gr, oa->o_id);
if (IS_ERR(dchild))
GOTO(cleanup, rc = -ENOENT);
cleanup_phase = 2;
RETURN(rc);
}
-static struct dentry *filter_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr,
- void *data)
+static struct dentry *filter_lvfs_id2dentry(__u64 id, __u32 gen,
+ __u64 gr, void *data)
{
- return filter_fid2dentry(data, NULL, gr, id);
+ return filter_id2dentry(data, NULL, gr, id);
}
static struct lvfs_callback_ops filter_lvfs_ops = {
- l_fid2dentry: filter_lvfs_fid2dentry,
+ l_id2dentry: filter_lvfs_id2dentry,
};
static struct obd_ops filter_obd_ops = {
/* filter.c */
void f_dput(struct dentry *);
-struct dentry *filter_fid2dentry(struct obd_device *, struct dentry *dir,
- obd_gr group, obd_id id);
+struct dentry *filter_id2dentry(struct obd_device *, struct dentry *dir,
+ obd_gr group, obd_id id);
struct dentry *__filter_oa2dentry(struct obd_device *obd, struct obdo *oa,
const char *what);
#define filter_oa2dentry(obd, oa) __filter_oa2dentry(obd, oa, __FUNCTION__)
struct ost_filterdata {
__u32 ofd_epoch;
};
+
int filter_log_sz_change(struct llog_handle *cathandle,
- struct ll_fid *mds_fid,
- __u32 io_epoch,
+ struct lustre_id *id, __u32 io_epoch,
struct llog_cookie *logcookie,
struct inode *inode);
//int filter_get_catalog(struct obd_device *);
cleanup_phase = 1;
push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
- dentry = filter_fid2dentry(exp->exp_obd, NULL, obj->ioo_gr,
- obj->ioo_id);
+ dentry = filter_id2dentry(exp->exp_obd, NULL, obj->ioo_gr,
+ obj->ioo_id);
if (IS_ERR(dentry))
GOTO(cleanup, rc = PTR_ERR(dentry));
push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
- dentry = filter_fid2dentry(exp->exp_obd, NULL, obj->ioo_gr,
- obj->ioo_id);
+ dentry = filter_id2dentry(exp->exp_obd, NULL, obj->ioo_gr,
+ obj->ioo_id);
if (IS_ERR(dentry)) {
pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
RETURN (PTR_ERR(dentry));
LASSERT(nobj == 1);
push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
-
- dentry = filter_fid2dentry(exp->exp_obd, NULL, obj->ioo_gr,
- obj->ioo_id);
+ dentry = filter_id2dentry(exp->exp_obd, NULL, obj->ioo_gr,
+ obj->ioo_id);
if (IS_ERR(dentry)) {
pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
RETURN (PTR_ERR(dentry));
#include "filter_internal.h"
int filter_log_sz_change(struct llog_handle *cathandle,
- struct ll_fid *mds_fid,
- __u32 io_epoch,
+ struct lustre_id *id, __u32 io_epoch,
struct llog_cookie *logcookie,
struct inode *inode)
{
RETURN(-ENOMEM);
lsc->lsc_hdr.lrh_len = lsc->lsc_tail.lrt_len = sizeof(*lsc);
lsc->lsc_hdr.lrh_type = OST_SZ_REC;
- lsc->lsc_fid = *mds_fid;
+ lsc->lsc_id = *id;
lsc->lsc_io_epoch = io_epoch;
rc = llog_cat_add_rec(cathandle, &lsc->lsc_hdr, logcookie,
# include <liblustre.h>
#endif
-# include <linux/lustre_dlm.h>
+#include <linux/lustre_dlm.h>
#include <linux/kp30.h>
#include <linux/lustre_net.h>
#include <lustre/lustre_user.h>
RETURN(ELDLM_OK);
}
}
+ if (mode == LCK_PW) {
+ rc = ldlm_lock_match(obd->obd_namespace, 0, &res_id, type,
+ policy, LCK_PR, lockh);
+ if (rc == 1) {
+ rc = ldlm_cli_convert(lockh, mode, flags);
+ if (!rc) {
+ /* Update readers/writers accounting */
+ ldlm_lock_addref(lockh, LCK_PW);
+ ldlm_lock_decref(lockh, LCK_PR);
+ osc_set_data_with_check(lockh, data);
+ RETURN(ELDLM_OK);
+ }
+ /* If the conversion failed, we need to drop refcount
+ on matched lock before we get new one */
+ /* XXX Won't it save us some efforts if we cancel PR
+ lock here? We are going to take PW lock anyway and it
+ will invalidate PR lock */
+ ldlm_lock_decref(lockh, LCK_PR);
+ if (rc != EDEADLOCK) {
+ RETURN(rc);
+ }
+ }
+ }
no_match:
if (*flags & LDLM_FL_HAS_INTENT) {
ptlrpc_req_finished(req);
RETURN(rc);
}
- RETURN(-EINVAL);
+ RETURN(-EPROTO);
}
static int osc_set_info(struct obd_export *exp, obd_count keylen,
unsigned long connect_flags)
{
int rc;
-
+ ENTRY;
rc = client_connect_import(exph, obd, cluuid, connect_flags);
-
- return rc;
+ RETURN(rc);
}
static int osc_disconnect(struct obd_export *exp, int flags)
struct obd_device *obd = class_exp2obd(exp);
struct llog_ctxt *ctxt;
int rc;
+ ENTRY;
ctxt = llog_get_context(&obd->obd_llogs, LLOG_SIZE_REPL_CTXT);
if (obd->u.cli.cl_conn_count == 1)
llog_sync(ctxt, exp);
rc = client_disconnect_export(exp, flags);
- return rc;
+ RETURN(rc);
}
static int osc_import_event(struct obd_device *obd,
GOTO(out, rc);
rcs = lustre_msg_buf(req->rq_repmsg, 1, niocount * sizeof(*rcs));
+#if 0
/* Do snap options here*/
rc = obd_do_cow(req->rq_export, ioo, objcount, remote_nb);
if (rc)
- GOTO(out, rc);
+ GOTO(out, rc);
+#endif
/* FIXME all niobuf splitting should be done in obdfilter if needed */
/* CAVEAT EMPTOR this sets ioo->ioo_bufcnt to # pages */
# error "No word size defined"
#endif
+/* lustre_id output helper macros */
+#define DLID4 "%lu/%lu/%lu/%lu"
+
+#define OLID4(id) \
+ (unsigned long)(id)->li_fid.lf_id, \
+ (unsigned long)(id)->li_fid.lf_group, \
+ (unsigned long)(id)->li_stc.u.e3s.l3s_ino, \
+ (unsigned long)(id)->li_stc.u.e3s.l3s_gen
+
#endif
+
#define PORTALS_DEV_PATH "/dev/portals"
#define OBD_DEV_ID 1
#define OBD_DEV_PATH "/dev/obd"
+#define SMFS_DEV_ID 2
+#define SMFS_DEV_PATH "/dev/snapdev"
int ptl_name2nal(char *str);
int ptl_parse_ipaddr (__u32 *ipaddrp, char *str);
{"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
"rpc", "mgmt", "portals", "libcfs", "socknal", "qswnal", "pinger",
"filter", "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd",
- "ibnal", NULL};
+ "ibnal", "lmv", "cmobd", "smfs", NULL};
static const char *portal_debug_masks[] =
{"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
"blocks", "net", "warning", "buffs", "other", "dentry", "portals",
{"obdfilter", "lustre/obdfilter"},
{"extN", "lustre/extN"},
{"lov", "lustre/lov"},
+ {"lmv", "lustre/lmv"},
{"fsfilt_ext3", "lustre/lvfs"},
{"fsfilt_extN", "lustre/lvfs"},
{"fsfilt_reiserfs", "lustre/lvfs"},
{"ptlbd", "lustre/ptlbd"},
{"mgmt_svc", "lustre/mgmt"},
{"mgmt_cli", "lustre/mgmt"},
+ {"cobd", "lustre/cobd"},
+ {"cmobd", "lustre/cmobd"},
{"conf_obd", "lustre/obdclass"},
{NULL, NULL}
};
request->rq_timeout = obd_timeout / 2;
else
request->rq_timeout = obd_timeout;
+
request->rq_send_state = LUSTRE_IMP_FULL;
request->rq_type = PTL_RPC_MSG_REQUEST;
request->rq_import = class_import_get(imp);
request->rq_reqmsg->opc = opcode;
request->rq_reqmsg->flags = 0;
-
RETURN(request);
}
LASSERT(!req->rq_receiving_reply);
atomic_inc(&imp->imp_inflight);
+ if (imp->imp_connection == NULL) {
+ CERROR("request on not connected import %s\n",
+ imp->imp_obd->obd_name);
+ RETURN(-EINVAL);
+ }
+
/* for distributed debugging */
req->rq_reqmsg->status = current->pid;
LASSERT(imp->imp_obd != NULL);
}
static int ptlrpc_connect_interpret(struct ptlrpc_request *request,
- void * data, int rc)
+ void *data, int rc)
{
struct ptlrpc_connect_async_args *aa = data;
struct obd_import *imp = request->rq_import;
IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON);
if (aa->pcaa_initial_connect && !imp->imp_initial_recov)
ptlrpc_deactivate_import(imp);
-
CDEBUG(D_HA, "recovery of %s on %s failed (%d)\n",
imp->imp_target_uuid.uuid,
(char *)imp->imp_connection->c_remote_uuid.uuid, rc);
}
static int completed_replay_interpret(struct ptlrpc_request *req,
- void * data, int rc)
+ void *data, int rc)
{
atomic_dec(&req->rq_import->imp_replay_inflight);
if (req->rq_status == 0) {
switch (imp->imp_connect_op) {
case OST_CONNECT: rq_opc = OST_DISCONNECT; break;
case MDS_CONNECT: rq_opc = MDS_DISCONNECT; break;
- case MGMT_CONNECT:rq_opc = MGMT_DISCONNECT;break;
+ case MGMT_CONNECT: rq_opc = MGMT_DISCONNECT; break;
default:
CERROR("don't know how to disconnect from %s (connect_op %d)\n",
imp->imp_target_uuid.uuid, imp->imp_connect_op);
__swab32s (&o->o_valid);
__swab32s (&o->o_misc);
__swab32s (&o->o_easize);
+ __swab32s (&o->o_mds);
+ __swab64s (&o->o_fid);
/* o_inline is opaque */
}
/* mdc pack methods used by mdc and smfs*/
void *mdc_create_pack(struct lustre_msg *msg, int offset,
- struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
- const void *data, int datalen)
+ struct mdc_op_data *op_data, __u32 mode,
+ __u64 rdev, const void *data, int datalen)
{
struct mds_rec_create *rec;
char *tmp;
rec = lustre_msg_buf(msg, offset, sizeof (*rec));
rec->cr_opcode = REINT_CREATE;
- rec->cr_fid = op_data->fid1;
- memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
+ rec->cr_id = op_data->id1;
+ memset(&rec->cr_replayid, 0, sizeof(rec->cr_replayid));
rec->cr_mode = mode;
rec->cr_rdev = rdev;
rec->cr_time = op_data->mod_time;
char *tmp = NULL;
rec->sa_opcode = REINT_SETATTR;
- rec->sa_fid = data->fid1;
+ rec->sa_id = data->id1;
if (iattr) {
rec->sa_valid = iattr->ia_valid;
return (void*)tmp;
memcpy(lustre_msg_buf(msg, offset + 1, ealen), ea, ealen);
-
tmp += size_round(ealen);
if (ea2len == 0)
return (void*)tmp;
- tmp += size_round(ea2len);
memcpy(lustre_msg_buf(msg, offset + 2, ea2len), ea2, ea2len);
-
+ tmp += size_round(ea2len);
return (void*)tmp;
}
void *mdc_unlink_pack(struct lustre_msg *msg, int offset,
- struct mdc_op_data *data)
+ struct mdc_op_data *data)
{
struct mds_rec_unlink *rec;
char *tmp;
rec->ul_opcode = REINT_UNLINK;
rec->ul_mode = data->create_mode;
- rec->ul_fid1 = data->fid1;
- rec->ul_fid2 = data->fid2;
+ rec->ul_id1 = data->id1;
+ rec->ul_id2 = data->id2;
rec->ul_time = data->mod_time;
tmp = lustre_msg_buf(msg, offset + 1, data->namelen + 1);
}
void *mdc_link_pack(struct lustre_msg *msg, int offset,
- struct mdc_op_data *data)
+ struct mdc_op_data *data)
{
struct mds_rec_link *rec;
char *tmp;
rec = lustre_msg_buf(msg, offset, sizeof (*rec));
rec->lk_opcode = REINT_LINK;
- rec->lk_fid1 = data->fid1;
- rec->lk_fid2 = data->fid2;
+ rec->lk_id1 = data->id1;
+ rec->lk_id2 = data->id2;
rec->lk_time = data->mod_time;
tmp = lustre_msg_buf(msg, offset + 1, data->namelen + 1);
void *mdc_rename_pack(struct lustre_msg *msg, int offset,
struct mdc_op_data *data,
- const char *old, int oldlen, const char *new, int newlen)
+ const char *old, int oldlen,
+ const char *new, int newlen)
{
struct mds_rec_rename *rec;
char *tmp;
/* XXX do something about time, uid, gid */
rec->rn_opcode = REINT_RENAME;
- rec->rn_fid1 = data->fid1;
- rec->rn_fid2 = data->fid2;
+ rec->rn_id1 = data->id1;
+ rec->rn_id2 = data->id2;
rec->rn_time = data->mod_time;
tmp = lustre_msg_buf(msg, offset + 1, oldlen + 1);
__swab64s(id);
}
+void lustre_swab_generic_32s(__u32 *val)
+{
+ __swab32s(val);
+}
+
void lustre_swab_ost_lvb(struct ost_lvb *lvb)
{
__swab64s(&lvb->lvb_size);
__swab64s(&lvb->lvb_blocks);
}
-void lustre_swab_ll_fid (struct ll_fid *fid)
+void lustre_swab_lustre_stc (struct lustre_stc *stc)
+{
+ __swab64s (&stc->u.e3s.l3s_ino);
+ __swab32s (&stc->u.e3s.l3s_gen);
+ __swab32s (&stc->u.e3s.l3s_type);
+}
+
+void lustre_swab_lustre_fid(struct lustre_fid *fid)
+{
+ __swab64s (&fid->lf_id);
+ __swab64s (&fid->lf_group);
+ __swab32s (&fid->lf_version);
+}
+
+void lustre_swab_lustre_id (struct lustre_id *id)
{
- __swab64s (&fid->id);
- __swab32s (&fid->generation);
- __swab32s (&fid->f_type);
+ lustre_swab_lustre_stc(&id->li_stc);
+ lustre_swab_lustre_fid(&id->li_fid);
}
void lustre_swab_mds_status_req (struct mds_status_req *r)
void lustre_swab_mds_body (struct mds_body *b)
{
- lustre_swab_ll_fid (&b->fid1);
- lustre_swab_ll_fid (&b->fid2);
+ lustre_swab_lustre_id (&b->id1);
+ lustre_swab_lustre_id (&b->id2);
/* handle is opaque */
__swab64s (&b->size);
__swab64s (&b->blocks);
- __swab32s (&b->ino);
__swab32s (&b->valid);
__swab32s (&b->mode);
__swab32s (&b->uid);
__swab32s (&b->flags);
__swab32s (&b->rdev);
__swab32s (&b->nlink);
- __swab32s (&b->generation);
__swab32s (&b->eadatasize);
- __swab32s (&b->mds);
}
void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa)
{
__swab32s (&sa->sa_opcode);
__swab32s (&sa->sa_valid);
- lustre_swab_ll_fid (&sa->sa_fid);
+ lustre_swab_lustre_id (&sa->sa_id);
__swab32s (&sa->sa_mode);
__swab32s (&sa->sa_uid);
__swab32s (&sa->sa_gid);
__swab32s (&cr->cr_opcode);
__swab32s (&cr->cr_flags); /* for use with open */
__swab32s (&cr->cr_mode);
- lustre_swab_ll_fid (&cr->cr_fid);
- lustre_swab_ll_fid (&cr->cr_replayfid);
+ lustre_swab_lustre_id (&cr->cr_id);
+ lustre_swab_lustre_id (&cr->cr_replayid);
__swab64s (&cr->cr_time);
__swab64s (&cr->cr_rdev);
}
void lustre_swab_mds_rec_link (struct mds_rec_link *lk)
{
__swab32s (&lk->lk_opcode);
- lustre_swab_ll_fid (&lk->lk_fid1);
- lustre_swab_ll_fid (&lk->lk_fid2);
+ lustre_swab_lustre_id (&lk->lk_id1);
+ lustre_swab_lustre_id (&lk->lk_id2);
}
void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul)
{
__swab32s (&ul->ul_opcode);
__swab32s (&ul->ul_mode);
- lustre_swab_ll_fid (&ul->ul_fid1);
- lustre_swab_ll_fid (&ul->ul_fid2);
+ lustre_swab_lustre_id (&ul->ul_id1);
+ lustre_swab_lustre_id (&ul->ul_id2);
}
void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn)
{
__swab32s (&rn->rn_opcode);
- lustre_swab_ll_fid (&rn->rn_fid1);
- lustre_swab_ll_fid (&rn->rn_fid2);
+ lustre_swab_lustre_id (&rn->rn_id1);
+ lustre_swab_lustre_id (&rn->rn_id2);
}
void lustre_swab_lov_desc (struct lov_desc *ld)
void lustre_assert_wire_constants(void)
{
- /* Wire protocol assertions generated by 'wirecheck'
- * running on Linux build 2.4.24-cmd2 #1 SMP Tue Sep 14 10:34:54 MDT 2004 i686 i686 i386 GNU/
- * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
-
-
- /* Constants... */
- LASSERTF(PTLRPC_MSG_MAGIC == 0x0BD00BD0," found %lld\n",
- (long long)PTLRPC_MSG_MAGIC);
- LASSERTF(PTLRPC_MSG_VERSION == 0x00000003," found %lld\n",
- (long long)PTLRPC_MSG_VERSION);
- LASSERTF(PTL_RPC_MSG_REQUEST == 4711, " found %lld\n",
- (long long)PTL_RPC_MSG_REQUEST);
- LASSERTF(PTL_RPC_MSG_ERR == 4712, " found %lld\n",
- (long long)PTL_RPC_MSG_ERR);
- LASSERTF(PTL_RPC_MSG_REPLY == 4713, " found %lld\n",
- (long long)PTL_RPC_MSG_REPLY);
- LASSERTF(MSG_LAST_REPLAY == 1, " found %lld\n",
- (long long)MSG_LAST_REPLAY);
- LASSERTF(MSG_RESENT == 2, " found %lld\n",
- (long long)MSG_RESENT);
- LASSERTF(MSG_REPLAY == 4, " found %lld\n",
- (long long)MSG_REPLAY);
- LASSERTF(MSG_CONNECT_RECOVERING == 1, " found %lld\n",
- (long long)MSG_CONNECT_RECOVERING);
- LASSERTF(MSG_CONNECT_RECONNECT == 2, " found %lld\n",
- (long long)MSG_CONNECT_RECONNECT);
- LASSERTF(MSG_CONNECT_REPLAYABLE == 4, " found %lld\n",
- (long long)MSG_CONNECT_REPLAYABLE);
- LASSERTF(OST_REPLY == 0, " found %lld\n",
- (long long)OST_REPLY);
- LASSERTF(OST_GETATTR == 1, " found %lld\n",
- (long long)OST_GETATTR);
- LASSERTF(OST_SETATTR == 2, " found %lld\n",
- (long long)OST_SETATTR);
- LASSERTF(OST_READ == 3, " found %lld\n",
- (long long)OST_READ);
- LASSERTF(OST_WRITE == 4, " found %lld\n",
- (long long)OST_WRITE);
- LASSERTF(OST_CREATE == 5, " found %lld\n",
- (long long)OST_CREATE);
- LASSERTF(OST_DESTROY == 6, " found %lld\n",
- (long long)OST_DESTROY);
- LASSERTF(OST_GET_INFO == 7, " found %lld\n",
- (long long)OST_GET_INFO);
- LASSERTF(OST_CONNECT == 8, " found %lld\n",
- (long long)OST_CONNECT);
- LASSERTF(OST_DISCONNECT == 9, " found %lld\n",
- (long long)OST_DISCONNECT);
- LASSERTF(OST_PUNCH == 10, " found %lld\n",
- (long long)OST_PUNCH);
- LASSERTF(OST_OPEN == 11, " found %lld\n",
- (long long)OST_OPEN);
- LASSERTF(OST_CLOSE == 12, " found %lld\n",
- (long long)OST_CLOSE);
- LASSERTF(OST_STATFS == 13, " found %lld\n",
- (long long)OST_STATFS);
- LASSERTF(OST_SAN_READ == 14, " found %lld\n",
- (long long)OST_SAN_READ);
- LASSERTF(OST_SAN_WRITE == 15, " found %lld\n",
- (long long)OST_SAN_WRITE);
- LASSERTF(OST_SYNC == 16, " found %lld\n",
- (long long)OST_SYNC);
- LASSERTF(OST_LAST_OPC == 18, " found %lld\n",
- (long long)OST_LAST_OPC);
- LASSERTF(OBD_OBJECT_EOF == 0xffffffffffffffffULL," found %lld\n",
- (long long)OBD_OBJECT_EOF);
- LASSERTF(OST_REQ_HAS_OA1 == 1, " found %lld\n",
- (long long)OST_REQ_HAS_OA1);
- LASSERTF(MDS_GETATTR == 33, " found %lld\n",
- (long long)MDS_GETATTR);
- LASSERTF(MDS_GETATTR_LOCK == 34, " found %lld\n",
- (long long)MDS_GETATTR_LOCK);
- LASSERTF(MDS_CLOSE == 35, " found %lld\n",
- (long long)MDS_CLOSE);
- LASSERTF(MDS_REINT == 36, " found %lld\n",
- (long long)MDS_REINT);
- LASSERTF(MDS_READPAGE == 37, " found %lld\n",
- (long long)MDS_READPAGE);
- LASSERTF(MDS_CONNECT == 38, " found %lld\n",
- (long long)MDS_CONNECT);
- LASSERTF(MDS_DISCONNECT == 39, " found %lld\n",
- (long long)MDS_DISCONNECT);
- LASSERTF(MDS_GETSTATUS == 40, " found %lld\n",
- (long long)MDS_GETSTATUS);
- LASSERTF(MDS_STATFS == 41, " found %lld\n",
- (long long)MDS_STATFS);
- LASSERTF(MDS_PIN == 42, " found %lld\n",
- (long long)MDS_PIN);
- LASSERTF(MDS_UNPIN == 43, " found %lld\n",
- (long long)MDS_UNPIN);
- LASSERTF(MDS_SYNC == 44, " found %lld\n",
- (long long)MDS_SYNC);
- LASSERTF(MDS_DONE_WRITING == 45, " found %lld\n",
- (long long)MDS_DONE_WRITING);
- LASSERTF(MDS_LAST_OPC == 46, " found %lld\n",
- (long long)MDS_LAST_OPC);
- LASSERTF(REINT_SETATTR == 1, " found %lld\n",
- (long long)REINT_SETATTR);
- LASSERTF(REINT_CREATE == 2, " found %lld\n",
- (long long)REINT_CREATE);
- LASSERTF(REINT_LINK == 3, " found %lld\n",
- (long long)REINT_LINK);
- LASSERTF(REINT_UNLINK == 4, " found %lld\n",
- (long long)REINT_UNLINK);
- LASSERTF(REINT_RENAME == 5, " found %lld\n",
- (long long)REINT_RENAME);
- LASSERTF(REINT_OPEN == 6, " found %lld\n",
- (long long)REINT_OPEN);
- LASSERTF(REINT_MAX == 8, " found %lld\n",
- (long long)REINT_MAX);
- LASSERTF(DISP_IT_EXECD == 1, " found %lld\n",
- (long long)DISP_IT_EXECD);
- LASSERTF(DISP_LOOKUP_EXECD == 2, " found %lld\n",
- (long long)DISP_LOOKUP_EXECD);
- LASSERTF(DISP_LOOKUP_NEG == 4, " found %lld\n",
- (long long)DISP_LOOKUP_NEG);
- LASSERTF(DISP_LOOKUP_POS == 8, " found %lld\n",
- (long long)DISP_LOOKUP_POS);
- LASSERTF(DISP_OPEN_CREATE == 16, " found %lld\n",
- (long long)DISP_OPEN_CREATE);
- LASSERTF(DISP_OPEN_OPEN == 32, " found %lld\n",
- (long long)DISP_OPEN_OPEN);
- LASSERTF(MDS_STATUS_CONN == 1, " found %lld\n",
- (long long)MDS_STATUS_CONN);
- LASSERTF(MDS_STATUS_LOV == 2, " found %lld\n",
- (long long)MDS_STATUS_LOV);
- LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n",
- (long long)MDS_OPEN_HAS_EA);
- LASSERTF(LDLM_ENQUEUE == 101, " found %lld\n",
- (long long)LDLM_ENQUEUE);
- LASSERTF(LDLM_CONVERT == 102, " found %lld\n",
- (long long)LDLM_CONVERT);
- LASSERTF(LDLM_CANCEL == 103, " found %lld\n",
- (long long)LDLM_CANCEL);
- LASSERTF(LDLM_BL_CALLBACK == 104, " found %lld\n",
- (long long)LDLM_BL_CALLBACK);
- LASSERTF(LDLM_CP_CALLBACK == 105, " found %lld\n",
- (long long)LDLM_CP_CALLBACK);
- LASSERTF(LDLM_LAST_OPC == 107, " found %lld\n",
- (long long)LDLM_LAST_OPC);
- LASSERTF(LCK_EX == 1, " found %lld\n",
- (long long)LCK_EX);
- LASSERTF(LCK_PW == 2, " found %lld\n",
- (long long)LCK_PW);
- LASSERTF(LCK_PR == 4, " found %lld\n",
- (long long)LCK_PR);
- LASSERTF(LCK_CW == 8, " found %lld\n",
- (long long)LCK_CW);
- LASSERTF(LCK_CR == 16, " found %lld\n",
- (long long)LCK_CR);
- LASSERTF(LCK_NL == 32, " found %lld\n",
- (long long)LCK_NL);
- LASSERTF(PTLBD_QUERY == 200, " found %lld\n",
- (long long)PTLBD_QUERY);
- LASSERTF(PTLBD_READ == 201, " found %lld\n",
- (long long)PTLBD_READ);
- LASSERTF(PTLBD_WRITE == 202, " found %lld\n",
- (long long)PTLBD_WRITE);
- LASSERTF(PTLBD_FLUSH == 203, " found %lld\n",
- (long long)PTLBD_FLUSH);
- LASSERTF(PTLBD_CONNECT == 204, " found %lld\n",
- (long long)PTLBD_CONNECT);
- LASSERTF(PTLBD_DISCONNECT == 205, " found %lld\n",
- (long long)PTLBD_DISCONNECT);
- LASSERTF(PTLBD_LAST_OPC == 206, " found %lld\n",
- (long long)PTLBD_LAST_OPC);
- LASSERTF(MGMT_CONNECT == 250, " found %lld\n",
- (long long)MGMT_CONNECT);
- LASSERTF(MGMT_DISCONNECT == 251, " found %lld\n",
- (long long)MGMT_DISCONNECT);
- LASSERTF(MGMT_EXCEPTION == 252, " found %lld\n",
- (long long)MGMT_EXCEPTION);
- LASSERTF(OBD_PING == 400, " found %lld\n",
- (long long)OBD_PING);
- LASSERTF(OBD_LOG_CANCEL == 401, " found %lld\n",
- (long long)OBD_LOG_CANCEL);
- LASSERTF(OBD_LAST_OPC == 402, " found %lld\n",
- (long long)OBD_LAST_OPC);
- /* Sizes and Offsets */
-
-
- /* Checks for struct lustre_handle */
- LASSERTF((int)sizeof(struct lustre_handle) == 8, " found %lld\n",
- (long long)(int)sizeof(struct lustre_handle));
- LASSERTF((int)offsetof(struct lustre_handle, cookie) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lustre_handle, cookie));
- LASSERTF((int)sizeof(((struct lustre_handle *)0)->cookie) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_handle *)0)->cookie));
-
- /* Checks for struct lustre_msg */
- LASSERTF((int)sizeof(struct lustre_msg) == 64, " found %lld\n",
- (long long)(int)sizeof(struct lustre_msg));
- LASSERTF((int)offsetof(struct lustre_msg, handle) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, handle));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->handle) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->handle));
- LASSERTF((int)offsetof(struct lustre_msg, magic) == 8, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, magic));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->magic) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->magic));
- LASSERTF((int)offsetof(struct lustre_msg, type) == 12, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, type));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->type));
- LASSERTF((int)offsetof(struct lustre_msg, version) == 16, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, version));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->version) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->version));
- LASSERTF((int)offsetof(struct lustre_msg, opc) == 20, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, opc));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->opc) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->opc));
- LASSERTF((int)offsetof(struct lustre_msg, last_xid) == 24, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, last_xid));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->last_xid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->last_xid));
- LASSERTF((int)offsetof(struct lustre_msg, last_committed) == 32, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, last_committed));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->last_committed) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->last_committed));
- LASSERTF((int)offsetof(struct lustre_msg, transno) == 40, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, transno));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->transno) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->transno));
- LASSERTF((int)offsetof(struct lustre_msg, status) == 48, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, status));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->status) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->status));
- LASSERTF((int)offsetof(struct lustre_msg, flags) == 52, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, flags));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->flags));
- LASSERTF((int)offsetof(struct lustre_msg, bufcount) == 60, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, bufcount));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->bufcount) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->bufcount));
- LASSERTF((int)offsetof(struct lustre_msg, buflens[7]) == 92, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, buflens[7]));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->buflens[7]) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->buflens[7]));
-
- /* Checks for struct obdo */
- LASSERTF((int)sizeof(struct obdo) == 176, " found %lld\n",
- (long long)(int)sizeof(struct obdo));
- LASSERTF((int)offsetof(struct obdo, o_id) == 0, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_id));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_id));
- LASSERTF((int)offsetof(struct obdo, o_gr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_gr));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_gr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_gr));
- LASSERTF((int)offsetof(struct obdo, o_atime) == 32, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_atime));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_atime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_atime));
- LASSERTF((int)offsetof(struct obdo, o_mtime) == 24, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_mtime));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_mtime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_mtime));
- LASSERTF((int)offsetof(struct obdo, o_ctime) == 40, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_ctime));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_ctime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_ctime));
- LASSERTF((int)offsetof(struct obdo, o_size) == 16, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_size));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_size));
- LASSERTF((int)offsetof(struct obdo, o_blocks) == 48, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_blocks));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_blocks) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_blocks));
- LASSERTF((int)offsetof(struct obdo, o_grant) == 56, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_grant));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_grant) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_grant));
- LASSERTF((int)offsetof(struct obdo, o_blksize) == 64, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_blksize));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_blksize) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_blksize));
- LASSERTF((int)offsetof(struct obdo, o_mode) == 68, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_mode));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_mode));
- LASSERTF((int)offsetof(struct obdo, o_uid) == 72, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_uid));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_uid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_uid));
- LASSERTF((int)offsetof(struct obdo, o_gid) == 76, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_gid));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_gid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_gid));
- LASSERTF((int)offsetof(struct obdo, o_flags) == 80, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_flags));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_flags));
- LASSERTF((int)offsetof(struct obdo, o_nlink) == 84, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_nlink));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_nlink) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_nlink));
- LASSERTF((int)offsetof(struct obdo, o_generation) == 88, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_generation));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_generation) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_generation));
- LASSERTF((int)offsetof(struct obdo, o_valid) == 92, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_valid));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_valid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_valid));
- LASSERTF((int)offsetof(struct obdo, o_misc) == 96, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_misc));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_misc) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_misc));
- LASSERTF((int)offsetof(struct obdo, o_easize) == 100, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_easize));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_easize));
- LASSERTF((int)offsetof(struct obdo, o_mds) == 104, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_mds));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_mds) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_mds));
- LASSERTF((int)offsetof(struct obdo, o_padding) == 108, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_padding));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_padding) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_padding));
- LASSERTF((int)offsetof(struct obdo, o_inline) == 112, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_inline));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 64, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_inline));
- LASSERTF(OBD_MD_FLID == 1, " found %lld\n",
- (long long)OBD_MD_FLID);
- LASSERTF(OBD_MD_FLATIME == 2, " found %lld\n",
- (long long)OBD_MD_FLATIME);
- LASSERTF(OBD_MD_FLMTIME == 4, " found %lld\n",
- (long long)OBD_MD_FLMTIME);
- LASSERTF(OBD_MD_FLCTIME == 8, " found %lld\n",
- (long long)OBD_MD_FLCTIME);
- LASSERTF(OBD_MD_FLSIZE == 16, " found %lld\n",
- (long long)OBD_MD_FLSIZE);
- LASSERTF(OBD_MD_FLBLOCKS == 32, " found %lld\n",
- (long long)OBD_MD_FLBLOCKS);
- LASSERTF(OBD_MD_FLBLKSZ == 64, " found %lld\n",
- (long long)OBD_MD_FLBLKSZ);
- LASSERTF(OBD_MD_FLMODE == 128, " found %lld\n",
- (long long)OBD_MD_FLMODE);
- LASSERTF(OBD_MD_FLTYPE == 256, " found %lld\n",
- (long long)OBD_MD_FLTYPE);
- LASSERTF(OBD_MD_FLUID == 512, " found %lld\n",
- (long long)OBD_MD_FLUID);
- LASSERTF(OBD_MD_FLGID == 1024, " found %lld\n",
- (long long)OBD_MD_FLGID);
- LASSERTF(OBD_MD_FLFLAGS == 2048, " found %lld\n",
- (long long)OBD_MD_FLFLAGS);
- LASSERTF(OBD_MD_FLNLINK == 8192, " found %lld\n",
- (long long)OBD_MD_FLNLINK);
- LASSERTF(OBD_MD_FLGENER == 16384, " found %lld\n",
- (long long)OBD_MD_FLGENER);
- LASSERTF(OBD_MD_FLINLINE == 32768, " found %lld\n",
- (long long)OBD_MD_FLINLINE);
- LASSERTF(OBD_MD_FLRDEV == 65536, " found %lld\n",
- (long long)OBD_MD_FLRDEV);
- LASSERTF(OBD_MD_FLEASIZE == 131072, " found %lld\n",
- (long long)OBD_MD_FLEASIZE);
- LASSERTF(OBD_MD_LINKNAME == 262144, " found %lld\n",
- (long long)OBD_MD_LINKNAME);
- LASSERTF(OBD_MD_FLHANDLE == 524288, " found %lld\n",
- (long long)OBD_MD_FLHANDLE);
- LASSERTF(OBD_MD_FLCKSUM == 1048576, " found %lld\n",
- (long long)OBD_MD_FLCKSUM);
- LASSERTF(OBD_MD_FLQOS == 2097152, " found %lld\n",
- (long long)OBD_MD_FLQOS);
- LASSERTF(OBD_MD_FLOSCOPQ == 4194304, " found %lld\n",
- (long long)OBD_MD_FLOSCOPQ);
- LASSERTF(OBD_MD_FLCOOKIE == 8388608, " found %lld\n",
- (long long)OBD_MD_FLCOOKIE);
- LASSERTF(OBD_MD_FLGROUP == 16777216, " found %lld\n",
- (long long)OBD_MD_FLGROUP);
- LASSERTF(OBD_FL_INLINEDATA == 1, " found %lld\n",
- (long long)OBD_FL_INLINEDATA);
- LASSERTF(OBD_FL_OBDMDEXISTS == 2, " found %lld\n",
- (long long)OBD_FL_OBDMDEXISTS);
- LASSERTF(OBD_FL_DELORPHAN == 4, " found %lld\n",
- (long long)OBD_FL_DELORPHAN);
- LASSERTF(OBD_FL_NORPC == 8, " found %lld\n",
- (long long)OBD_FL_NORPC);
- LASSERTF(OBD_FL_IDONLY == 16, " found %lld\n",
- (long long)OBD_FL_IDONLY);
- LASSERTF(OBD_FL_RECREATE_OBJS == 32, " found %lld\n",
- (long long)OBD_FL_RECREATE_OBJS);
-
- /* Checks for struct lov_mds_md_v1 */
- LASSERTF((int)sizeof(struct lov_mds_md_v1) == 32, " found %lld\n",
- (long long)(int)sizeof(struct lov_mds_md_v1));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_magic) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_magic));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_pattern) == 4, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_pattern));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_object_id) == 8, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_object_id));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_object_gr) == 16, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_object_gr));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_size));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_count));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_objects) == 32, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_objects));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects) == 0, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects));
-
- /* Checks for struct lov_ost_data_v1 */
- LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, " found %lld\n",
- (long long)(int)sizeof(struct lov_ost_data_v1));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_object_id) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_object_id));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_object_gr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_object_gr));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_gen) == 16, " found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_gen));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_idx) == 20, " found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_idx));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx));
- LASSERTF(LOV_MAGIC_V0 == 198183888, " found %lld\n",
- (long long)LOV_MAGIC_V0);
- LASSERTF(LOV_MAGIC_V1 == 198249424, " found %lld\n",
- (long long)LOV_MAGIC_V1);
- LASSERTF(LOV_PATTERN_RAID0 == 1, " found %lld\n",
- (long long)LOV_PATTERN_RAID0);
- LASSERTF(LOV_PATTERN_RAID1 == 2, " found %lld\n",
- (long long)LOV_PATTERN_RAID1);
-
- /* Checks for struct obd_statfs */
- LASSERTF((int)sizeof(struct obd_statfs) == 144, " found %lld\n",
- (long long)(int)sizeof(struct obd_statfs));
- LASSERTF((int)offsetof(struct obd_statfs, os_type) == 0, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_type));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_type) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_type));
- LASSERTF((int)offsetof(struct obd_statfs, os_blocks) == 8, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_blocks));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_blocks) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_blocks));
- LASSERTF((int)offsetof(struct obd_statfs, os_bfree) == 16, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_bfree));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bfree) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_bfree));
- LASSERTF((int)offsetof(struct obd_statfs, os_bavail) == 24, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_bavail));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bavail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_bavail));
- LASSERTF((int)offsetof(struct obd_statfs, os_ffree) == 40, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_ffree));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_ffree) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_ffree));
- LASSERTF((int)offsetof(struct obd_statfs, os_fsid) == 48, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_fsid));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fsid) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_fsid));
- LASSERTF((int)offsetof(struct obd_statfs, os_bsize) == 88, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_bsize));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bsize) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_bsize));
- LASSERTF((int)offsetof(struct obd_statfs, os_namelen) == 92, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_namelen));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_namelen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_namelen));
- LASSERTF((int)offsetof(struct obd_statfs, os_spare) == 104, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_spare));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare));
-
- /* Checks for struct obd_ioobj */
- LASSERTF((int)sizeof(struct obd_ioobj) == 24, " found %lld\n",
- (long long)(int)sizeof(struct obd_ioobj));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_id) == 0, " found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_id));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_id));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_gr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_gr));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_gr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_gr));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_type) == 16, " found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_type));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_type));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_bufcnt) == 20, " found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_bufcnt));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
-
- /* Checks for struct niobuf_remote */
- LASSERTF((int)sizeof(struct niobuf_remote) == 16, " found %lld\n",
- (long long)(int)sizeof(struct niobuf_remote));
- LASSERTF((int)offsetof(struct niobuf_remote, offset) == 0, " found %lld\n",
- (long long)(int)offsetof(struct niobuf_remote, offset));
- LASSERTF((int)sizeof(((struct niobuf_remote *)0)->offset) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct niobuf_remote *)0)->offset));
- LASSERTF((int)offsetof(struct niobuf_remote, len) == 8, " found %lld\n",
- (long long)(int)offsetof(struct niobuf_remote, len));
- LASSERTF((int)sizeof(((struct niobuf_remote *)0)->len) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct niobuf_remote *)0)->len));
- LASSERTF((int)offsetof(struct niobuf_remote, flags) == 12, " found %lld\n",
- (long long)(int)offsetof(struct niobuf_remote, flags));
- LASSERTF((int)sizeof(((struct niobuf_remote *)0)->flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct niobuf_remote *)0)->flags));
- LASSERTF(OBD_BRW_READ == 1, " found %lld\n",
- (long long)OBD_BRW_READ);
- LASSERTF(OBD_BRW_WRITE == 2, " found %lld\n",
- (long long)OBD_BRW_WRITE);
- LASSERTF(OBD_BRW_SYNC == 8, " found %lld\n",
- (long long)OBD_BRW_SYNC);
- LASSERTF(OBD_BRW_FROM_GRANT == 32, " found %lld\n",
- (long long)OBD_BRW_FROM_GRANT);
-
- /* Checks for struct ost_body */
- LASSERTF((int)sizeof(struct ost_body) == 176, " found %lld\n",
- (long long)(int)sizeof(struct ost_body));
- LASSERTF((int)offsetof(struct ost_body, oa) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ost_body, oa));
- LASSERTF((int)sizeof(((struct ost_body *)0)->oa) == 176, " found %lld\n",
- (long long)(int)sizeof(((struct ost_body *)0)->oa));
-
- /* Checks for struct ll_fid */
- LASSERTF((int)sizeof(struct ll_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(struct ll_fid));
- LASSERTF((int)offsetof(struct ll_fid, id) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ll_fid, id));
- LASSERTF((int)sizeof(((struct ll_fid *)0)->id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ll_fid *)0)->id));
- LASSERTF((int)offsetof(struct ll_fid, generation) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ll_fid, generation));
- LASSERTF((int)sizeof(((struct ll_fid *)0)->generation) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ll_fid *)0)->generation));
- LASSERTF((int)offsetof(struct ll_fid, f_type) == 12, " found %lld\n",
- (long long)(int)offsetof(struct ll_fid, f_type));
- LASSERTF((int)sizeof(((struct ll_fid *)0)->f_type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ll_fid *)0)->f_type));
-
- /* Checks for struct mds_status_req */
- LASSERTF((int)sizeof(struct mds_status_req) == 8, " found %lld\n",
- (long long)(int)sizeof(struct mds_status_req));
- LASSERTF((int)offsetof(struct mds_status_req, flags) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_status_req, flags));
- LASSERTF((int)sizeof(((struct mds_status_req *)0)->flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_status_req *)0)->flags));
- LASSERTF((int)offsetof(struct mds_status_req, repbuf) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_status_req, repbuf));
- LASSERTF((int)sizeof(((struct mds_status_req *)0)->repbuf) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_status_req *)0)->repbuf));
-
- /* Checks for struct mds_body */
- LASSERTF((int)sizeof(struct mds_body) == 136, " found %lld\n",
- (long long)(int)sizeof(struct mds_body));
- LASSERTF((int)offsetof(struct mds_body, fid1) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, fid1));
- LASSERTF((int)sizeof(((struct mds_body *)0)->fid1) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->fid1));
- LASSERTF((int)offsetof(struct mds_body, fid2) == 24, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, fid2));
- LASSERTF((int)sizeof(((struct mds_body *)0)->fid2) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->fid2));
- LASSERTF((int)offsetof(struct mds_body, handle) == 48, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, handle));
- LASSERTF((int)sizeof(((struct mds_body *)0)->handle) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->handle));
- LASSERTF((int)offsetof(struct mds_body, size) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, size));
- LASSERTF((int)sizeof(((struct mds_body *)0)->size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->size));
- LASSERTF((int)offsetof(struct mds_body, blocks) == 64, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, blocks));
- LASSERTF((int)sizeof(((struct mds_body *)0)->blocks) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->blocks));
- LASSERTF((int)offsetof(struct mds_body, io_epoch) == 72, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, io_epoch));
- LASSERTF((int)sizeof(((struct mds_body *)0)->io_epoch) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->io_epoch));
- LASSERTF((int)offsetof(struct mds_body, ino) == 80, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, ino));
- LASSERTF((int)sizeof(((struct mds_body *)0)->ino) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->ino));
- LASSERTF((int)offsetof(struct mds_body, valid) == 84, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, valid));
- LASSERTF((int)sizeof(((struct mds_body *)0)->valid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->valid));
- LASSERTF((int)offsetof(struct mds_body, mode) == 88, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, mode));
- LASSERTF((int)sizeof(((struct mds_body *)0)->mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->mode));
- LASSERTF((int)offsetof(struct mds_body, uid) == 92, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, uid));
- LASSERTF((int)sizeof(((struct mds_body *)0)->uid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->uid));
- LASSERTF((int)offsetof(struct mds_body, gid) == 96, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, gid));
- LASSERTF((int)sizeof(((struct mds_body *)0)->gid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->gid));
- LASSERTF((int)offsetof(struct mds_body, mtime) == 100, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, mtime));
- LASSERTF((int)sizeof(((struct mds_body *)0)->mtime) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->mtime));
- LASSERTF((int)offsetof(struct mds_body, ctime) == 104, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, ctime));
- LASSERTF((int)sizeof(((struct mds_body *)0)->ctime) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->ctime));
- LASSERTF((int)offsetof(struct mds_body, atime) == 108, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, atime));
- LASSERTF((int)sizeof(((struct mds_body *)0)->atime) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->atime));
- LASSERTF((int)offsetof(struct mds_body, flags) == 112, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, flags));
- LASSERTF((int)sizeof(((struct mds_body *)0)->flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->flags));
- LASSERTF((int)offsetof(struct mds_body, rdev) == 116, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, rdev));
- LASSERTF((int)sizeof(((struct mds_body *)0)->rdev) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->rdev));
- LASSERTF((int)offsetof(struct mds_body, nlink) == 120, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, nlink));
- LASSERTF((int)sizeof(((struct mds_body *)0)->nlink) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->nlink));
- LASSERTF((int)offsetof(struct mds_body, generation) == 124, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, generation));
- LASSERTF((int)sizeof(((struct mds_body *)0)->generation) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->generation));
- LASSERTF((int)offsetof(struct mds_body, eadatasize) == 128, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, eadatasize));
- LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->eadatasize));
- LASSERTF((int)offsetof(struct mds_body, mds) == 132, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, mds));
- LASSERTF((int)sizeof(((struct mds_body *)0)->mds) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->mds));
- LASSERTF(FMODE_READ == 1, " found %lld\n",
- (long long)FMODE_READ);
- LASSERTF(FMODE_WRITE == 2, " found %lld\n",
- (long long)FMODE_WRITE);
- LASSERTF(FMODE_EXEC == 4, " found %lld\n",
- (long long)FMODE_EXEC);
- LASSERTF(MDS_OPEN_CREAT == 64, " found %lld\n",
- (long long)MDS_OPEN_CREAT);
- LASSERTF(MDS_OPEN_EXCL == 128, " found %lld\n",
- (long long)MDS_OPEN_EXCL);
- LASSERTF(MDS_OPEN_TRUNC == 512, " found %lld\n",
- (long long)MDS_OPEN_TRUNC);
- LASSERTF(MDS_OPEN_APPEND == 1024, " found %lld\n",
- (long long)MDS_OPEN_APPEND);
- LASSERTF(MDS_OPEN_SYNC == 4096, " found %lld\n",
- (long long)MDS_OPEN_SYNC);
- LASSERTF(MDS_OPEN_DIRECTORY == 65536, " found %lld\n",
- (long long)MDS_OPEN_DIRECTORY);
- LASSERTF(MDS_OPEN_DELAY_CREATE == 16777216, " found %lld\n",
- (long long)MDS_OPEN_DELAY_CREATE);
- LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n",
- (long long)MDS_OPEN_HAS_EA);
-
- /* Checks for struct mds_rec_setattr */
- LASSERTF((int)sizeof(struct mds_rec_setattr) == 80, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_setattr));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_valid) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_valid));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_valid));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fid) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_fid));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fid));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mode) == 32, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_mode));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mode));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_uid) == 36, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_uid));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_uid));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_gid) == 40, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_gid));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_gid));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_attr_flags) == 44, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_attr_flags));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_size) == 48, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_size));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_size));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_atime) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_atime));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_atime));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mtime) == 64, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_mtime));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_ctime) == 72, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_ctime));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime));
-
- /* Checks for struct mds_rec_create */
- LASSERTF((int)sizeof(struct mds_rec_create) == 80, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_create));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_opcode));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_flags) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_flags));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_flags));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_mode) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_mode));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_mode));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_padding) == 12, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_padding));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_padding) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_padding));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_fid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_fid));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fid));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_replayfid) == 40, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_replayfid));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_replayfid));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_time) == 64, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_time));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_time));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_rdev) == 72, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_rdev));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_rdev));
-
- /* Checks for struct mds_rec_link */
- LASSERTF((int)sizeof(struct mds_rec_link) == 64, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_link));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_opcode));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_padding) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_padding));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_padding) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_padding));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_fid1) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_fid1));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid1));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_fid2) == 32, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_fid2));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid2));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_time) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_time));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_time));
-
- /* Checks for struct mds_rec_unlink */
- LASSERTF((int)sizeof(struct mds_rec_unlink) == 64, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_unlink));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_mode) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_mode));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_mode));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid1) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_fid1));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid2) == 32, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_fid2));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_time) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_time));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_time));
-
- /* Checks for struct mds_rec_rename */
- LASSERTF((int)sizeof(struct mds_rec_rename) == 64, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_rename));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_opcode));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_padding) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_padding));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_padding) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_padding));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid1) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_fid1));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid1));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid2) == 32, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_fid2));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid2));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_time) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_time));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_time));
-
- /* Checks for struct lov_desc */
- LASSERTF((int)sizeof(struct lov_desc) == 72, " found %lld\n",
- (long long)(int)sizeof(struct lov_desc));
- LASSERTF((int)offsetof(struct lov_desc, ld_tgt_count) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_tgt_count));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_tgt_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_tgt_count));
- LASSERTF((int)offsetof(struct lov_desc, ld_active_tgt_count) == 4, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_active_tgt_count));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count));
- LASSERTF((int)offsetof(struct lov_desc, ld_default_stripe_count) == 8, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_default_stripe_count));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count));
- LASSERTF((int)offsetof(struct lov_desc, ld_pattern) == 12, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_pattern));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_pattern) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_pattern));
- LASSERTF((int)offsetof(struct lov_desc, ld_default_stripe_size) == 16, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_default_stripe_size));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size));
- LASSERTF((int)offsetof(struct lov_desc, ld_default_stripe_offset) == 24, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_default_stripe_offset));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset));
- LASSERTF((int)offsetof(struct lov_desc, ld_uuid) == 32, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_uuid));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_uuid));
-
- /* Checks for struct ldlm_res_id */
- LASSERTF((int)sizeof(struct ldlm_res_id) == 32, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_res_id));
- LASSERTF((int)offsetof(struct ldlm_res_id, name[4]) == 32, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_res_id, name[4]));
- LASSERTF((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_res_id *)0)->name[4]));
-
- /* Checks for struct ldlm_extent */
- LASSERTF((int)sizeof(struct ldlm_extent) == 24, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_extent));
- LASSERTF((int)offsetof(struct ldlm_extent, start) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_extent, start));
- LASSERTF((int)sizeof(((struct ldlm_extent *)0)->start) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_extent *)0)->start));
- LASSERTF((int)offsetof(struct ldlm_extent, end) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_extent, end));
- LASSERTF((int)sizeof(((struct ldlm_extent *)0)->end) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_extent *)0)->end));
- LASSERTF((int)offsetof(struct ldlm_extent, gid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_extent, gid));
- LASSERTF((int)sizeof(((struct ldlm_extent *)0)->gid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_extent *)0)->gid));
-
- /* Checks for struct ldlm_flock */
- LASSERTF((int)sizeof(struct ldlm_flock) == 40, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_flock));
- LASSERTF((int)offsetof(struct ldlm_flock, start) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, start));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->start) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->start));
- LASSERTF((int)offsetof(struct ldlm_flock, end) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, end));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->end) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->end));
- LASSERTF((int)offsetof(struct ldlm_flock, pid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, pid));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->pid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->pid));
- LASSERTF((int)offsetof(struct ldlm_flock, blocking_pid) == 24, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, blocking_pid));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->blocking_pid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->blocking_pid));
- LASSERTF((int)offsetof(struct ldlm_flock, blocking_export) == 32, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, blocking_export));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->blocking_export) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->blocking_export));
-
- /* Checks for struct ldlm_intent */
- LASSERTF((int)sizeof(struct ldlm_intent) == 8, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_intent));
- LASSERTF((int)offsetof(struct ldlm_intent, opc) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_intent, opc));
- LASSERTF((int)sizeof(((struct ldlm_intent *)0)->opc) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_intent *)0)->opc));
-
- /* Checks for struct ldlm_resource_desc */
- LASSERTF((int)sizeof(struct ldlm_resource_desc) == 40, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_resource_desc));
- LASSERTF((int)offsetof(struct ldlm_resource_desc, lr_type) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_resource_desc, lr_type));
- LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_type));
- LASSERTF((int)offsetof(struct ldlm_resource_desc, lr_name) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_resource_desc, lr_name));
- LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_name));
-
- /* Checks for struct ldlm_lock_desc */
- LASSERTF((int)sizeof(struct ldlm_lock_desc) == 88, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_lock_desc));
- LASSERTF((int)offsetof(struct ldlm_lock_desc, l_resource) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_lock_desc, l_resource));
- LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_resource) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_resource));
- LASSERTF((int)offsetof(struct ldlm_lock_desc, l_req_mode) == 40, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_lock_desc, l_req_mode));
- LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode));
- LASSERTF((int)offsetof(struct ldlm_lock_desc, l_granted_mode) == 44, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_lock_desc, l_granted_mode));
- LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode));
- LASSERTF((int)offsetof(struct ldlm_lock_desc, l_policy_data) == 48, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_lock_desc, l_policy_data));
- LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data));
-
- /* Checks for struct ldlm_request */
- LASSERTF((int)sizeof(struct ldlm_request) == 112, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_request));
- LASSERTF((int)offsetof(struct ldlm_request, lock_flags) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_flags));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_flags));
- LASSERTF((int)offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_desc));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 88, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_desc));
- LASSERTF((int)offsetof(struct ldlm_request, lock_handle1) == 96, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_handle1));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_handle1) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_handle1));
- LASSERTF((int)offsetof(struct ldlm_request, lock_handle2) == 104, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_handle2));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_handle2) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_handle2));
-
- /* Checks for struct ldlm_reply */
- LASSERTF((int)sizeof(struct ldlm_reply) == 120, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_reply));
- LASSERTF((int)offsetof(struct ldlm_reply, lock_flags) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_reply, lock_flags));
- LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_flags));
- LASSERTF((int)offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_desc));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 88, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_desc));
- LASSERTF((int)offsetof(struct ldlm_reply, lock_handle) == 96, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_reply, lock_handle));
- LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_handle) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_handle));
- LASSERTF((int)offsetof(struct ldlm_reply, lock_policy_res1) == 104, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_reply, lock_policy_res1));
- LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1));
- LASSERTF((int)offsetof(struct ldlm_reply, lock_policy_res2) == 112, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_reply, lock_policy_res2));
- LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2));
-
- /* Checks for struct ost_lvb */
- LASSERTF((int)sizeof(struct ost_lvb) == 40, " found %lld\n",
- (long long)(int)sizeof(struct ost_lvb));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_size) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_size));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_size));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_mtime) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_mtime));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_mtime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_mtime));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_atime) == 16, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_atime));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_atime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_atime));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_ctime) == 24, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_ctime));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_ctime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_ctime));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_blocks) == 32, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_blocks));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_blocks) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_blocks));
-
- /* Checks for struct ptlbd_op */
- LASSERTF((int)sizeof(struct ptlbd_op) == 12, " found %lld\n",
- (long long)(int)sizeof(struct ptlbd_op));
- LASSERTF((int)offsetof(struct ptlbd_op, op_cmd) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op_cmd));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op_cmd));
- LASSERTF((int)offsetof(struct ptlbd_op, op_lun) == 2, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op_lun));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op_lun));
- LASSERTF((int)offsetof(struct ptlbd_op, op_niob_cnt) == 4, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op_niob_cnt));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt));
- LASSERTF((int)offsetof(struct ptlbd_op, op__padding) == 6, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op__padding));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op__padding));
- LASSERTF((int)offsetof(struct ptlbd_op, op_block_cnt) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op_block_cnt));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op_block_cnt));
-
- /* Checks for struct ptlbd_niob */
- LASSERTF((int)sizeof(struct ptlbd_niob) == 24, " found %lld\n",
- (long long)(int)sizeof(struct ptlbd_niob));
- LASSERTF((int)offsetof(struct ptlbd_niob, n_xid) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_niob, n_xid));
- LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_xid));
- LASSERTF((int)offsetof(struct ptlbd_niob, n_block_nr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_niob, n_block_nr));
- LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_block_nr));
- LASSERTF((int)offsetof(struct ptlbd_niob, n_offset) == 16, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_niob, n_offset));
- LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_offset));
- LASSERTF((int)offsetof(struct ptlbd_niob, n_length) == 20, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_niob, n_length));
- LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_length));
-
- /* Checks for struct ptlbd_rsp */
- LASSERTF((int)sizeof(struct ptlbd_rsp) == 4, " found %lld\n",
- (long long)(int)sizeof(struct ptlbd_rsp));
- LASSERTF((int)offsetof(struct ptlbd_rsp, r_status) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_rsp, r_status));
- LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_status));
- LASSERTF((int)offsetof(struct ptlbd_rsp, r_error_cnt) == 2, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_rsp, r_error_cnt));
- LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt));
-
- /* Checks for struct llog_logid */
- LASSERTF((int)sizeof(struct llog_logid) == 20, " found %lld\n",
- (long long)(int)sizeof(struct llog_logid));
- LASSERTF((int)offsetof(struct llog_logid, lgl_oid) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_oid));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oid));
- LASSERTF((int)offsetof(struct llog_logid, lgl_ogr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_ogr));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogr));
- LASSERTF((int)offsetof(struct llog_logid, lgl_ogen) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_ogen));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen));
- LASSERTF(OST_SZ_REC == 274730752, " found %lld\n",
- (long long)OST_SZ_REC);
- LASSERTF(OST_RAID1_REC == 274731008, " found %lld\n",
- (long long)OST_RAID1_REC);
- LASSERTF(MDS_UNLINK_REC == 274801668, " found %lld\n",
- (long long)MDS_UNLINK_REC);
- LASSERTF(OBD_CFG_REC == 274857984, " found %lld\n",
- (long long)OBD_CFG_REC);
- LASSERTF(PTL_CFG_REC == 274923520, " found %lld\n",
- (long long)PTL_CFG_REC);
- LASSERTF(LLOG_GEN_REC == 274989056, " found %lld\n",
- (long long)LLOG_GEN_REC);
- LASSERTF(LLOG_HDR_MAGIC == 275010873, " found %lld\n",
- (long long)LLOG_HDR_MAGIC);
- LASSERTF(LLOG_LOGID_MAGIC == 275010875, " found %lld\n",
- (long long)LLOG_LOGID_MAGIC);
-
- /* Checks for struct llog_catid */
- LASSERTF((int)sizeof(struct llog_catid) == 32, " found %lld\n",
- (long long)(int)sizeof(struct llog_catid));
- LASSERTF((int)offsetof(struct llog_catid, lci_logid) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_catid, lci_logid));
- LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_logid) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llog_catid *)0)->lci_logid));
-
- /* Checks for struct llog_rec_hdr */
- LASSERTF((int)sizeof(struct llog_rec_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(struct llog_rec_hdr));
- LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_len) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_hdr, lrh_len));
- LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_len) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_len));
- LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_index) == 4, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_hdr, lrh_index));
- LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_index));
- LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_type) == 8, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_hdr, lrh_type));
- LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type));
-
- /* Checks for struct llog_rec_tail */
- LASSERTF((int)sizeof(struct llog_rec_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(struct llog_rec_tail));
- LASSERTF((int)offsetof(struct llog_rec_tail, lrt_len) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_tail, lrt_len));
- LASSERTF((int)sizeof(((struct llog_rec_tail *)0)->lrt_len) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_len));
- LASSERTF((int)offsetof(struct llog_rec_tail, lrt_index) == 4, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_tail, lrt_index));
- LASSERTF((int)sizeof(((struct llog_rec_tail *)0)->lrt_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_index));
-
- /* Checks for struct llog_logid_rec */
- LASSERTF((int)sizeof(struct llog_logid_rec) == 64, " found %lld\n",
- (long long)(int)sizeof(struct llog_logid_rec));
- LASSERTF((int)offsetof(struct llog_logid_rec, lid_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid_rec, lid_hdr));
- LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_hdr));
- LASSERTF((int)offsetof(struct llog_logid_rec, lid_id) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid_rec, lid_id));
- LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_id));
- LASSERTF((int)offsetof(struct llog_logid_rec, lid_tail) == 56, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid_rec, lid_tail));
- LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_tail));
-
- /* Checks for struct llog_create_rec */
- LASSERTF((int)sizeof(struct llog_create_rec) == 64, " found %lld\n",
- (long long)(int)sizeof(struct llog_create_rec));
- LASSERTF((int)offsetof(struct llog_create_rec, lcr_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_create_rec, lcr_hdr));
- LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_hdr));
- LASSERTF((int)offsetof(struct llog_create_rec, lcr_fid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_create_rec, lcr_fid));
- LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_fid));
- LASSERTF((int)offsetof(struct llog_create_rec, lcr_oid) == 40, " found %lld\n",
- (long long)(int)offsetof(struct llog_create_rec, lcr_oid));
- LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_oid));
- LASSERTF((int)offsetof(struct llog_create_rec, lcr_ogen) == 48, " found %lld\n",
- (long long)(int)offsetof(struct llog_create_rec, lcr_ogen));
- LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogen));
-
- /* Checks for struct llog_orphan_rec */
- LASSERTF((int)sizeof(struct llog_orphan_rec) == 40, " found %lld\n",
- (long long)(int)sizeof(struct llog_orphan_rec));
- LASSERTF((int)offsetof(struct llog_orphan_rec, lor_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_orphan_rec, lor_hdr));
- LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr));
- LASSERTF((int)offsetof(struct llog_orphan_rec, lor_oid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_orphan_rec, lor_oid));
- LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_oid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_oid));
- LASSERTF((int)offsetof(struct llog_orphan_rec, lor_ogen) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llog_orphan_rec, lor_ogen));
- LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen));
- LASSERTF((int)offsetof(struct llog_orphan_rec, lor_tail) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llog_orphan_rec, lor_tail));
- LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_tail));
-
- /* Checks for struct llog_unlink_rec */
- LASSERTF((int)sizeof(struct llog_unlink_rec) == 40, " found %lld\n",
- (long long)(int)sizeof(struct llog_unlink_rec));
- LASSERTF((int)offsetof(struct llog_unlink_rec, lur_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_unlink_rec, lur_hdr));
- LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr));
- LASSERTF((int)offsetof(struct llog_unlink_rec, lur_oid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_unlink_rec, lur_oid));
- LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_oid));
- LASSERTF((int)offsetof(struct llog_unlink_rec, lur_ogen) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llog_unlink_rec, lur_ogen));
- LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen));
- LASSERTF((int)offsetof(struct llog_unlink_rec, lur_tail) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llog_unlink_rec, lur_tail));
- LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_tail));
-
- /* Checks for struct llog_size_change_rec */
- LASSERTF((int)sizeof(struct llog_size_change_rec) == 56, " found %lld\n",
- (long long)(int)sizeof(struct llog_size_change_rec));
- LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_size_change_rec, lsc_hdr));
- LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr));
- LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_fid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_size_change_rec, lsc_fid));
- LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid));
- LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_io_epoch) == 40, " found %lld\n",
- (long long)(int)offsetof(struct llog_size_change_rec, lsc_io_epoch));
- LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch));
- LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_tail) == 48, " found %lld\n",
- (long long)(int)offsetof(struct llog_size_change_rec, lsc_tail));
- LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail));
-
- /* Checks for struct llog_gen */
- LASSERTF((int)sizeof(struct llog_gen) == 16, " found %lld\n",
- (long long)(int)sizeof(struct llog_gen));
- LASSERTF((int)offsetof(struct llog_gen, mnt_cnt) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen, mnt_cnt));
- LASSERTF((int)sizeof(((struct llog_gen *)0)->mnt_cnt) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen *)0)->mnt_cnt));
- LASSERTF((int)offsetof(struct llog_gen, conn_cnt) == 8, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen, conn_cnt));
- LASSERTF((int)sizeof(((struct llog_gen *)0)->conn_cnt) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen *)0)->conn_cnt));
-
- /* Checks for struct llog_gen_rec */
- LASSERTF((int)sizeof(struct llog_gen_rec) == 40, " found %lld\n",
- (long long)(int)sizeof(struct llog_gen_rec));
- LASSERTF((int)offsetof(struct llog_gen_rec, lgr_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen_rec, lgr_hdr));
- LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr));
- LASSERTF((int)offsetof(struct llog_gen_rec, lgr_gen) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen_rec, lgr_gen));
- LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_gen) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_gen));
- LASSERTF((int)offsetof(struct llog_gen_rec, lgr_tail) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen_rec, lgr_tail));
- LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_tail));
-
- /* Checks for struct llog_log_hdr */
- LASSERTF((int)sizeof(struct llog_log_hdr) == 8192, " found %lld\n",
- (long long)(int)sizeof(struct llog_log_hdr));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_hdr));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_hdr));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_timestamp) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_timestamp));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_count) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_count));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_count));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_bitmap_offset) == 28, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_bitmap_offset));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_size) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_size));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_size) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_size));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_flags) == 36, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_flags));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_flags));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_cat_idx) == 40, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_cat_idx));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_tgtuuid) == 44, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_tgtuuid));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_bitmap) == 88, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_bitmap));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap) == 8096, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_tail) == 8184, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_tail));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tail));
-
- /* Checks for struct llog_cookie */
- LASSERTF((int)sizeof(struct llog_cookie) == 32, " found %lld\n",
- (long long)(int)sizeof(struct llog_cookie));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_lgl) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_lgl));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_subsys) == 20, " found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_subsys));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_index) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_index));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index));
-
- /* Checks for struct llogd_body */
- LASSERTF((int)sizeof(struct llogd_body) == 48, " found %lld\n",
- (long long)(int)sizeof(struct llogd_body));
- LASSERTF((int)offsetof(struct llogd_body, lgd_logid) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_logid));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_logid) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_logid));
- LASSERTF((int)offsetof(struct llogd_body, lgd_ctxt_idx) == 20, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_ctxt_idx));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx));
- LASSERTF((int)offsetof(struct llogd_body, lgd_llh_flags) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_llh_flags));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_llh_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_llh_flags));
- LASSERTF((int)offsetof(struct llogd_body, lgd_index) == 28, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_index));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_index));
- LASSERTF((int)offsetof(struct llogd_body, lgd_saved_index) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_saved_index));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_saved_index));
- LASSERTF((int)offsetof(struct llogd_body, lgd_len) == 36, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_len));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_len));
- LASSERTF((int)offsetof(struct llogd_body, lgd_cur_offset) == 40, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_cur_offset));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_cur_offset));
- LASSERTF(LLOG_ORIGIN_HANDLE_OPEN == 501, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_OPEN);
- LASSERTF(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
- LASSERTF(LLOG_ORIGIN_HANDLE_READ_HEADER == 503, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_READ_HEADER);
- LASSERTF(LLOG_ORIGIN_HANDLE_WRITE_REC == 504, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_WRITE_REC);
- LASSERTF(LLOG_ORIGIN_HANDLE_CLOSE == 505, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_CLOSE);
- LASSERTF(LLOG_ORIGIN_CONNECT == 506, " found %lld\n",
- (long long)LLOG_ORIGIN_CONNECT);
- LASSERTF(LLOG_CATINFO == 507, " found %lld\n",
- (long long)LLOG_CATINFO);
-
- /* Checks for struct llogd_conn_body */
- LASSERTF((int)sizeof(struct llogd_conn_body) == 40, " found %lld\n",
- (long long)(int)sizeof(struct llogd_conn_body));
- LASSERTF((int)offsetof(struct llogd_conn_body, lgdc_gen) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llogd_conn_body, lgdc_gen));
- LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen));
- LASSERTF((int)offsetof(struct llogd_conn_body, lgdc_logid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llogd_conn_body, lgdc_logid));
- LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid));
- LASSERTF((int)offsetof(struct llogd_conn_body, lgdc_ctxt_idx) == 36, " found %lld\n",
- (long long)(int)offsetof(struct llogd_conn_body, lgdc_ctxt_idx));
- LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx));
}
EXPORT_SYMBOL(lustre_swab_ost_body);
EXPORT_SYMBOL(lustre_swab_ost_last_id);
EXPORT_SYMBOL(lustre_swab_ost_lvb);
-EXPORT_SYMBOL(lustre_swab_ll_fid);
+EXPORT_SYMBOL(lustre_swab_generic_32s);
+EXPORT_SYMBOL(lustre_swab_lustre_id);
+EXPORT_SYMBOL(lustre_swab_lustre_stc);
+EXPORT_SYMBOL(lustre_swab_lustre_fid);
EXPORT_SYMBOL(lustre_swab_mds_status_req);
EXPORT_SYMBOL(lustre_swab_mds_secdesc);
EXPORT_SYMBOL(lustre_swab_mds_body);
#include "smfs_internal.h"
struct cache_purge_param {
- int nfract; /* Percentage of cache dirty to activate cpurge */
- int ndirty; /* Maximum number of objects to write out per
- wake-cycle */
- int interval; /* jiffies delay between cache purge */
- int nfract_sync;/* Percentage of cache dirty to activate
- cpurge synchronously */
- int nfract_stop_cpurge; /* Percentage of cache dirty to stop cpurge */
+ int nfract; /* percentage of cache dirty to activate
+ * cpurge */
+ int ndirty; /* maximum number of objects to write out per
+ wake-cycle */
+ int interval; /* jiffies delay between cache purge */
+ int nfract_sync; /* percentage of cache dirty to activate cpurge
+ synchronously */
+ int nfract_stop_cpurge; /* percentage of cache dirty to stop cpurge */
} cf_prm = {30, 512, 600 * HZ, 60, 20};
static struct cache_purge_queue smfs_cpq;
if (S_ISDIR(inode->i_mode)) {
if (inode->i_nlink != 2)
return 0;
- if (!strncmp(dentry->d_name.name, "lost+found", dentry->d_name.len))
+ if (!strncmp(dentry->d_name.name, "lost+found",
+ dentry->d_name.len))
return 0;
LASSERT(active_entry != NULL);
get_active_entry(inode, active_entry);
return 1;
}
}
+
static int cache_pre_leaf_node(struct dentry *dentry, __u64 *active_entry, int op)
{
if (((op == 0 && dentry->d_inode->i_nlink == 0) ||
{
struct fsfilt_operations *fsops = I2CSB(inode)->sm_fsfilt;
int rc;
+ ENTRY;
+
rc = fsops->fs_set_xattr(inode, handle, XATTR_SMFS_CACHE_LOGCOOKIE,
logcookie, sizeof(*logcookie));
RETURN(rc);
}
+
static int get_lru_logcookie(struct inode *inode, struct llog_cookie *logcookie)
{
struct fsfilt_operations *fsops = I2CSB(inode)->sm_fsfilt;
int rc;
+
+ ENTRY;
rc = fsops->fs_get_xattr(inode, XATTR_SMFS_CACHE_LOGCOOKIE,
logcookie, sizeof(*logcookie));
RETURN(rc);
}
-static int try2purge_from_cache(struct ll_fid cfid, struct ll_fid pfid)
+static int try2purge_from_cache(struct lustre_id cid,
+ struct lustre_id pid)
{
struct inode *inode, *parent;
struct super_block *sb = cpq->cpq_sb;
- //struct llog_cookie logcookie;
__u32 hoard_priority = 0;
int rc = 0;
ENTRY;
- inode = iget(sb, cfid.id);
+ inode = iget(sb, cid.li_stc.u.e3s.l3s_ino);
if (IS_ERR(inode)) {
CERROR("not existent inode: "LPX64"/%u\n",
- cfid.id, cfid.generation);
+ cid.li_stc.u.e3s.l3s_ino,
+ cid.li_stc.u.e3s.l3s_gen);
RETURN(-ENOENT);
}
- parent = iget(sb, pfid.id);
+ parent = iget(sb, pid.li_stc.u.e3s.l3s_ino);
if (IS_ERR(parent)) {
CERROR("not existent inode: "LPX64"/%u\n",
- pfid.id, pfid.generation);
+ pid.li_stc.u.e3s.l3s_ino,
+ pid.li_stc.u.e3s.l3s_gen);
iput(inode);
RETURN(-ENOENT);
}
llr = (struct llog_lru_rec *)rec;
- if (try2purge_from_cache(llr->llr_cfid, llr->llr_pfid)==1){
+ if (try2purge_from_cache(llr->llr_cid, llr->llr_pid)==1){
CDEBUG(D_INODE, "purge ino/gen "LPX64"/%u from cache\n",
- llr->llr_cfid.id, llr->llr_cfid.generation);
+ llr->llr_cid.li_stc.u.e3s.l3s_ino,
+ llr->llr_cid.li_stc.u.e3s.l3s_gen);
count --;
if (count == 0)
rc = LLOG_PROC_BREAK;
}
#define CFLUSH_NR 512
+
static void check_cache_space(void)
{
int state = cache_balance_state();
ENTRY;
- if (state < 0)
+ if (state < 0) {
+ EXIT;
return;
+ }
wakeup_cpurge();
int count = CFLUSH_NR;
purge_some_cache(&count);
}
+ EXIT;
}
void cache_space_pre(struct inode *inode, int op)
/* FIXME have not used op */
check_cache_space();
+
+ EXIT;
}
static int cache_space_hook_lru(struct inode *inode, struct inode *parent,
- void *handle, int op, int flags)
+ void *handle, int op, int flags)
{
struct fsfilt_operations *fsops = S2SMI(cpq->cpq_sb)->sm_fsfilt;
struct llog_ctxt *ctxt = cpq->cpq_loghandle->lgh_ctxt;
llr->llr_hdr.lrh_len = llr->llr_tail.lrt_len = sizeof(*llr);
llr->llr_hdr.lrh_type = CACHE_LRU_REC;
- llr->llr_cfid.id = inode->i_ino;
- llr->llr_cfid.generation = inode->i_generation;
- llr->llr_cfid.f_type = inode->i_mode & S_IFMT;
- llr->llr_pfid.id = parent->i_ino;
- llr->llr_pfid.generation = parent->i_generation;
- llr->llr_pfid.f_type = parent->i_mode & S_IFMT;
+
+ /* FIXME-UMKA: should we setup fid components here? */
+ id_ino(&llr->llr_cid) = inode->i_ino;
+ id_gen(&llr->llr_cid) = inode->i_generation;
+ id_type(&llr->llr_cid) = inode->i_mode & S_IFMT;
+
+ id_ino(&llr->llr_pid) = parent->i_ino;
+ id_gen(&llr->llr_pid) = parent->i_generation;
+ id_type(&llr->llr_pid) = parent->i_mode & S_IFMT;
rc = llog_add(ctxt, &llr->llr_hdr, NULL, logcookie, 1,
NULL, NULL, NULL);
}
cpq->cpq_flags = SVC_STOPPED;
complete(&cpq->cpq_comp);
- return 0;
+ RETURN(0);
}
int cache_space_hook_setup(struct super_block *sb)
ctxt = cpq->cpq_loghandle->lgh_ctxt;
rc = llog_catalog_cleanup(ctxt);
OBD_FREE(ctxt, sizeof(*ctxt));
+
if (rc)
CERROR("failed to clean up cache lru list catalog %d\n", rc);
{
__u64 active_entry = 0;
int rc;
+ ENTRY;
LASSERT(cache_leaf_node(dentry, NULL));
rc = cache_space_hook_lru(dentry->d_inode, dir, handle,
rc = set_active_entry(dir, &active_entry, handle);
RETURN(rc);
}
+
static int cache_space_hook_lookup(void *handle, struct inode *dir,
struct dentry *dentry, struct inode *new_dir,
struct dentry *new_dentry)
{
__u64 active_entry;
int rc = 0;
+ ENTRY;
if (cache_leaf_node(dentry, &active_entry))
rc = cache_space_hook_lru(dentry->d_inode, dir, handle,
CACHE_SPACE_DELETE | CACHE_SPACE_INSERT,1);
RETURN(rc);
}
+
static int cache_space_hook_link(void *handle, struct inode *dir,
struct dentry *dentry, struct inode *new_dir,
struct dentry *new_dentry)
{
__u64 active_entry = 0;
int rc = 0;
+ ENTRY;
if (cache_pre_leaf_node(dentry, NULL, 1)) {
rc = cache_space_hook_lru(dentry->d_inode, NULL,
}
if (cache_leaf_node(dentry->d_parent, &active_entry)) {
- rc = cache_space_hook_lru(dir,NULL,handle,CACHE_SPACE_DELETE,0);
+ rc = cache_space_hook_lru(dir, NULL, handle, CACHE_SPACE_DELETE, 0);
if (rc)
RETURN(rc);
}
rc = set_active_entry(dir, &active_entry, handle);
RETURN(rc);
}
+
static int cache_space_hook_unlink(void *handle, struct inode *dir,
struct dentry *dentry, struct inode *new_dir,
struct dentry *new_dentry)
{
__u64 active_entry;
int rc = 0;
+ ENTRY;
if (cache_pre_leaf_node(dentry, NULL, 0))
rc = cache_space_hook_lru(dentry->d_inode, NULL,
handle, CACHE_SPACE_INSERT, 0);
RETURN(rc);
}
+
static int cache_space_hook_mkdir(void *handle, struct inode *dir,
struct dentry *dentry, struct inode *new_dir,
struct dentry *new_dentry)
{
__u64 active_entry;
int rc;
+ ENTRY;
LASSERT(cache_leaf_node(dentry, &active_entry));
rc = cache_space_hook_lru(dentry->d_inode, dir, handle,
- CACHE_SPACE_INSERT,0);
+ CACHE_SPACE_INSERT, 0);
if (!rc && cache_pre_leaf_node(dentry->d_parent, &active_entry, 3))
- rc = cache_space_hook_lru(dir,NULL,handle,CACHE_SPACE_DELETE,0);
+ rc = cache_space_hook_lru(dir, NULL, handle, CACHE_SPACE_DELETE, 0);
RETURN(rc);
}
+
static int cache_space_hook_rmdir(void *handle, struct inode *dir,
struct dentry *dentry, struct inode *new_dir,
struct dentry *new_dentry)
{
__u64 active_entry;
int rc;
+ ENTRY;
LASSERT(cache_pre_leaf_node(dentry, &active_entry, 2));
rc = cache_space_hook_lru(dentry->d_inode, NULL, handle,
handle, CACHE_SPACE_INSERT, 0);
RETURN(rc);
}
+
static int cache_space_hook_rename(void *handle, struct inode *old_dir,
- struct dentry *old_dentry, struct inode *new_dir,
- struct dentry *new_dentry)
+ struct dentry *old_dentry, struct inode *new_dir,
+ struct dentry *new_dentry)
{
__u64 active_entry;
int rc = 0;
+ ENTRY;
if (new_dentry->d_inode) {
if (cache_pre_leaf_node(new_dentry, NULL, 0))
active_entry --;
if (!rc)
rc = set_active_entry(old_dir, &active_entry, handle);
- } else if (cache_pre_leaf_node(new_dentry->d_parent, &active_entry, 3))
+ } else if (cache_pre_leaf_node(new_dentry->d_parent, &active_entry, 3)) {
rc = cache_space_hook_lru(new_dir, NULL, handle,
CACHE_SPACE_DELETE, 0);
+ }
- if (!rc && cache_leaf_node(old_dentry->d_parent, &active_entry))
+ if (!rc && cache_leaf_node(old_dentry->d_parent, &active_entry)) {
rc = cache_space_hook_lru(old_dir,
- old_dentry->d_parent->d_parent->d_inode,
- handle, CACHE_SPACE_INSERT, 0);
+ old_dentry->d_parent->d_parent->d_inode,
+ handle, CACHE_SPACE_INSERT, 0);
+ }
+
RETURN(rc);
}
};
int cache_space_post(int op, void *handle, struct inode *old_dir,
- struct dentry *old_dentry, struct inode *new_dir,
- struct dentry *new_dentry)
+ struct dentry *old_dentry, struct inode *new_dir,
+ struct dentry *new_dentry)
{
int rc = 0;
ENTRY;
RETURN(-ENOSPC);
lock_kernel();
- SMFS_HOOK(dir, dentry, NULL, NULL, HOOK_CREATE, handle, PRE_HOOK, rc,
- exit);
+ SMFS_HOOK(dir, dentry, NULL, NULL, HOOK_CREATE, handle,
+ PRE_HOOK, rc, exit);
+
cache_parent = pre_smfs_dentry(NULL, cache_dir, dentry);
cache_dentry = pre_smfs_dentry(cache_parent, NULL, dentry);
GOTO(exit, rc = -ENOMEM);
pre_smfs_inode(dir, cache_dir);
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
if (cache_dir && cache_dir->i_op->create)
rc = cache_dir->i_op->create(cache_dir, cache_dentry,
if (rc)
GOTO(exit, rc);
- SMFS_GET_INODE(dir->i_sb, cache_dentry->d_inode, dir, inode, rc, exit);
+ SMFS_GET_INODE(dir->i_sb, cache_dentry->d_inode, dir, inode,
+ rc, exit);
d_instantiate(dentry, inode);
post_smfs_inode(dir, cache_dir);
- SMFS_HOOK(dir, dentry, NULL, NULL, HOOK_CREATE, handle, POST_HOOK, rc,
- exit);
+ SMFS_HOOK(dir, dentry, NULL, NULL, HOOK_CREATE, handle,
+ POST_HOOK, rc, exit);
exit:
unlock_kernel();
post_smfs_dentry(cache_dentry);
RETURN(rc);
}
-static int smfs_link(struct dentry * old_dentry,
- struct inode * dir, struct dentry *dentry)
+static int smfs_link(struct dentry *old_dentry,
+ struct inode *dir, struct dentry *dentry)
{
- struct inode *cache_old_inode = NULL;
- struct inode *cache_dir = I2CI(dir);
- struct inode *inode = NULL;
- struct dentry *cache_dentry = NULL;
- struct dentry *cache_old_dentry = NULL;
- struct dentry *cache_parent = NULL;
- void *handle = NULL;
- int rc = 0;
+ struct inode *cache_old_inode = NULL;
+ struct inode *cache_dir = I2CI(dir);
+ struct inode *inode = NULL;
+ struct dentry *cache_dentry = NULL;
+ struct dentry *cache_old_dentry = NULL;
+ struct dentry *cache_parent = NULL;
+ void *handle = NULL;
+ int rc = 0;
inode = old_dentry->d_inode;
-
cache_old_inode = I2CI(inode);
handle = smfs_trans_start(dir, FSFILT_OP_LINK, NULL);
RETURN(-ENOSPC);
lock_kernel();
- SMFS_HOOK(dir, old_dentry, NULL, NULL, HOOK_LINK, handle, PRE_HOOK, rc,
- exit);
+ SMFS_HOOK(dir, old_dentry, NULL, NULL, HOOK_LINK, handle,
+ PRE_HOOK, rc, exit);
cache_parent = pre_smfs_dentry(NULL, cache_dir, dentry);
cache_dentry = pre_smfs_dentry(cache_parent, NULL, dentry);
if (!cache_parent || !cache_dentry)
GOTO(exit, rc = -ENOMEM);
- cache_old_dentry = pre_smfs_dentry(NULL, cache_old_inode, old_dentry);
+ cache_old_dentry = pre_smfs_dentry(NULL, cache_old_inode,
+ old_dentry);
if (!cache_old_dentry)
GOTO(exit, rc = -ENOMEM);
d_instantiate(dentry, inode);
post_smfs_inode(dir, cache_dir);
- SMFS_HOOK(dir, old_dentry, dentry, NULL, HOOK_LINK, handle, POST_HOOK,
- rc, exit);
+ SMFS_HOOK(dir, old_dentry, dentry, NULL, HOOK_LINK, handle,
+ POST_HOOK, rc, exit);
exit:
unlock_kernel();
post_smfs_dentry(cache_dentry);
RETURN(rc);
}
-static int smfs_rename(struct inode * old_dir, struct dentry *old_dentry,
- struct inode * new_dir,struct dentry *new_dentry)
+static int smfs_rename(struct inode *old_dir, struct dentry *old_dentry,
+ struct inode *new_dir,struct dentry *new_dentry)
{
struct inode *cache_old_dir = I2CI(old_dir);
struct inode *cache_new_dir = I2CI(new_dir);
lock_kernel();
- SMFS_HOOK(old_dir, old_dentry, new_dir, new_dentry, HOOK_RENAME, handle,
- PRE_HOOK, rc, exit);
+ SMFS_HOOK(old_dir, old_dentry, new_dir, new_dentry, HOOK_RENAME,
+ handle, PRE_HOOK, rc, exit);
cache_old_parent = pre_smfs_dentry(NULL, cache_old_dir, old_dentry);
+
cache_old_dentry = pre_smfs_dentry(cache_old_parent, cache_old_inode,
old_dentry);
+
if (!cache_old_parent || !cache_old_dentry)
GOTO(exit, rc = -ENOMEM);
cache_new_parent = pre_smfs_dentry(NULL, cache_new_dir, new_dentry);
+
cache_new_dentry = pre_smfs_dentry(cache_new_parent, cache_new_inode,
new_dentry);
+
if (!cache_new_parent || !cache_new_dentry)
GOTO(exit, rc = -ENOMEM);
}
struct file_operations smfs_dir_fops = {
- read: smfs_read_dir,
- readdir: smfs_readdir, /* BKL held */
- ioctl: smfs_ioctl, /* BKL held */
- fsync: smfs_fsync, /* BKL held */
- open: smfs_open,
- release: smfs_release,
+ .read = smfs_read_dir,
+ .readdir = smfs_readdir, /* BKL held */
+ .ioctl = smfs_ioctl, /* BKL held */
+ .fsync = smfs_fsync, /* BKL held */
+ .open = smfs_open,
+ .release = smfs_release,
};
}
struct inode_operations smfs_file_iops = {
- truncate: smfs_truncate, /* BKL held */
- setattr: smfs_setattr, /* BKL held */
- setxattr: smfs_setxattr, /* BKL held */
- getxattr: smfs_getxattr, /* BKL held */
- listxattr: smfs_listxattr, /* BKL held */
- removexattr: smfs_removexattr, /* BKL held */
+ .truncate = smfs_truncate, /* BKL held */
+ .setattr = smfs_setattr, /* BKL held */
+ .setxattr = smfs_setxattr, /* BKL held */
+ .getxattr = smfs_getxattr, /* BKL held */
+ .listxattr = smfs_listxattr, /* BKL held */
+ .removexattr = smfs_removexattr, /* BKL held */
};
#include <linux/lustre_smfs.h>
#include "smfs_internal.h"
-static void smfs_init_inode_info (struct inode *inode, void *opaque)
+static void smfs_init_inode_info(struct inode *inode, void *opaque)
{
- struct smfs_iget_args *sargs = (struct smfs_iget_args*)opaque;
- struct inode *cache_inode = NULL;
+ if (!I2SMI(inode)) {
+ struct inode *cache_inode = NULL;
+ struct smfs_iget_args *sargs;
+ unsigned long ino;
+
+ sargs = (struct smfs_iget_args *)opaque;
+
+ /* getting backing fs inode. */
+ ino = sargs ? sargs->s_ino : inode->i_ino;
+ cache_inode = iget(S2CSB(inode->i_sb), ino);
+
+ OBD_ALLOC(inode->u.generic_ip,
+ sizeof(struct smfs_inode_info));
- if (sargs)
- cache_inode = iget(S2CSB(inode->i_sb), sargs->s_ino);
- else
- cache_inode = iget(S2CSB(inode->i_sb), inode->i_ino);
-
- OBD_ALLOC(I2SMI(inode), sizeof(struct smfs_inode_info));
- LASSERT(I2SMI(inode));
- I2CI(inode) = cache_inode;
- CDEBUG(D_INODE, "cache_inode i_count ino %lu i_count %d\n",
- cache_inode->i_ino, atomic_read(&cache_inode->i_count));
- post_smfs_inode(inode, cache_inode);
- sm_set_inode_ops(cache_inode, inode);
- if (sargs) {
- struct inode *dir = sargs->s_inode;
- if (dir)
- I2SMI(inode)->smi_flags = I2SMI(dir)->smi_flags;
+ LASSERT(inode->u.generic_ip);
+ I2CI(inode) = cache_inode;
+
+ CDEBUG(D_INODE, "cache_inode i_count ino %lu i_count %d\n",
+ cache_inode->i_ino, atomic_read(&cache_inode->i_count));
+
+ post_smfs_inode(inode, cache_inode);
+ sm_set_inode_ops(cache_inode, inode);
+
+ if (sargs) {
+ struct inode *dir = sargs->s_inode;
+ if (dir)
+ I2SMI(inode)->smi_flags = I2SMI(dir)->smi_flags;
+ }
}
}
{
if (I2SMI(inode)) {
struct inode *cache_inode = I2CI(inode);
+
LASSERTF(((atomic_read(&cache_inode->i_count) == 1) ||
- cache_inode == cache_inode->i_sb->s_root->d_inode),
+ cache_inode == cache_inode->i_sb->s_root->d_inode),
"inode %p cache inode %p %lu i_count %d != 0 \n",
- inode, cache_inode, cache_inode->i_ino,
- atomic_read(&cache_inode->i_count));
+ inode, cache_inode, cache_inode->i_ino,
+ atomic_read(&cache_inode->i_count));
+
if (cache_inode != cache_inode->i_sb->s_root->d_inode)
iput(cache_inode);
- OBD_FREE(I2SMI(inode), sizeof(struct smfs_inode_info));
- I2SMI(inode) = NULL;
+
+ OBD_FREE(inode->u.generic_ip,
+ sizeof(struct smfs_inode_info));
+ inode->u.generic_ip = NULL;
}
}
{
ENTRY;
- if (!inode)
+ if (!inode) {
+ EXIT;
return;
+ }
CDEBUG(D_INODE, "read_inode ino %lu\n", inode->i_ino);
smfs_init_inode_info(inode, opaque);
CDEBUG(D_INODE, "read_inode ino %lu icount %d \n",
inode->i_ino, atomic_read(&inode->i_count));
EXIT;
- return;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
static int smfs_test_inode(struct inode *inode, unsigned long ino,
- void *opaque)
+ void *opaque)
#else
static int smfs_test_inode(struct inode *inode, void *opaque)
#endif
struct smfs_iget_args *sargs = (struct smfs_iget_args*)opaque;
LASSERT(sargs);
+
if (!sargs)
return 1;
if (inode->i_ino != sargs->s_ino)
- return 0;
-#ifdef CONFIG_SNAPFS
+ return 0;
+
+#ifdef CONFIG_SNAPFS
if (SMFS_DO_COW(S2SMI(inode->i_sb)) &&
!smfs_snap_test_inode(inode, opaque))
return 0;
-#endif
+#endif
if (I2SMI(inode)) {
struct inode *cache_inode = I2CI(inode);
-
+
+ /* this is needed to make symatry between smfs_put_inode(). */
+ LASSERT(cache_inode != NULL);
+ igrab(cache_inode);
+
LASSERTF(cache_inode->i_ino == inode->i_ino,
"inode ino %lu != cache ino %lu",
cache_inode->i_ino, inode->i_ino);
+ } else {
+ smfs_init_inode_info(inode, opaque);
}
- if (!I2SMI(inode))
- smfs_init_inode_info(inode, opaque);
+
return 1;
}
struct smfs_iget_args *sargs)
{
struct inode *inode;
-
LASSERT(hash != 0);
- inode = iget5_locked(sb, hash, smfs_test_inode, smfs_set_inode, sargs);
+ inode = iget5_locked(sb, hash, smfs_test_inode,
+ smfs_set_inode, sargs);
if (inode) {
if (inode->i_state & I_NEW)
unlock_new_inode(inode);
- CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p) index %d ino %lu \n",
- inode->i_ino, inode->i_generation, inode, sargs->s_index,
- sargs->s_ino);
+ CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p) index %d "
+ "ino %lu \n", inode->i_ino, inode->i_generation,
+ inode, sargs->s_index, sargs->s_ino);
inode->i_ino = hash;
}
return inode;
LASSERT(hash != 0);
inode = iget4(sb, hash, smfs_test_inode, sargs);
-
if (inode) {
struct inode *cache_inode = I2CI(inode);
-
LASSERTF((inode->i_ino == cache_inode->i_ino),
"inode %p ino %lu != cache inode %p ino %lu",
inode, inode->i_ino, cache_inode, cache_inode->i_ino);
return inode;
}
#endif
-struct inode *smfs_get_inode (struct super_block *sb, ino_t hash,
- struct inode *dir, int index)
+
+struct inode *smfs_get_inode(struct super_block *sb, ino_t hash,
+ struct inode *dir, int index)
{
+ struct smfs_iget_args sargs;
struct inode *inode;
- struct smfs_iget_args sargs;
ENTRY;
- sargs.s_index = index;
- sargs.s_inode = dir;
sargs.s_ino = hash;
+ sargs.s_inode = dir;
+ sargs.s_index = index;
inode = smfs_iget(sb, hash, &sargs);
-
+
RETURN(inode);
}
static void smfs_delete_inode(struct inode *inode)
{
- struct inode *cache_inode;
-
ENTRY;
- if (I2SMI(inode)) {
- cache_inode = I2CI(inode);
- if (!cache_inode || !S2CSB(inode->i_sb))
- return;
- post_smfs_inode(inode, cache_inode);
- smfs_clear_inode_info(inode);
- }
- inode->i_state = I_CLEAR;
- return;
+ clear_inode(inode);
+ EXIT;
}
static void smfs_write_inode(struct inode *inode, int wait)
{
struct inode *cache_inode;
-
ENTRY;
+
cache_inode = I2CI(inode);
+ LASSERT(cache_inode != NULL);
- if (!cache_inode) {
- CWARN("cache inode null\n");
- return;
- }
pre_smfs_inode(inode, cache_inode);
if (S2CSB(inode->i_sb)->s_op->write_inode)
S2CSB(inode->i_sb)->s_op->write_inode(cache_inode, wait);
static void smfs_dirty_inode(struct inode *inode)
{
struct inode *cache_inode;
-
ENTRY;
- cache_inode = I2CI(inode);
- if (!cache_inode || !S2CSB(inode->i_sb))
+ cache_inode = I2CI(inode);
+ if (!cache_inode || !S2CSB(inode->i_sb)) {
+ EXIT;
return;
+ }
pre_smfs_inode(inode, cache_inode);
if (S2CSB(inode->i_sb)->s_op->dirty_inode)
static void smfs_put_inode(struct inode *inode)
{
struct inode *cache_inode;
-
ENTRY;
+
cache_inode = I2CI(inode);
+ LASSERT(cache_inode != NULL);
- if (!cache_inode) {
- CWARN("cache inode null\n");
- return;
- }
-
- if (atomic_read(&cache_inode->i_count) > 1) {
+ if (atomic_read(&cache_inode->i_count) > 1)
iput(cache_inode);
- }
-
- if (S2CSB(inode->i_sb)->s_op->put_inode)
- S2CSB(inode->i_sb)->s_op->put_inode(cache_inode);
-
- if (atomic_read(&inode->i_count) == 0 &&
+
+ /*
+ * check if we have to release backend inode. As iput() calls fs
+ * specific ->put_inode() first and than decrements inode rerfcount, we
+ * should check here ->i_count for 1, not for 0.
+
+ * In principle we could rely on ->clear_inode(), but it will be called
+ * later, and thus we will have iputing of @inode and @cache_inode in
+ * different control paths, this is why we do it here. --umka
+ */
+ if (atomic_read(&inode->i_count) == 1 &&
cache_inode->i_sb->s_root->d_inode != cache_inode)
smfs_clear_inode_info(inode);
EXIT;
}
-static void smfs_write_super(struct super_block *sb)
+static void smfs_clear_inode(struct inode *inode)
{
ENTRY;
-
- if (!S2CSB(sb))
- return;
-
- if (S2CSB(sb)->s_op->write_super)
- S2CSB(sb)->s_op->write_super(S2CSB(sb));
- duplicate_sb(sb, S2CSB(sb));
+ smfs_clear_inode_info(inode);
EXIT;
- return;
}
-static void smfs_clear_inode(struct inode *inode)
+static void smfs_write_super(struct super_block *sb)
{
- struct inode *cache_inode;
-
ENTRY;
- if (!inode) return;
-
- cache_inode = I2CI(inode);
+ if (!S2CSB(sb)) {
+ EXIT;
+ return;
+ }
- smfs_clear_inode_info(inode);
-
+ if (S2CSB(sb)->s_op->write_super)
+ S2CSB(sb)->s_op->write_super(S2CSB(sb));
+ duplicate_sb(sb, S2CSB(sb));
EXIT;
- return;
}
static void smfs_write_super_lockfs(struct super_block *sb)
ENTRY;
cache_sb = S2CSB(sb);
- if (!cache_sb)
+ if (!cache_sb) {
+ EXIT;
return;
+ }
if (cache_sb->s_op->write_super_lockfs)
cache_sb->s_op->write_super_lockfs(cache_sb);
ENTRY;
cache_sb = S2CSB(sb);
- if (!cache_sb)
+ if (!cache_sb) {
+ EXIT;
return;
+ }
if (cache_sb->s_op->unlockfs)
cache_sb->s_op->unlockfs(cache_sb);
rc = cache_sb->s_op->statfs(cache_sb, buf);
duplicate_sb(sb, cache_sb);
-
RETURN(rc);
}
static int smfs_remount(struct super_block *sb, int *flags, char *data)
duplicate_sb(sb, cache_sb);
RETURN(rc);
}
+
struct super_operations smfs_super_ops = {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
.read_inode2 = smfs_read_inode2,
.open = smfs_psdev_open, /* open */
.release = smfs_psdev_release, /* release */
};
+
static struct miscdevice smfscontrol_dev = {
- minor: SMFS_MINOR,
- name: "smfscontrol",
- fops: &smfscontrol_fops
+ .minor = SMFS_MINOR,
+ .name = "smfscontrol",
+ .fops = &smfscontrol_fops
};
int init_smfs_psdev(void)
static smfs_pack_rec_func smfs_get_rec_pack_type(struct super_block *sb)
{
+ int idx = 0;
struct smfs_super_info *smsi = S2SMI(sb);
- int index = GET_REC_PACK_TYPE_INDEX(smsi->smsi_flags);
-
- return smsi->smsi_pack_rec[index];
+ idx = GET_REC_PACK_TYPE_INDEX(smsi->smsi_flags);
+ return smsi->smsi_pack_rec[idx];
}
static int smfs_post_kml_rec(struct inode *dir, void *de, void *data1,
}
#define KML_HOOK "kml_hook"
+
int smfs_rec_init(struct super_block *sb)
{
+ int rc = 0;
struct smfs_super_info *smfs_info = S2SMI(sb);
struct smfs_hook_ops *rec_hops = NULL;
- int rc = 0;
+ ENTRY;
SMFS_SET_REC(smfs_info);
- ost_rec_pack_init(smfs_info);
- mds_rec_pack_init(smfs_info);
+ rc = ost_rec_pack_init(smfs_info);
+ if (rc)
+ return rc;
+
+ rc = mds_rec_pack_init(smfs_info);
+ if (rc)
+ return rc;
rec_hops = smfs_alloc_hook_ops(KML_HOOK, NULL, smfs_rec_post_hook);
if (!rec_hops) {
{
struct smfs_hook_ops *rec_hops;
int rc = 0;
+ ENTRY;
rec_hops = smfs_unregister_hook_ops(smfs_info, KML_HOOK);
smfs_free_hook_ops(rec_hops);
RETURN(rc);
}
-static inline void copy_inode_attr(struct iattr *iattr, struct inode *inode)
+static inline void
+copy_inode_attr(struct iattr *iattr, struct inode *inode)
{
iattr->ia_mode = inode->i_mode;
iattr->ia_uid = inode->i_uid;
{
int args_len = 0;
int rc = 0;
+ ENTRY;
if (args_data)
args_len = strlen(args_data);
OBD_ALLOC(*p_buffer, *size + args_len + 1);
if (!*p_buffer)
RETURN(-ENOMEM);
- /*First copy reint dir */
+
+ /* first copy reint dir. */
if (args_data)
memcpy(*p_buffer, args_data, args_len);
- /*then copy the node name */
+ /* then copy the node name. */
memcpy(*p_buffer + args_len,
(in_data + sizeof(int)), *size);
{
int offset = *(int *)(record);
char *tmp = record + offset + sizeof(int);
- int rc = 0;
+
*opcode = *(int *)tmp;
*pbuf = tmp + sizeof(*opcode);
- RETURN(rc);
+ return 0;
}
EXPORT_SYMBOL(smfs_rec_unpack);
{
struct lvfs_run_ctxt *current_ctxt = NULL;
struct smfs_super_info *smb = S2SMI(sb);
+ ENTRY;
OBD_ALLOC(current_ctxt, sizeof(*current_ctxt));
if (!current_ctxt)
int smfs_post_cleanup(struct super_block *sb)
{
struct smfs_super_info *smb = S2SMI(sb);
-
ENTRY;
if (smb->smsi_ctxt)
int smfs_stop_rec(struct super_block *sb)
{
int rc = 0;
+ ENTRY;
if (!SMFS_INIT_REC(S2SMI(sb)) ||
(!SMFS_DO_REC(S2SMI(sb)) && !SMFS_CACHE_HOOK(S2SMI(sb))))
}
EXPORT_SYMBOL(smfs_rec_setattr);
-int smfs_rec_md(struct inode *inode, void * lmm, int lmm_size)
+int smfs_rec_md(struct inode *inode, void *lmm, int lmm_size)
{
char *set_lmm = NULL;
int rc = 0;
}
if (set_lmm)
OBD_FREE(set_lmm, lmm_size + sizeof(lmm_size));
- return rc;
+ RETURN(rc);
}
EXPORT_SYMBOL(smfs_rec_md);
struct llog_handle *loghandle;
struct smfs_proc_args args;
int rc = 0;
+ ENTRY;
if (!SMFS_INIT_REC(S2SMI(sb))) {
CWARN("Did not start up rec server \n");
if (SMFS_DO_REINT_REC(flags)) {
struct llog_gen_rec *lgr;
- /*For reint rec, we need insert
- *a gen rec to identify the end
- *of the rec.*/
+ /* for reint rec, we need insert a gen rec to identify
+ * the end of the rec.*/
OBD_ALLOC(lgr, sizeof(*lgr));
if (!lgr)
RETURN(-ENOMEM);
char *p_name = buffer + sizeof(int);
char *name = NULL;
int namelen = 0;
+ ENTRY;
+
if (dentry) {
name = smfs_path(dentry, root, p_name, buffer_len - sizeof(int));
namelen = cpu_to_le32(strlen(p_name));
void *data2, int op)
{
smfs_pack_rec_func pack_func;
- int rc;
pack_func = smfs_get_rec_pack_type(dir->i_sb);
- if (!pack_func) {
- return (0);
- }
- rc = pack_func(buffer, dentry, dir, data1, data2, op);
- return rc;
+ if (!pack_func)
+ return 0;
+ return pack_func(buffer, dentry, dir, data1, data2, op);
}
-int smfs_post_rec_create(struct inode *dir, struct dentry *dentry, void *data1,
- void *data2)
+int smfs_post_rec_create(struct inode *dir, struct dentry *dentry,
+ void *data1, void *data2)
{
struct smfs_super_info *sinfo;
char *buffer = NULL, *pbuf;
int rc = 0, length = 0, buf_len = 0;
+ ENTRY;
sinfo = S2SMI(dentry->d_inode->i_sb);
if (!sinfo)
static int smfs_post_rec_link(struct inode *dir, struct dentry *dentry,
void *data1, void *data2)
{
- struct smfs_super_info *sinfo;
- struct dentry *old_dentry = (struct dentry *)data1;
- char *buffer = NULL, *pbuf = NULL;
+ struct dentry *new_dentry = (struct dentry *)data1;
int rc = 0, length = 0, buf_len = 0;
+ char *buffer = NULL, *pbuf = NULL;
+ struct smfs_super_info *sinfo;
+ ENTRY;
sinfo = S2SMI(dir->i_sb);
if (!sinfo)
buf_len = PAGE_SIZE;
KML_BUF_REC_INIT(buffer, pbuf, buf_len);
+
rc = smfs_log_path(dir->i_sb, dentry, pbuf, buf_len);
if (rc < 0)
GOTO(exit, rc);
length = rc;
KML_BUF_REC_END(buffer, length, pbuf);
- rc = smfs_pack_rec(pbuf, dentry, dir, dentry->d_parent,
- old_dentry->d_parent, REINT_LINK);
+ rc = smfs_pack_rec(pbuf, dentry, dir, dentry,
+ new_dentry, REINT_LINK);
if (rc <= 0)
GOTO(exit, rc);
- else
- length += rc;
- rc = smfs_llog_add_rec(sinfo, (void*)buffer, length);
+
+ length += rc;
+ rc = smfs_llog_add_rec(sinfo, (void *)buffer, length);
exit:
if (buffer)
OBD_FREE(buffer, PAGE_SIZE);
int mode = *((int*)data1);
char *buffer = NULL, *pbuf = NULL;
int length = 0, rc = 0, buf_len = 0;
+ ENTRY;
sinfo = S2SMI(dentry->d_inode->i_sb);
if (!sinfo)
struct dentry *new_dentry = (struct dentry *)data2;
char *buffer = NULL, *pbuf = NULL;
int rc = 0, length = 0, buf_len = 0;
+ ENTRY;
sinfo = S2SMI(dir->i_sb);
if (!sinfo)
pbuf += rc;
length += rc;
- buf_len -= rc;
- /*record new_dentry path*/
+ buf_len -= rc;
+
+ /* record new_dentry path. */
rc = smfs_log_path(dir->i_sb, new_dentry, pbuf, buf_len);
if (rc < 0)
GOTO(exit, rc);
{
struct fsfilt_operations *fsfilt = S2SMI(inode->i_sb)->sm_fsfilt;
int rc = 0;
+ ENTRY;
if (SMFS_INODE_OVER_WRITE(inode))
RETURN(rc);
{
struct fsfilt_operations *fsfilt = S2SMI(inode->i_sb)->sm_fsfilt;
int rc = 0;
+ ENTRY;
rc = fsfilt->fs_remove_extents_ea(inode, OFF2BLKS(from, inode),
SIZE2BLKS(num, inode));
{
struct fsfilt_operations *fsfilt = S2SMI(inode->i_sb)->sm_fsfilt;
int rc = 0;
+ ENTRY;
rc = fsfilt->fs_remove_extents_ea(inode, 0, 0xffffffff);
RETURN(rc);
{
struct fsfilt_operations *fsfilt = S2SMI(inode->i_sb)->sm_fsfilt;
int rc = 0;
+ ENTRY;
rc = fsfilt->fs_init_extents_ea(inode);
struct fsfilt_operations *fsfilt = S2SMI(inode->i_sb)->sm_fsfilt;
void *handle;
int rc = 0;
+ ENTRY;
if (SMFS_INODE_OVER_WRITE(inode))
RETURN(rc);
struct iattr *attr = (struct iattr *)data1;
char *buffer = NULL, *pbuf;
int rc = 0, length = 0, buf_len = 0;
+ ENTRY;
sinfo = S2SMI(inode->i_sb);
if (!sinfo)
static int all_blocks_present_ea(struct inode *inode)
{
int rc = 0;
-
+ ENTRY;
RETURN(rc);
}
+
int smfs_post_rec_write(struct inode *dir, struct dentry *dentry, void *data1,
void *data2)
{
struct smfs_super_info *sinfo;
char *buffer = NULL, *pbuf;
int rc = 0, length = 0, buf_len = 0;
+ ENTRY;
if (!SMFS_INODE_OVER_WRITE(dentry->d_inode) &&
!SMFS_INODE_DIRTY_WRITE(dentry->d_inode)) {
{
if (smfs_kml_post[op]) {
struct dentry *dentry = (struct dentry *)de;
-
return smfs_kml_post[op](dir, dentry, data1, data2);
}
return 0;
static int mds_rec_link_pack(char *buffer, struct dentry *dentry,
struct inode *dir, void *data1, void *data2)
{
- struct mdc_op_data op_data;
+ struct dentry *src = (struct dentry *)data1;
+ struct dentry *tgt = (struct dentry *)data2;
struct mds_kml_pack_info *mkpi;
- struct dentry *tgt = (struct dentry *)data1;
- struct dentry *src = (struct dentry *)data2;
- void *tmp = NULL;
struct lustre_msg *msg = NULL;
- int rc = 0;
+ struct mdc_op_data op_data;
+ void *tmp = NULL;
+ int rc = 0;
- ll_prepare_mdc_op_data(&op_data, src->d_inode, dir, tgt->d_name.name,
- tgt->d_name.len, 0);
+ mdc_prepare_mdc_data(&op_data, src->d_inode, dir,
+ tgt->d_name.name, tgt->d_name.len, 0);
PACK_KML_REC_INIT(buffer, MDS_REINT);
-
- mkpi = (struct mds_kml_pack_info*)buffer;
+ mkpi = (struct mds_kml_pack_info *)buffer;
mkpi->mpi_bufcount = 2;
mkpi->mpi_size[0] = sizeof(struct mds_rec_link);
mkpi->mpi_size[1] = op_data.namelen + 1;
- /*the mds reint log format
- *opcode + mkpi + request
- */
+ /* the mds reint log format is: opcode + mkpi + request */
msg = (struct lustre_msg *)(buffer + sizeof(*mkpi));
lustre_init_msg(msg, mkpi->mpi_bufcount, mkpi->mpi_size, NULL);
tmp = mdc_link_pack(msg, 0, &op_data);
- mkpi->mpi_total_size = tmp - (void*)msg;
+ mkpi->mpi_total_size = tmp - (void *)msg;
rc = mkpi->mpi_total_size + sizeof(*mkpi) + sizeof(int);
return rc;
}
+/* FIXME-WANGDI: did not think about EA situation. */
static int mds_rec_setattr_pack(char *buffer, struct dentry *dentry,
struct inode *dir, void *data1, void *data2)
{
+ struct iattr *iattr = (struct iattr *)data1;
struct mds_rec_setattr *rec = NULL;
- struct mdc_op_data op_data;
struct mds_kml_pack_info *mkpi;
- struct iattr *iattr = (struct iattr *)data1;
struct lustre_msg *msg = NULL;
- char *ea = NULL;
- void *tmp = NULL;
- int rc = 0, ealen = 0;
+ struct mdc_op_data op_data;
+ int rc = 0, ealen = 0;
+ char *ea = NULL;
+ void *tmp = NULL;
- ll_prepare_mdc_op_data(&op_data, dir, NULL, NULL, 0, 0);
+ mdc_prepare_mdc_data(&op_data, dir, NULL, NULL, 0, 0);
PACK_KML_REC_INIT(buffer, MDS_REINT);
-
mkpi = (struct mds_kml_pack_info*)buffer;
- /*FIXME later, did not think about EA situation*/
-
mkpi->mpi_bufcount = 1;
mkpi->mpi_size[0] = sizeof(struct mds_rec_setattr);
if (data2) {
- mkpi->mpi_bufcount ++;
+ mkpi->mpi_bufcount++;
mkpi->mpi_size[1] = *(int *)data2;
ealen = *(int *)data2;
ea = data2 + sizeof(ealen);
tmp = mdc_setattr_pack(msg, 0, &op_data, iattr, ea, ealen, NULL, 0);
- /*There are maybe some better ways
- *to set the time attr FIXME WANGDI later
- */
+ /* FIXME-WANGDI: there are maybe some better ways to set the time
+ * attr. */
rec = (struct mds_rec_setattr *)lustre_msg_buf(msg, 0, 0);
if (rec->sa_valid & ATTR_CTIME)
rec->sa_valid |= ATTR_CTIME_SET;
if (rec->sa_valid & ATTR_ATIME)
rec->sa_valid |= ATTR_ATIME_SET;
- mkpi->mpi_total_size = tmp - (void*)msg;
+ mkpi->mpi_total_size = tmp - (void *)msg;
rc = mkpi->mpi_total_size + sizeof(*mkpi) + sizeof(int);
return rc;
}
static int mds_rec_create_pack(char *buffer, struct dentry *dentry,
- struct inode *dir, void *data1, void *data2)
+ struct inode *dir, void *data1,
+ void *data2)
{
+ struct mds_kml_pack_info *mkpi;
struct lustre_msg *msg = NULL;
struct mdc_op_data op_data;
struct mds_rec_create *rec;
- struct mds_kml_pack_info *mkpi;
- void *tmp = NULL;
- int rc = 0, tgt_len = 0;
+ int rc = 0, tgt_len = 0;
+ void *tmp = NULL;
+
+ mdc_prepare_mdc_data(&op_data, dir, dentry->d_inode,
+ dentry->d_name.name, dentry->d_name.len, 0);
- ll_prepare_mdc_op_data(&op_data, dir, dentry->d_inode,
- dentry->d_name.name, dentry->d_name.len, 0);
PACK_KML_REC_INIT(buffer, MDS_REINT);
+ mkpi = (struct mds_kml_pack_info *)buffer;
- mkpi = (struct mds_kml_pack_info*)buffer;
mkpi->mpi_bufcount = 2;
mkpi->mpi_size[0] = sizeof(struct mds_rec_create);
mkpi->mpi_size[1] = op_data.namelen + 1;
+
if (data1 && data2) {
mkpi->mpi_size[2] = *(int *)data2;
mkpi->mpi_bufcount++;
}
if (data1) {
- /*for symlink, data1 will be the tgt name */
- tgt_len = *(int*)data2;
+ /* for symlink, data1 will be the tgt name. */
+ tgt_len = *(int *)data2;
}
msg = (struct lustre_msg *)(buffer + sizeof(*mkpi));
lustre_init_msg(msg, mkpi->mpi_bufcount, mkpi->mpi_size, NULL);
dentry->d_inode->i_mode, data1, tgt_len);
rec = (struct mds_rec_create *)lustre_msg_buf(msg, 0, 0);
-
- rec->cr_replayfid = op_data.fid2;
+ rec->cr_replayid = op_data.id2;
rec->cr_flags |= REC_REINT_CREATE;
- mkpi->mpi_total_size = tmp - (void*)msg;
+ mkpi->mpi_total_size = tmp - (void *)msg;
rc = mkpi->mpi_total_size + sizeof(*mkpi) + sizeof(int);
return rc;
}
static int mds_rec_unlink_pack(char *buffer, struct dentry *dentry,
- struct inode *dir, void *data1, void *data2)
+ struct inode *dir, void *data1,
+ void *data2)
{
struct lustre_msg *msg = NULL;
- struct mdc_op_data op_data;
struct mds_kml_pack_info *mkpi;
- int mode = *(int*)data1;
- void *tmp = NULL;
- int rc = 0;
+ struct mdc_op_data op_data;
+ int mode = *(int*)data1;
+ void *tmp = NULL;
+ int rc = 0;
- ll_prepare_mdc_op_data(&op_data, dir, NULL, dentry->d_name.name,
- dentry->d_name.len, mode);
+ mdc_prepare_mdc_data(&op_data, dir, NULL,
+ dentry->d_name.name,
+ dentry->d_name.len, mode);
PACK_KML_REC_INIT(buffer, MDS_REINT);
-
mkpi = (struct mds_kml_pack_info*)buffer;
+
mkpi->mpi_bufcount = 2;
mkpi->mpi_size[0] = sizeof(struct mds_rec_unlink);
mkpi->mpi_size[1] = op_data.namelen + 1;
static int mds_rec_rename_pack(char *buffer, struct dentry *dentry,
struct inode *dir, void *data1, void *data2)
{
- struct lustre_msg *msg = NULL;
- struct dentry *new_dir = (struct dentry *)data1;
struct dentry *new_dentry = (struct dentry *)data2;
- struct mdc_op_data op_data;
+ struct inode *new_dir = (struct inode *)data1;
struct mds_kml_pack_info *mkpi;
+ struct lustre_msg *msg = NULL;
+ struct mdc_op_data op_data;
struct mds_rec_rename *rec;
- void *tmp = NULL;
- int rc = 0;
+ void *tmp = NULL;
+ int rc = 0;
- ll_prepare_mdc_op_data(&op_data, dir, new_dir->d_inode, NULL, 0, 0);
+ mdc_prepare_mdc_data(&op_data, dir, new_dir, NULL, 0, 0);
PACK_KML_REC_INIT(buffer, MDS_REINT);
-
mkpi = (struct mds_kml_pack_info*)buffer;
+
mkpi->mpi_bufcount = 3;
mkpi->mpi_size[0] = sizeof(struct mds_rec_rename);
mkpi->mpi_size[1] = dentry->d_name.len + 1;
rec = (struct mds_rec_rename *)(buffer + sizeof(*mkpi));
+
msg = (struct lustre_msg *)(buffer + sizeof(*mkpi));
lustre_init_msg(msg, mkpi->mpi_bufcount, mkpi->mpi_size, NULL);
typedef int (*mds_pack_rec_func)(char *buffer, struct dentry *dentry,
struct inode *dir, void *data1, void *data2);
+
static mds_pack_rec_func mds_kml_pack[REINT_MAX + 1] = {
[REINT_LINK] mds_rec_link_pack,
[REINT_SETATTR] mds_rec_setattr_pack,
{
smsi->smsi_pack_rec[PACK_MDS] = mds_rec_pack;
-
return 0;
}
return -EINVAL;
return 0;
}
+
/* Group 0 is no longer a legal group, to catch uninitialized IDs */
#define FILTER_MIN_GROUPS 3
static int smfs_ost_get_group(struct dentry *dentry, struct obdo *oa)
out:
RETURN(rc);
}
+
typedef int (*ost_pack_rec_func)(char *buffer, struct dentry *dentry,
struct inode *dir, void *data1, void *data2);
static ost_pack_rec_func ost_kml_pack[REINT_MAX + 1] = {
{
smsi->smsi_pack_rec[PACK_OST] = ost_rec_pack;
-
return 0;
}
#include "smfs_internal.h"
-#define SNAPTABLE_SIZE(size) (sizeof(struct snap_table) + \
- size * sizeof(struct snap))
+#define SNAPTABLE_SIZE(size) (sizeof(struct snap_table) + \
+ size * sizeof(struct snap))
+
+int smfs_cleanup_snap_info(struct snap_info *snap_info);
+
static int smfs_init_snap_super_info(struct smfs_super_info *smfs_info)
{
struct snap_super_info *snap_sinfo;
ENTRY;
- OBD_ALLOC(smfs_info->smsi_snap_info, sizeof(struct snap_super_info));
+ OBD_ALLOC(smfs_info->smsi_snap_info,
+ sizeof(struct snap_super_info));
+
if (!smfs_info->smsi_snap_info)
GOTO(exit, rc = -ENOMEM);
RETURN(NULL);
}
+#if 0
static int smfs_dotsnap_dir_size(struct inode *inode)
{
struct snap_super_info *snap_sinfo = S2SNAPI(inode->i_sb);
dir_size = blocks * inode->i_sb->s_blocksize;
RETURN(dir_size);
-}
+}
+#endif
static int smfs_init_snap_inode_info(struct inode *inode, struct inode *dir, int index)
{
RETURN(rc);
}
+int smfs_cow_cleanup(struct smfs_super_info *smb)
+{
+ struct snap_super_info *snap_sinfo = smb->smsi_snap_info;
+ struct list_head *snap_list = &snap_sinfo->snap_list;
+ struct smfs_hook_ops *cow_hops;
+ int rc = 0;
+ ENTRY;
+
+ while (!list_empty(snap_list)) {
+ struct snap_info *snap_info;
+
+ snap_info = list_entry(snap_list->next, struct snap_info,
+ sni_list);
+ rc = smfs_cleanup_snap_info(snap_info);
+ if (rc)
+ CERROR("cleanup snap_info error rc=%d\n", rc);
+ list_del(&snap_info->sni_list);
+ OBD_FREE(snap_info, sizeof(struct snap_info));
+ }
+
+ if (snap_sinfo->snap_fsfilt)
+ fsfilt_put_ops(snap_sinfo->snap_fsfilt);
+ if (snap_sinfo->snap_cache_fsfilt)
+ fsfilt_put_ops(snap_sinfo->snap_cache_fsfilt);
+
+ cow_hops = smfs_unregister_hook_ops(smb, COW_HOOK);
+ smfs_free_hook_ops(cow_hops);
+
+ SMFS_CLEAN_COW(smb);
+ if (snap_sinfo)
+ OBD_FREE(snap_sinfo, sizeof(struct snap_super_info));
+ RETURN(rc);
+}
+
int smfs_cow_init(struct super_block *sb)
{
struct smfs_super_info *smfs_info = S2SMI(sb);
RETURN(rc);
}
-int smfs_cow_cleanup(struct smfs_super_info *smb)
-{
- struct snap_super_info *snap_sinfo = smb->smsi_snap_info;
- struct list_head *snap_list = &snap_sinfo->snap_list;
- struct smfs_hook_ops *cow_hops;
- int rc = 0;
- ENTRY;
-
- while (!list_empty(snap_list)) {
- struct snap_info *snap_info;
-
- snap_info = list_entry(snap_list->next, struct snap_info,
- sni_list);
- rc = smfs_cleanup_snap_info(snap_info);
- if (rc)
- CERROR("cleanup snap_info error rc=%d\n", rc);
- list_del(&snap_info->sni_list);
- OBD_FREE(snap_info, sizeof(struct snap_info));
- }
-
- if (snap_sinfo->snap_fsfilt)
- fsfilt_put_ops(snap_sinfo->snap_fsfilt);
- if (snap_sinfo->snap_cache_fsfilt)
- fsfilt_put_ops(snap_sinfo->snap_cache_fsfilt);
-
- cow_hops = smfs_unregister_hook_ops(smb, COW_HOOK);
- smfs_free_hook_ops(cow_hops);
-
- SMFS_CLEAN_COW(smb);
- if (snap_sinfo)
- OBD_FREE(snap_sinfo, sizeof(struct snap_super_info));
- RETURN(rc);
-}
-
int smfs_snap_test_inode(struct inode *inode, void *args)
{
struct smfs_iget_args *sargs = (struct smfs_iget_args*)args;
{
struct dentry *dentry = NULL;
struct nameidata nd;
+ int error;
ENTRY;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
static int link_cowed_inode(struct inode *inode)
{
struct dentry *cowed_dir = NULL;
- char fidname[LL_FID_NAMELEN];
+ char idname[LL_ID_NAMELEN];
struct snap_info *snap_info;
- int fidlen = 0, rc = 0;
+ int idlen = 0, rc = 0;
struct dentry *dchild = NULL;
struct dentry *tmp = NULL;
unsigned mode;
down(&cowed_dir->d_inode->i_sem);
- fidlen = ll_fid2str(fidname, inode->i_ino, inode->i_generation);
-
- dchild = lookup_one_len(fidname, cowed_dir, fidlen);
+ idlen = ll_id2str(idname, inode->i_ino, inode->i_generation);
+ dchild = lookup_one_len(idname, cowed_dir, idlen);
if (IS_ERR(dchild)) {
rc = PTR_ERR(dchild);
if (rc != -EPERM && rc != -EACCES)
post_smfs_dentry(tmp);
if (rc) {
CERROR("error linking cowed inode %s to COWED: rc = %d\n",
- fidname, rc);
+ idname, rc);
}
inode->i_mode = mode;
if ((mode & S_IFMT) == S_IFDIR) {
RETURN(0);
}
-static int smfs_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+static int
+smfs_revalidate_nd(struct dentry *de, struct nameidata *nd)
{
- struct inode *inode = dentry->d_inode;
+ struct inode *inode = de->d_inode;
ENTRY;
if (!inode)
RETURN(0);
if (smfs_under_dotsnap_inode(inode)) {
- struct inode *dir = dentry->d_parent->d_inode;
+ struct inode *dir = de->d_parent->d_inode;
int index = I2SNAPI(inode)->sn_index;
- smfs_revalidate_dotsnap_dentry(dentry, dir, index);
- smfs_init_snap_inode_info(dentry->d_inode, dir, index);
+ smfs_revalidate_dotsnap_dentry(de, dir, index);
+ smfs_init_snap_inode_info(de->d_inode, dir, index);
}
RETURN(0);
}
+#else
+static int
+smfs_revalidate_it(struct dentry *de, int flags,
+ struct nameidata *nd,
+ struct lookup_intent *it)
+{
+ struct inode *inode = de->d_inode;
+ ENTRY;
+
+ if (!inode)
+ RETURN(0);
+
+ if (smfs_under_dotsnap_inode(inode)) {
+ struct inode *dir = de->d_parent->d_inode;
+ int index = I2SNAPI(inode)->sn_index;
+
+ smfs_revalidate_dotsnap_dentry(de, dir, index);
+ smfs_init_snap_inode_info(de->d_inode, dir, index);
+ }
+
+ RETURN(0);
+}
+#endif
static int smfs_delete_dentry(struct dentry *dentry)
{
}
struct dentry_operations smfs_cow_dops = {
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
.d_revalidate = smfs_revalidate_nd,
+#else
+ .d_revalidate_it = smfs_revalidate_it,
+#endif
.d_delete = smfs_delete_dentry,
};
#define HOOK_READDIR 12
#define HOOK_MAX 12
-#define PRE_HOOK 0
-#define POST_HOOK 1
+#define PRE_HOOK 0
+#define POST_HOOK 1
+
#define SMFS_HOOK(inode, dentry, data1, data2, op, handle, flag, rc, label) \
do { \
LASSERT(inode->i_sb); \
#include <linux/lustre_smfs.h>
#include "smfs_internal.h"
-static char *smfs_options(char *data, char **devstr, char **namestr,
- char *opts, int *flags)
+static char *smfs_options(char *data, char **devstr,
+ char **namestr, char *opts,
+ int *flags)
{
struct option *opt_value = NULL;
char *pos;
sprintf((char *)opts + strlen(opts), ",%s",
opt_value->value);
} else {
- /*FIXME:WANGDI How about the opt_value->value*/
+ /* FIXME-WANGDI: how about the opt_value->value */
if (strlen(opts) == 0)
sprintf((char *)opts + strlen(opts), "%s",
opt_value->opt);
}
return pos;
}
+
+struct super_block *smfs_get_sb_by_path(char *path, int len)
+{
+ struct super_block *sb;
+ struct nameidata nd;
+ int error = 0;
+
+ ENTRY;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ if (path_init(path, LOOKUP_FOLLOW, &nd)) {
+#else
+ if (path_lookup(path, LOOKUP_FOLLOW, &nd)) {
+#endif
+ error = path_walk(path, &nd);
+ if (error) {
+ path_release(&nd);
+ RETURN(NULL);
+ }
+ } else {
+ RETURN(NULL);
+ }
+
+ /* FIXME-WANGDI: add some check code here. */
+ sb = nd.dentry->d_sb;
+ path_release(&nd);
+ RETURN(sb);
+}
+
static struct smfs_super_info *smfs_init_smb(struct super_block *sb)
{
struct smfs_super_info *smb;
if (!smb)
RETURN(NULL);
- S2SMI(sb) = smb;
+ S2FSI(sb) = smb;
RETURN(smb);
}
+
static int smfs_init_fsfilt_ops(struct smfs_super_info *smb)
{
ENTRY;
if (!smb->sm_cache_fsfilt) {
- smb->sm_cache_fsfilt = fsfilt_get_ops(smb->smsi_cache_ftype);
+ smb->sm_cache_fsfilt =
+ fsfilt_get_ops(smb->smsi_cache_ftype);
if (!smb->sm_cache_fsfilt) {
CERROR("Can not get %s fsfilt ops needed by kml\n",
smb->smsi_cache_ftype);
}
}
if (!smb->sm_fsfilt) {
- smb->sm_fsfilt = fsfilt_get_ops(smb->smsi_ftype);
+ smb->sm_fsfilt =
+ fsfilt_get_ops(smb->smsi_ftype);
if (!smb->sm_fsfilt) {
CERROR("Can not get %s fsfilt ops needed by kml\n",
smb->smsi_ftype);
typelen = strlen(typestr);
printk("smfs: mounting %s at %s\n", typestr, devstr);
-
mnt = do_kern_mount(typestr, 0, devstr, (void *)opts);
-
if (IS_ERR(mnt)) {
- CERROR("do_kern_mount failed: rc = %ld\n", PTR_ERR(mnt));
+ CERROR("do_kern_mount failed: rc = %ld\n",
+ PTR_ERR(mnt));
GOTO(err_out, err = PTR_ERR(mnt));
}
static int smfs_init_hook_ops(struct smfs_super_info *smb)
{
ENTRY;
-
INIT_LIST_HEAD(&smb->smsi_hook_list);
-
RETURN(0);
}
+
static void smfs_cleanup_hook_ops(struct smfs_super_info *smb)
{
struct list_head *hlist = &smb->smsi_hook_list;
smfs_free_hook_ops(smfs_hops);
}
EXIT;
- return;
}
static void smfs_cleanup_smb(struct super_block *sb)
if (smb)
OBD_FREE(smb, sizeof(*smb));
EXIT;
- return;
}
+
void smfs_cleanup_hooks(struct smfs_super_info *smb)
{
if (sb)
smfs_umount_cache(smfs_info);
smfs_cleanup_smb(sb);
- return;
}
static int smfs_init_hooks(struct super_block *sb)
ENTRY;
- CDEBUG(D_SUPER, "mount opts: %s\n", data ? (char *)data : "(none)");
+ CDEBUG(D_SUPER, "mount opts: %s\n", data ?
+ (char *)data : "(none)");
smb = smfs_init_smb(sb);
if (!smb)
page = __get_free_page(GFP_KERNEL);
if (!page)
GOTO(out_err, err = -ENOMEM);
-
+
memset((void *)page, 0, PAGE_SIZE);
opts = (char *)page;
"option %s\n", cache_data);
if (!typestr || !devstr) {
- CERROR("mount options name and dev mandatory\n");
+ CERROR("mount options name and dev are mandatory\n");
free_page(page);
GOTO(out_err, err = -EINVAL);
}
- err = smfs_mount_cache(smb, devstr, typestr, opts);
+ err = smfs_mount_cache(smb, devstr, typestr, opts);
free_page(page);
if (err) {
CERROR("Can not mount %s as %s\n", devstr, typestr);
- GOTO(out_err, 0);
+ GOTO(out_err, err);
}
duplicate_sb(sb, smb->smsi_sb);
err = smfs_init_hook_ops(smb);
if (err) {
CERROR("Can not init super hook ops err %d\n", err);
- GOTO(out_err, 0);
+ smfs_umount_cache(smb);
+ GOTO(out_err, err);
}
- /*init the root_inode of smfs*/
+
+ /* init the root_inode of smfs. */
dget(S2CSB(sb)->s_root);
root_ino = S2CSB(sb)->s_root->d_inode->i_ino;
root_inode = smfs_get_inode(sb, root_ino, NULL, 0);
if (!sb->s_root) {
smfs_umount_cache(smb);
- GOTO(out_err, err=-EINVAL);
+ GOTO(out_err, err = -ENOMEM);
}
err = smfs_init_hooks(sb);
if (err) {
smfs_umount_cache(smb);
- GOTO(out_err, err=-EINVAL);
+ GOTO(out_err, err);
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
CDEBUG(D_SUPER, "sb %lx, &sb->u.generic_sbp: %lx\n",
smfs_cleanup_smb(sb);
return err;
}
+
struct smfs_hook_ops *smfs_alloc_hook_ops(char *name, smfs_hook_func pre_hook,
smfs_hook_func post_hook)
{
list_add(&smh_ops->smh_list, hlist);
RETURN(0);
}
+
struct smfs_hook_ops *smfs_unregister_hook_ops(struct smfs_super_info *smb,
char *name)
{
RETURN(rc);
}
-int smfs_llog_add_rec(struct smfs_super_info * sinfo, void *data, int data_size)
+int smfs_llog_add_rec(struct smfs_super_info *sinfo, void *data, int data_size)
{
struct llog_rec_hdr rec;
int rc = 0;
#include "smfs_internal.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-static struct super_block *smfs_read_super(struct super_block *sb, void *data,
- int silent)
+static struct super_block *smfs_read_super(struct super_block *sb,
+ void *data, int silent)
{
int err;
}
struct inode_operations smfs_sym_iops = {
- readlink: smfs_readlink,
- follow_link: smfs_follow_link,
- setxattr: smfs_setxattr, /* BKL held */
- getxattr: smfs_getxattr, /* BKL held */
- listxattr: smfs_listxattr, /* BKL held */
- removexattr: smfs_removexattr, /* BKL held */
+ .readlink = smfs_readlink,
+ .follow_link = smfs_follow_link,
+ .setxattr = smfs_setxattr, /* BKL held */
+ .getxattr = smfs_getxattr, /* BKL held */
+ .listxattr = smfs_listxattr, /* BKL held */
+ .removexattr = smfs_removexattr, /* BKL held */
};
struct file_operations smfs_sym_fops = {
exit(1);
}
-/* UMKA: This stuff inlined here instead of using appropriate header
- to avoid linking to symbols which is not present in newer libc.
-
- Currently this is the case, as UML image contains RedHat 9 and
- developers use something newer (Fedora, etc.). */
+/*
+ * this stuff inlined here instead of using appropriate header
+ * to avoid linking to symbols which is not present in newer libc.
+ * Currently this is the case, as UML image contains RedHat 9 and
+ * developers use something newer (Fedora, etc.) --umka
+ */
inline unsigned int
__gnu_dev_major (unsigned long long int __dev)
{
{
char *prog = argv[0];
char *filename = argv[1];
- int rc;
+
struct stat st;
- dev_t device = __makedev(TEST_MAJOR, TEST_MINOR);
+ int rq_rdev;
+ int rc;
if (argc != 2)
usage(prog);
unlink(filename);
- /* First try block devices */
- rc = mknod(filename, 0700 | S_IFBLK, device);
- if ( rc < 0 ) {
+ /* first try block devices */
+ rq_rdev = __makedev(TEST_MAJOR, TEST_MINOR);
+ rc = mknod(filename, 0700 | S_IFBLK, rq_rdev);
+ if (rc < 0) {
fprintf(stderr, "%s: mknod(%s) failed: rc %d: %s\n",
prog, filename, errno, strerror(errno));
return 2;
}
rc = stat(filename, &st);
- if ( rc < 0 ) {
+ if (rc < 0) {
fprintf(stderr, "%s: stat(%s) failed: rc %d: %s\n",
prog, filename, errno, strerror(errno));
return 3;
}
-
- if ( st.st_rdev != device) {
+
+ if (st.st_rdev != rq_rdev) {
fprintf(stderr, "%s: created device other than requested: (%u,%u) instead of (%u,%u)\n",
- prog, __major(st.st_rdev),__minor(st.st_rdev),__major(device),__minor(device));
+ prog, __major(st.st_rdev),__minor(st.st_rdev),__major(rq_rdev),__minor(rq_rdev));
return 4;
}
if (!S_ISBLK(st.st_mode)) {
}
/* Second try char devices */
- rc = mknod(filename, 0700 | S_IFCHR, device);
+ rc = mknod(filename, 0700 | S_IFCHR, rq_rdev);
if ( rc < 0 ) {
fprintf(stderr, "%s: mknod(%s) failed: rc %d: %s\n",
prog, filename, errno, strerror(errno));
prog, filename, errno, strerror(errno));
return 8;
}
- if ( st.st_rdev != device) {
+ if (st.st_rdev != rq_rdev) {
fprintf(stderr, "%s: created device other than requested: (%u,%u) instead of (%u,%u)\n",
- prog, __major(st.st_rdev),__minor(st.st_rdev),__major(device),__minor(device));
+ prog, __major(st.st_rdev),__minor(st.st_rdev),__major(rq_rdev),__minor(rq_rdev));
return 9;
}
if (!S_ISCHR(st.st_mode)) {
--- /dev/null
+#!/bin/bash
+
+export PATH="$PATH:`dirname $0`/../utils"
+
+config=${1:-cmobd.xml}
+LMC=${LMC:-lmc}
+TMP=${TMP:-/tmp}
+
+CMOBD_MDS1=${CMOBD_MDS1:-"cmobd-mds1"}
+CMOBD_MDS2=${CMOBD_MDS2:-"cmobd-mds2"}
+
+MASTER_LMV=${MASTER_LMV1:-master-lmv1}
+
+CACHE_MDS1=${CACHE_MDS1:-"cache-mds1"}
+CACHE_MDS2=${CACHE_MDS2:-"cache-mds2"}
+MASTER_MDS1=${MASTER_MDS1:-"master-mds1"}
+MASTER_MDS2=${MASTER_MDS2:-"master-mds2"}
+
+MDS1_CACHE_DEV=$TMP/mds1-cache-localhost
+MDS2_CACHE_DEV=$TMP/mds2-cache-localhost
+MDS1_MASTER_DEV=$TMP/mds1-master-localhost
+MDS2_MASTER_DEV=$TMP/mds2-master-localhost
+
+MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS:-"kml"}
+OST_MOUNT_OPTS=${OST_MOUNT_OPTS:-"kml"}
+
+MDSSIZE=${MDSSIZE:-100000}
+
+MASTER_LOV=${MASTER_LOV:-"master-lov1"}
+MASTER_OST=${MASTER_OST:-"master-ost1"}
+OST_MASTER_DEV=$TMP/ost1-master-localhost
+
+OSTSIZE=${OSTSIZE:-100000}
+
+STRIPECNT=${STRIPECNT:-1}
+OSDTYPE=${OSDTYPE:-obdfilter}
+OSTFAILOVER=${OSTFAILOVER:-}
+
+FSTYPE=${FSTYPE:-smfs}
+BACKUP_FSTYPE=${BACKUP_FSTYPE:-ext3}
+
+NETTYPE=${NETTYPE:-tcp}
+NIDTYPE=${NIDTYPE:-$NETTYPE}
+
+NODE=${NODE:-"localhost"}
+
+CLIENTS=${CLIENTS:-1}
+MODE=${MODE:-lmv}
+
+rm -f $config
+
+h2tcp () {
+ case $1 in
+ client) echo '\*' ;;
+ *) echo $1 ;;
+ esac
+}
+
+${LMC} -m $config --add net --node $NODE --nid `h2$NIDTYPE $NODE` \
+--nettype $NETTYPE || exit 1
+
+${LMC} -m $config --add mds --node $NODE --mds $CACHE_MDS1 --fstype $FSTYPE \
+--backfstype $BACKUP_FSTYPE --backdev $MDS1_CACHE_DEV --dev $FSTYPE \
+--mountfsoptions $MDS_MOUNT_OPTS --size $MDSSIZE --format || exit 10
+
+if test "x$CLIENTS" = "x2"; then
+ ${LMC} -m $config --add mds --node $NODE --mds $CACHE_MDS2 \
+ --fstype $FSTYPE --backfstype $BACKUP_FSTYPE --backdev $MDS2_CACHE_DEV \
+ --dev $FSTYPE --mountfsoptions $MDS_MOUNT_OPTS --size $MDSSIZE --format || exit 10
+fi
+
+if test "x$MODE" = "xmds"; then
+ ${LMC} -m $config --add mds --node $NODE --mds $MASTER_MDS1 \
+ --fstype $BACKUP_FSTYPE --dev $MDS1_MASTER_DEV --size $MDSSIZE --format || exit 10
+else
+ ${LMC} -m $config --add lmv --lmv $MASTER_LMV || exit 12
+
+ ${LMC} -m $config --add mds --node $NODE --mds $MASTER_MDS1 \
+ --fstype $BACKUP_FSTYPE --dev $MDS1_MASTER_DEV --size $MDSSIZE \
+ --lmv $MASTER_LMV --format || exit 10
+
+ ${LMC} -m $config --add mds --node $NODE --mds $MASTER_MDS2 \
+ --fstype $BACKUP_FSTYPE --dev $MDS2_MASTER_DEV --size $MDSSIZE \
+ --lmv $MASTER_LMV --format || exit 10
+fi
+
+if test "x$MODE" = "xmds"; then
+ ${LMC} -m $config --add lov --lov $MASTER_LOV --mds $MASTER_MDS1 \
+ --stripe_sz 65536 --stripe_cnt $STRIPECNT --stripe_pattern 0 || exit 20
+else
+ ${LMC} -m $config --add lov --lov $MASTER_LOV --lmv $MASTER_LMV \
+ --stripe_sz 65536 --stripe_cnt $STRIPECNT --stripe_pattern 0 || exit 20
+fi
+
+${LMC} -m $config --add ost --ost $MASTER_OST --node $NODE --lov $MASTER_LOV \
+--fstype $BACKUP_FSTYPE --dev $OST_MASTER_DEV --size $OSTSIZE || exit 21
+
+if test "x$MODE" = "xmds"; then
+ ${LMC} -m $config --add cmobd --node $NODE --cmobd $CMOBD_MDS1 \
+ --master_obd $MASTER_MDS1 --cache_obd $CACHE_MDS1 || exit 23
+else
+ ${LMC} -m $config --add cmobd --node $NODE --cmobd $CMOBD_MDS1 \
+ --master_obd $MASTER_LMV --cache_obd $CACHE_MDS1 || exit 23
+fi
+
+if test "x$CLIENTS" = "x2"; then
+ if test "x$MODE" = "xmds"; then
+ ${LMC} -m $config --add cmobd --node $NODE --cmobd $CMOBD_MDS2 \
+ --master_obd $MASTER_MDS1 --cache_obd $CACHE_MDS2 || exit 23
+ else
+ ${LMC} -m $config --add cmobd --node $NODE --cmobd $CMOBD_MDS2 \
+ --master_obd $MASTER_LMV --cache_obd $CACHE_MDS2 || exit 23
+ fi
+fi
+
+${LMC} -m $config --add mtpt --node $NODE --path /mnt/lustre \
+--mds $CACHE_MDS1 --lov $MASTER_LOV || exit 30
+
+if test "x$CLIENTS" = "x2"; then
+ ${LMC} -m $config --add mtpt --node $NODE --path /mnt/lustre1 \
+ --mds $CACHE_MDS2 --lov $MASTER_LOV || exit 30
+fi
# configure ost
${LMC} --add ost --node localhost --obd obd2 --fstype $FSTYPE --obdtype obdecho || exit 30
-${LMC} --add cobd --node localhost --real_obd obd1 --cache_obd obd2
+${LMC} --add cobd --node localhost --master_obd obd1 --cache_obd obd2
# create client config
# ${LMC} -m $config --add mtpt --node localhost --path /mnt/lustre --mds mds1 --obd obd1 || exit 40
-#export PATH=`dirname $0`/../utils:/r/sbin/:/r/usr/bin/:$PATH
-export PATH=./../utils:/r/sbin/:/r/usr/bin/:$PATH
+export PATH="$PATH:./../utils:/r/sbin:/r/usr/bin"
LCTL=${LCTL:-"lctl"}
TMP=${TMP:-"/tmp"}
TARCMD=${TARCMD:-"tar"}
UNTARCMD=${UNTARCMD:-"tar -zxvf"}
CPCMD=${CPCMD:-"cp -f"}
-CACHEMDS=${CACHEMDS:-$TMP/mds1-uml}
-REALMDS=${REALMDS:-$TMP/mds2-uml}
+CACHEMDS=${CACHEMDS:-$TMP/mds1-`hostname`}
+REALMDS=${REALMDS:-$TMP/mds3-`hostname`}
-CACHEOST=${CACHEOST:-$TMP/ost1-uml}
-REALOST=${REALOST:-$TMP/ost2-uml}
+CACHEOST=${CACHEOST:-$TMP/ost1-`hostname`}
+REALOST=${REALOST:-$TMP/ost3-`hostname`}
MDS_CMOBD_INDEX=${MDS_CMOBD_INDEX:-12}
OST_CMOBD_INDEX=${OST_CMOBD_INDEX:-14}
OST_COBD_INDEX=${OST_COBD_INDEX:-19}
-if ! [ -e "$TMP/$TARBALL" ]; then
- echo "$TARBALL did not exist, please give a tar ball for test in your $TMP"
+if ! [ -e "$TARBALL" ]; then
+ echo "$TARBALL does not exist"
fi
show_filesystem() {
}
cobd_cache_on() {
-
${LCTL} << EOF
device $OST_COBD_INDEX
cache_on
device $MDS_COBD_INDEX
cache_on
EOF
-
}
cobd_cache_on
echo "before test ...."
#first step cp the tar to cache dev and untar it
echo "cp $TARBALL to lustre dir and untar ..."
-${CPCMD} $TMP/${TARBALL} ${MNTPATH} || exit 1
-${UNTARCMD} ${MNTPATH}/${TARBALL} -C ${MNTPATH} > /dev/null || exit 2
+${CPCMD} ${TARBALL} ${MNTPATH} || exit 1
+${UNTARCMD} ${MNTPATH}/`basename ${TARBALL}` -C ${MNTPATH} > /dev/null || exit 2
+
#show status of the filesystem
echo after cp show the filsystem....
show_filesystem $CACHEMDS $CACHEOST
#third step and write files to real dev
mkdir -p $MNTPATH/new
-$CPCMD -f $TMP/$TARBALL $MNTPATH/new || exit 1
-$UNTARCMD $MNTPATH/new/$TARBALL -C $MNTPATH/new > /dev/null || exit 2
+$CPCMD -f $TARBALL $MNTPATH/new || exit 1
+$UNTARCMD $MNTPATH/new/`basename $TARBALL` -C $MNTPATH/new > /dev/null || exit 2
show_filesystem $CACHEMDS $CACHEOST
echo .... done!
-
-
-
cleanup() {
umount_client $MOUNT || return 200
- stop_mds || return 201
+ stop_mds || return 201
stop_ost || return 202
# catch case where these return just fine, but modules are still not unloaded
/sbin/lsmod | grep -q portals
MDSSIZE=${MDSSIZE:-400000}
FSTYPE=${FSTYPE:-ext3}
-
+OST_FSTYPE=${OST_FSTYPE:-$FSTYPE}
MOUNT=${MOUNT:-/mnt/lustre}
MOUNT2=${MOUNT2:-${MOUNT}2}
NETTYPE=${NETTYPE:-tcp}
${LMC} -m $config --add lov --lov lov1 --mds mds1 --stripe_sz $STRIPE_BYTES \
--stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0 || exit 20
-${LMC} --add ost --nspath /mnt/ost_ns --node localhost --lov lov1 \
---fstype $FSTYPE --backfstype $OST_BACKFSTYPE --dev $OSTDEV \
+${LMC} --add ost --ost ost1 --nspath /mnt/ost_ns --node localhost --lov lov1 \
+--fstype $OST_FSTYPE --backfstype $OST_BACKFSTYPE --dev $OSTDEV \
--backdev $OST_BACKDEV $OST_MOUNT_OPTS --size $OSTSIZE $JARG || exit 30
# create client config
add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
add_ost ost2 --lov lov1 --dev ${OSTDEV}-2 --size $OSTSIZE
add_client client $MDS --lov lov1 --path $MOUNT
-
}
build_test_filter
mv $DIR/$tfile $DIR/$tfile-2
rm -f $DIR/$tfile
fail mds1
+
$CHECKSTAT $DIR/$tfile && return 1
- $CHECKSTAT $DIR/$tfile-2 ||return 2
+ $CHECKSTAT $DIR/$tfile-2 || return 2
rm $DIR/$tfile-2
return 0
}
set -e
ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 2108 3637 3561
-RENAME_TESTS="24a 24b 24c 24d 24e 24f 24g 24h 24i 24j 24k 24l 24m 24n 24o 42a 42c 45 48a 48b 48c 48d 51b 51c 65a 65b 65c 65d 65e 65f"
-ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$RENAME_TESTS 58"}
-
+# bug number for skipped test: 2739
+ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"57a 57b 65a 65b 65c 65d 65e 65f"}
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
[ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
mkdir $DIR/d27
fi
$LSTRIPE $DIR/d27/f01 65536 0 2 || error "lstripe failed"
- [ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] ||
+ [ `$LFIND $DIR/d27/f01 --quiet | grep [^[:blank:]*] | wc -l` -eq 2 ] ||
error "two-stripe file doesn't have two stripes"
pass
log "== test_27d: write to two stripe file file f01 ================"
#set -vx
mkdir -p $DIR/d48d/dir
cd $DIR/d48d/dir
- $TRACE rmdir $DIR/d48d/dir || error "remove cwd $DIR/d48d/dir failed"
- $TRACE rmdir $DIR/d48d || error "remove parent $DIR/d48d failed"
- $TRACE touch foo && error "'touch foo' worked after removing parent"
- $TRACE mkdir foo && error "'mkdir foo' worked after removing parent"
- $TRACE ls . && error "'ls .' worked after removing parent"
- $TRACE ls .. && error "'ls ..' worked after removing parent"
- $TRACE cd . && error "'cd .' worked after recreate parent"
- $TRACE mkdir . && error "'mkdir .' worked after removing parent"
- $TRACE rmdir . && error "'rmdir .' worked after removing parent"
- $TRACE ln -s . foo && error "'ln -s .' worked after removing parent"
- $TRACE cd .. && error "'cd ..' worked after removing parent" || true
-
+ $TRACE rmdir $DIR/d48d/dir || error "remove cwd $DIR/d48d/dir failed"
+ $TRACE rmdir $DIR/d48d || error "remove parent $DIR/d48d failed"
+ $TRACE touch foo && error "'touch foo' worked after removing parent"
+ $TRACE mkdir foo && error "'mkdir foo' worked after removing parent"
+ $TRACE ls . && error "'ls .' worked after removing parent"
+ $TRACE ls .. && error "'ls ..' worked after removing parent"
+ $TRACE cd . && error "'cd .' worked after recreate parent"
+ $TRACE mkdir . && error "'mkdir .' worked after removing parent"
+ $TRACE rmdir . && error "'rmdir .' worked after removing parent"
+ $TRACE ln -s . foo && error "'ln -s .' worked after removing parent"
+ $TRACE cd .. && error "'cd ..' worked after removing parent" || true
}
run_test 48d "Access removed parent subdir (should return errors)"
done
# test lfs find with --recursive
- FILENUM=`$LFIND --recursive $DIR/d56 | grep -c obdidx`
+ FILENUM=`$LFIND --recursive $DIR/d56 | grep -v OBDS | grep -c obdidx`
[ $FILENUM -eq $NUMFILESx2 ] || error \
"lfs find --recursive $DIR/d56 wrong: found $FILENUM, expected $NUMFILESx2"
- FILENUM=`$LFIND $DIR/d56 | grep -c obdidx`
+ FILENUM=`$LFIND $DIR/d56 | grep -v OBDS | grep -c obdidx`
[ $FILENUM -eq $NUMFILES ] || error \
"lfs find $DIR/d56 without --recursive wrong: found $FILENUM,
expected $NUMFILES"
echo "lfs find --recursive passed."
# test lfs find with file instead of dir
- FILENUM=`$LFIND $DIR/d56/file1 | grep -c obdidx`
+ FILENUM=`$LFIND $DIR/d56/file1 | grep -v OBDS | grep -c obdidx`
[ $FILENUM -eq 1 ] || error \
- "lfs find $DIR/d56/file1 wrong:found $FILENUM, expected 1"
+ "lfs find $DIR/d56/file1 wrong: found $FILENUM, expected 1"
echo "lfs find file passed."
#test lfs find with --verbose
- [ `$LFIND --verbose $DIR/d56 | grep -c lmm_magic` -eq $NUMFILES ] ||\
+ [ `$LFIND --verbose $DIR/d56 | grep -v OBDS | grep -c lmm_magic` -eq $NUMFILES ] ||\
error "lfs find --verbose $DIR/d56 wrong: should find $NUMFILES lmm_magic info"
- [ `$LFIND $DIR/d56 | grep -c lmm_magic` -eq 0 ] || error \
+ [ `$LFIND $DIR/d56 | grep -v OBDS | grep -c lmm_magic` -eq 0 ] || error \
"lfs find $DIR/d56 without --verbose wrong: should not show lmm_magic info"
echo "lfs find --verbose passed."
[ "$OSTCOUNT" -lt 2 ] && \
echo "skipping other lfs find --obd test" && return
- FILENUM=`$LFIND --recursive $DIR/d56 | sed -n '/^[ ]*1[ ]/p' | wc -l`
- OBDUUID=`$LFIND --recursive $DIR/d56 | sed -n '/^[ ]*1:/p' | awk '{print $2}'`
- FOUND=`$LFIND -r --obd $OBDUUID $DIR/d56 | wc -l`
+ FILENUM=`$LFIND --recursive $DIR/d56 | grep -v OBDS | grep obdidx | wc -l`
+ OBDUUID=`$LFIND --recursive $DIR/d56 | grep -A 1 OBDS | grep -v OBDS | awk '{print $3}'`
+ OBDIDX=`$LFIND --recursive $DIR/d56 | grep -A 1 OBDS | grep -v OBDS | awk '{print $1}'`
+ FOUND=`$LFIND --recursive --obd $OBDUUID $DIR/d56 | wc -l`
+
[ $FOUND -eq $FILENUM ] || \
error "lfs find --obd wrong: found $FOUND, expected $FILENUM"
- [ `$LFIND -r -v --obd $OBDUUID $DIR/d56 | sed '/^[ ]*1[ ]/d' | \
- sed -n '/^[ ]*[0-9][0-9]*[ ]/p' | wc -l` -eq 0 ] || \
+
+ [ `$LFIND -r -v --obd $OBDUUID $DIR/d56 | grep "^[[:blank:]]*$OBDIDX" | wc -l` ] || \
error "lfs find --obd wrong: should not show file on other obd"
+
echo "lfs find --obd passed."
}
run_test 56 "check lfs find ===================================="
MDSFREE2="`cat /proc/fs/lustre/mds/*/kbytesfree`"
MDCFREE2="`cat /proc/fs/lustre/mdc/*/kbytesfree`"
+
if [ "$MDCFREE" != "$MDCFREE2" ]; then
if [ "$MDSFREE" != "$MDSFREE2" ]; then
error "MDC before $MDCFREE != after $MDCFREE2"
CMOBD_MDS=${CMOBD_MDS:-"cmobd1"}
CMOBD_OST=${CMOBD_OST:-"cmobd2"}
-
CACHE_MDS=${CACHE_MDS:-"mds1"}
-REAL_MDS=${REAL_MDS:-"mds2"}
+MASTER_MDS=${MASTER_MDS:-"mds2"}
MDS_CACHE_DEV=$TMP/mds1-`hostname`
-MDS_REAL_DEV=$TMP/mds2-`hostname`
+MDS_MASTER_DEV=$TMP/mds2-`hostname`
MDS_DEV=$TMP/mds
MDSSIZE=${MDSSIZE:-100000}
CACHE_LOV=${CACHE_LOV:-"lov1"}
-REAL_LOV=${REAL_LOV:-"lov2"}
+MASTER_LOV=${MASTER_LOV:-"lov2"}
CACHE_OST=${CACHE_OST:-"ost1"}
-REAL_OST=${REAL_OST:-"ost2"}
+MASTER_OST=${MASTER_OST:-"ost2"}
OST_CACHE_DEV=$TMP/ost1-`hostname`
-OST_REAL_DEV=$TMP/ost2-`hostname`
+OST_MASTER_DEV=$TMP/ost2-`hostname`
OST_DEV=$TMP/ost
OSTSIZE=${OSTSIZE:-100000}
NETTYPE=${NETTYPE:-tcp}
NIDTYPE=${NIDTYPE:-$NETTYPE}
-MDSNODE=${MDSNODE:-uml}
-OSTNODE=${OSTNODE:-uml}
-CLIENT=${CLIENT:-"uml"}
-NODE=${NODE:-"uml"}
+MDSNODE=${MDSNODE:-`hostname`}
+OSTNODE=${OSTNODE:-`hostname`}
+CLIENT=${CLIENT:-`hostname`}
+NODE=${NODE:-`hostname`}
MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS:-"kml"}
OST_MOUNT_OPTS=${OST_MOUNT_OPTS:-"kml"}
# configure mds server
echo "adding cache MDS on: $MDSNODE"
-${LMC} -m $config --add mds --format --node $MDSNODE --mds $CACHE_MDS --fstype $FSTYPE \
+${LMC} -m $config --format --add mds --node $MDSNODE --mds $CACHE_MDS --fstype $FSTYPE \
--backfstype $BACKUP_FSTYPE --dev $MDS_DEV --backdev $MDS_CACHE_DEV \
--mountfsoptions $MDS_MOUNT_OPTS --size $MDSSIZE ||exit 10
-echo "adding real MDS on: $MDSNODE"
-${LMC} -m $config --add mds --format --node $MDSNODE --mds $REAL_MDS --fstype $BACKUP_FSTYPE \
---dev $MDS_REAL_DEV --size $MDSSIZE ||exit 10
+echo "adding master MDS on: $MDSNODE"
+${LMC} -m $config --format --add mds --node $MDSNODE --mds $MASTER_MDS --fstype $BACKUP_FSTYPE \
+--dev $MDS_MASTER_DEV --size $MDSSIZE ||exit 10
echo "add cache lov on: $MDSNODE"
${LMC} -m $config --add lov --lov $CACHE_LOV --mds $CACHE_MDS \
--stripe_sz 65536 --stripe_cnt $STRIPECNT --stripe_pattern 0 || exit 20
-echo "add real lov on: $MDSNODE"
-${LMC} -m $config --add lov --lov $REAL_LOV --mds $REAL_MDS \
+
+echo "add master lov on: $MDSNODE"
+${LMC} -m $config --add lov --lov $MASTER_LOV --mds $MASTER_MDS \
--stripe_sz 65536 --stripe_cnt $STRIPECNT --stripe_pattern 0 || exit 20
echo "add cache ost on $OSTNODE"
--fstype $FSTYPE --backfstype $BACKUP_FSTYPE --dev $OST_DEV \
--backdev $OST_CACHE_DEV --mountfsoptions $OST_MOUNT_OPTS --size $OSTSIZE || exit 21
-echo "add real ost on $OSTNODE"
-${LMC} -m $config --add ost --node $NODE --lov $REAL_LOV \
---fstype $BACKUP_FSTYPE --dev $OST_REAL_DEV --size $OSTSIZE || exit 21
+echo "add master ost on $OSTNODE"
+${LMC} -m $config --add ost --node $NODE --lov $MASTER_LOV \
+--fstype $BACKUP_FSTYPE --dev $OST_MASTER_DEV --size $OSTSIZE || exit 21
echo "add mds lov: $COBD_MDS $COBD_OST"
-${LMC} -m $config --add cobd --node $NODE --cobd $COBD_OST --real_obd $REAL_LOV --cache_obd $CACHE_LOV || exit 22
-${LMC} -m $config --add cobd --node $NODE --cobd $COBD_MDS --real_obd $REAL_MDS --cache_obd $CACHE_MDS || exit 22
+${LMC} -m $config --add cobd --node $NODE --cobd $COBD_OST --master_obd $MASTER_LOV --cache_obd $CACHE_LOV || exit 22
+${LMC} -m $config --add cobd --node $NODE --cobd $COBD_MDS --master_obd $MASTER_MDS --cache_obd $CACHE_MDS || exit 22
# create client config(s)
echo "add cmobd: $CMOBD_MDS $CMOBD_OST"
-${LMC} -m $config --add cmobd --node $NODE --cmobd $CMOBD_MDS --master_dev $MDS_REAL_DEV --cache_dev $MDS_DEV || exit 23
-${LMC} -m $config --add cmobd --node $NODE --cmobd $CMOBD_OST --master_dev $OST_REAL_DEV --cache_dev $OST_DEV || exit 23
+${LMC} -m $config --add cmobd --node $NODE --cmobd $CMOBD_OST --master_obd $MASTER_LOV --cache_obd $CACHE_LOV || exit 23
+${LMC} -m $config --add cmobd --node $NODE --cmobd $CMOBD_MDS --master_obd $MASTER_MDS --cache_obd $CACHE_MDS || exit 23
${LMC} -m $config --add mtpt --node $NODE --path /mnt/lustre --mds $COBD_MDS --lov $COBD_OST || exit 30
return default
return None
+ def get_hostaddr(self):
+ ret = []
+ list = self.dom_node.getElementsByTagName('hostaddr')
+ for node in list:
+ ret.append(node.firstChild.data)
+ return ret
+
def get_class(self):
return self._get_class()
if self.running():
pid = self.read_pidfile()
try:
- log ("killing process", pid)
- os.kill(pid, 15)
+ if pid != 1:
+ log ("killing process", pid)
+ os.kill(pid, 15)
+ else:
+ log("was unable to find pid of " + self.command)
#time.sleep(1) # let daemon die
except OSError, e:
log("unable to kill", self.command, e)
pid = self.read_pidfile()
if pid:
try:
- os.kill(pid, 0)
+ if pid != 1:
+ os.kill(pid, 0)
+ else:
+ log("was unable to find pid of " + self.command)
except OSError:
self.clean_pidfile()
else:
def read_pidfile(self):
try:
fp = open(self.pidfile(), 'r')
- pid = int(fp.read())
+ val = fp.read()
+ if val == '':
+ val = '1'
+ pid = int(val)
fp.close()
return pid
except IOError:
raise CommandError(self.lctl, out, rc)
return rc, out
-
def clear_log(self, dev, log):
""" clear an existing log """
cmds = """
if module:
return module
-def find_module(src_dir, dev_dir, modname):
- modbase = src_dir +'/'+ dev_dir +'/'+ modname
- for modext in '.ko', '.o':
- module = modbase + modext
- try:
- if os.access(module, os.R_OK):
- return module
- except OSError:
- pass
- return None
-
# is the path a block device?
def is_block(path):
s = ()
try:
- s = os.stat(path)
+ s = os.lstat(path)
except OSError:
return 0
return stat.S_ISBLK(s[stat.ST_MODE])
dev = find_assigned_loop(realfile)
if dev:
- print 'WARNING file:', realfile, 'already mapped to', dev
+ print 'WARNING: file ', realfile, 'already mapped to', dev
return dev
if reformat or not os.access(realfile, os.R_OK | os.W_OK):
if os.access(dev, os.R_OK):
(stat, out) = run('losetup', dev)
if stat:
+ print "attach " + realfile + " <-> " + dev
run('losetup', dev, realfile)
return dev
else:
return ''
# undo loop assignment
-def clean_loop(file):
- dev = find_assigned_loop(file)
- if dev:
- ret, out = run('losetup -d', dev)
- if ret:
- log('unable to clean loop device:', dev, 'for file:', file)
- logall(out)
-
+def clean_loop(dev, fstype, backfstype, backdev):
+ if fstype == 'smfs':
+ realfile = backdev
+ else:
+ realfile = dev
+ if not is_block(realfile):
+ dev = find_assigned_loop(realfile)
+ if dev:
+ print "detach " + dev + " <-> " + realfile
+ ret, out = run('losetup -d', dev)
+ if ret:
+ log('unable to clean loop device:', dev, 'for file:', realfile)
+ logall(out)
+
+# finilizes passed device
+def clean_dev(dev, fstype, backfstype, backdev):
+ if fstype == 'smfs' or not is_block(dev):
+ clean_loop(dev, fstype, backfstype, backdev)
+
# determine if dev is formatted as a <fstype> filesystem
def need_format(fstype, dev):
# FIXME don't know how to implement this
log(e)
return ""
-
-def mod_loaded(modname):
- """Check if a module is already loaded. Look in /proc/modules for it."""
- try:
- fp = open('/proc/modules')
- lines = fp.readlines()
- fp.close()
- # please forgive my tired fingers for this one
- ret = filter(lambda word, mod=modname: word == mod,
- map(lambda line: string.split(line)[0], lines))
- return ret
- except Exception, e:
- return 0
-
# XXX: instead of device_list, ask for $name and see what we get
def is_prepared(name):
"""Return true if a device exists for the name"""
e.dump()
return 0
-def is_network_prepared():
+def net_is_prepared():
"""If the any device exists, then assume that all networking
has been configured"""
out = lctl.device_list()
except IOError, e:
log(e)
return 0
-
+
+def kmod_find(src_dir, dev_dir, modname):
+ modbase = src_dir +'/'+ dev_dir +'/'+ modname
+ for modext in '.ko', '.o':
+ module = modbase + modext
+ try:
+ if os.access(module, os.R_OK):
+ return module
+ except OSError:
+ pass
+ return None
+
+def kmod_info(modname):
+ """Returns reference count for passed module name."""
+ try:
+ fp = open('/proc/modules')
+ lines = fp.readlines()
+ fp.close()
+
+ # please forgive my tired fingers for this one
+ ret = filter(lambda word, mod = modname: word[0] == mod,
+ map(lambda line: string.split(line), lines))
+ if not ret:
+ return ''
+ return ret[0]
+ except Exception, e:
+ return 0
class kmod:
+ """Presents kernel module"""
+ def __init__(self, src_dir, dev_dir, name):
+ self.src_dir = src_dir
+ self.dev_dir = dev_dir
+ self.name = name
+
+ def load(self):
+ """Load module"""
+ log ('loading module:', self.name, 'srcdir',
+ self.src_dir, 'devdir', self.dev_dir)
+ if self.src_dir:
+ module = kmod_find(self.src_dir, self.dev_dir,
+ self.name)
+ if not module:
+ panic('module not found:', self.name)
+ (rc, out) = run('/sbin/insmod', module)
+ if rc:
+ raise CommandError('insmod', out, rc)
+ else:
+ (rc, out) = run('/sbin/modprobe', self.name)
+ if rc:
+ raise CommandError('modprobe', out, rc)
+
+ def cleanup(self):
+ """Unload module"""
+ log('unloading module:', self.name)
+ (rc, out) = run('/sbin/rmmod', self.name)
+ if rc:
+ log('unable to unload module:', self.name +
+ "(" + self.refcount() + ")")
+ logall(out)
+
+ def info(self):
+ """Returns module info if any."""
+ return kmod_info(self.name)
+
+ def loaded(self):
+ """Returns 1 if module is loaded. Otherwise 0 is returned."""
+ if self.info():
+ return 1
+ else:
+ return 0
+
+ def refcount(self):
+ """Returns module refcount."""
+ info = self.info()
+ if not info:
+ return ''
+ return info[2]
+
+ def used(self):
+ """Returns 1 if module is used, otherwise 0 is returned."""
+ info = self.info()
+ if not info:
+ return 0
+ if len(info) > 3:
+ users = info[3]
+ if users and users != '(unused)' and users != '-':
+ return 1
+ else:
+ return 0
+ else:
+ return 0
+
+ def busy(self):
+ """Returns 1 if module is busy, otherwise 0 is returned."""
+ if self.loaded() and (self.used() or self.refcount() != '0'):
+ return 1
+ else:
+ return 0
+
+class kmod_manager:
"""Manage kernel modules"""
def __init__(self, lustre_dir, portals_dir):
self.lustre_dir = lustre_dir
self.portals_dir = portals_dir
self.kmodule_list = []
+ def find_module(self, modname):
+ """Find module by module name"""
+ for mod in self.kmodule_list:
+ if mod.name == modname:
+ return mod
+ return ''
+
def add_portals_module(self, dev_dir, modname):
"""Append a module to list of modules to load."""
- self.kmodule_list.append((self.portals_dir, dev_dir, modname))
+
+ mod = self.find_module(modname)
+ if not mod:
+ mod = kmod(self.portals_dir, dev_dir, modname)
+ self.kmodule_list.append(mod)
def add_lustre_module(self, dev_dir, modname):
"""Append a module to list of modules to load."""
- self.kmodule_list.append((self.lustre_dir, dev_dir, modname))
- def load_module(self):
+ mod = self.find_module(modname)
+ if not mod:
+ mod = kmod(self.lustre_dir, dev_dir, modname)
+ self.kmodule_list.append(mod)
+
+ def load_modules(self):
"""Load all the modules in the list in the order they appear."""
- for src_dir, dev_dir, mod in self.kmodule_list:
- if mod_loaded(mod) and not config.noexec:
+ for mod in self.kmodule_list:
+ if mod.loaded() and not config.noexec:
continue
- log ('loading module:', mod, 'srcdir', src_dir, 'devdir', dev_dir)
- if src_dir:
- module = find_module(src_dir, dev_dir, mod)
- if not module:
- panic('module not found:', mod)
- (rc, out) = run('/sbin/insmod', module)
- if rc:
- raise CommandError('insmod', out, rc)
- else:
- (rc, out) = run('/sbin/modprobe', mod)
- if rc:
- raise CommandError('modprobe', out, rc)
+ mod.load()
- def cleanup_module(self):
+ def cleanup_modules(self):
"""Unload the modules in the list in reverse order."""
rev = self.kmodule_list
rev.reverse()
- for src_dir, dev_dir, mod in rev:
- if not mod_loaded(mod) and not config.noexec:
+ for mod in rev:
+ if (not mod.loaded() or mod.busy()) and not config.noexec:
continue
# debug hack
- if mod == 'portals' and config.dump:
+ if mod.name == 'portals' and config.dump:
lctl.dump(config.dump)
- log('unloading module:', mod)
- (rc, out) = run('/sbin/rmmod', mod)
- if rc:
- log('! unable to unload module:', mod)
- logall(out)
-
+ mod.cleanup()
+
# ============================================================
# Classes to prepare and cleanup the various objects
#
self.uuid = self.db.getUUID()
self._server = None
self._connected = 0
- self.kmod = kmod(config.lustre, config.portals)
-
+
def info(self, *args):
msg = string.join(map(str,args))
print self.module_name + ":", self.name, self.uuid, msg
log(self.module_name, "cleanup failed: ", self.name)
e.dump()
cleanup_error(e.rc)
-
- def add_portals_module(self, dev_dir, modname):
- """Append a module to list of modules to load."""
- self.kmod.add_portals_module(dev_dir, modname)
- def add_lustre_module(self, dev_dir, modname):
- """Append a module to list of modules to load."""
- self.kmod.add_lustre_module(dev_dir, modname)
-
- def load_module(self):
- """Load all the modules in the list in the order they appear."""
- self.kmod.load_module()
-
- def cleanup_module(self):
- """Unload the modules in the list in reverse order."""
- if self.safe_to_clean():
- self.kmod.cleanup_module()
+ def add_module(self, manager):
+ """Adds all needed modules in the order they appear."""
+ return
def safe_to_clean(self):
return 1
-
+
def safe_to_clean_modules(self):
return self.safe_to_clean()
self.generic_nid = 0
self.nid_uuid = self.nid_to_uuid(self.nid)
-
self.hostaddr = self.db.get_hostaddr()
if len(self.hostaddr) == 0:
self.hostaddr.append(self.nid)
panic("unable to set hostaddr for", self.net_type, self.hostaddr[0], self.cluster_id)
debug("hostaddr:", self.hostaddr[0])
- self.add_portals_module("libcfs", 'libcfs')
- self.add_portals_module("portals", 'portals')
+ def add_module(self, manager):
+ manager.add_portals_module("libcfs", 'libcfs')
+ manager.add_portals_module("portals", 'portals')
if node_needs_router():
- self.add_portals_module("router", 'kptlrouter')
+ manager.add_portals_module("router", 'kptlrouter')
if self.net_type == 'tcp':
- self.add_portals_module("knals/socknal", 'ksocknal')
+ manager.add_portals_module("knals/socknal", 'ksocknal')
if self.net_type == 'elan':
- self.add_portals_module("knals/qswnal", 'kqswnal')
+ manager.add_portals_module("knals/qswnal", 'kqswnal')
if self.net_type == 'gm':
- self.add_portals_module("knals/gmnal", 'kgmnal')
+ manager.add_portals_module("knals/gmnal", 'kgmnal')
if self.net_type == 'openib':
- self.add_portals_module("knals/openibnal", 'kopenibnal')
+ manager.add_portals_module("knals/openibnal", 'kopenibnal')
if self.net_type == 'iib':
- self.add_portals_module("knals/iibnal", 'kiibnal')
+ manager.add_portals_module("knals/iibnal", 'kiibnal')
def nid_to_uuid(self, nid):
return "NID_%s_UUID" %(nid,)
def prepare(self):
- if not config.record and is_network_prepared():
+ if not config.record and net_is_prepared():
return
self.info(self.net_type, self.nid, self.port)
if not (config.record and self.generic_nid):
cleanup_error(e.rc)
def safe_to_clean(self):
- return not is_network_prepared()
+ return not net_is_prepared()
def cleanup(self):
self.info(self.net_type, self.nid, self.port)
return Network(srvdb)
def prepare(self):
- if not config.record and is_network_prepared():
+ if not config.record and net_is_prepared():
return
self.info()
for net_type, gw, gw_cluster_id, tgt_cluster_id, lo, hi in self.db.get_route_tbl():
lctl.connect(srv)
def safe_to_clean(self):
- return not is_network_prepared()
+ return not net_is_prepared()
def cleanup(self):
- if is_network_prepared():
+ if net_is_prepared():
# the network is still being used, don't clean it up
return
for net_type, gw, gw_cluster_id, tgt_cluster_id, lo, hi in self.db.get_route_tbl():
e.dump()
cleanup_error(e.rc)
+class Management(Module):
+ def __init__(self, db):
+ Module.__init__(self, 'MGMT', db)
+
+ def add_module(self, manager):
+ manager.add_lustre_module('lvfs', 'lvfs')
+ manager.add_lustre_module('obdclass', 'obdclass')
+ manager.add_lustre_module('ptlrpc', 'ptlrpc')
+ manager.add_lustre_module('mgmt', 'mgmt_svc')
+
+ def prepare(self):
+ if not config.record and is_prepared(self.name):
+ return
+ self.info()
+ lctl.newdev("mgmt", self.name, self.uuid)
+
+ def safe_to_clean(self):
+ return 1
+
+ def cleanup(self):
+ if is_prepared(self.name):
+ Module.cleanup(self)
+
+ def correct_level(self, level, op=None):
+ return level
+
# This is only needed to load the modules; the LDLM device
# is now created automatically.
class LDLM(Module):
def __init__(self,db):
Module.__init__(self, 'LDLM', db)
- self.add_lustre_module('lvfs', 'lvfs')
- self.add_lustre_module('obdclass', 'obdclass')
- self.add_lustre_module('ptlrpc', 'ptlrpc')
+
+ def add_module(self, manager):
+ manager.add_lustre_module('lvfs', 'lvfs')
+ manager.add_lustre_module('obdclass', 'obdclass')
+ manager.add_lustre_module('ptlrpc', 'ptlrpc')
def prepare(self):
return
def correct_level(self, level, op=None):
return level
-
class LOV(Module):
def __init__(self, db, uuid, fs_name, name_override = None, config_only = None):
Module.__init__(self, 'LOV', db)
if name_override != None:
self.name = "lov_%s" % name_override
- self.add_lustre_module('lov', 'lov')
self.mds_uuid = self.db.get_first_ref('mds')
self.stripe_sz = self.db.get_val_int('stripesize', 1048576)
self.stripe_off = self.db.get_val_int('stripeoffset', 0)
if self.config_only:
panic("Can't clean up config_only LOV ", self.name)
- def load_module(self):
+ def add_module(self, manager):
if self.config_only:
panic("Can't load modules for config_only LOV ", self.name)
for (osc, index, gen, active) in self.osclist:
- osc.load_module()
- break
- Module.load_module(self)
-
- def cleanup_module(self):
- if self.config_only:
- panic("Can't cleanup modules for config_only LOV ", self.name)
- Module.cleanup_module(self)
- for (osc, index, gen, active) in self.osclist:
- if active:
- osc.cleanup_module()
+ osc.add_module(manager)
break
+ manager.add_lustre_module('lov', 'lov')
def correct_level(self, level, op=None):
return level
Module.__init__(self, 'LMV', db)
if name_override != None:
self.name = "lmv_%s" % name_override
- self.add_lustre_module('lmv', 'lmv')
self.devlist = self.db.get_refs('mds')
self.mdclist = []
self.desc_uuid = self.uuid
if is_prepared(self.name):
Module.cleanup(self)
- def load_module(self):
+ def add_module(self, manager):
for mdc in self.mdclist:
- mdc.load_module()
- break
- Module.load_module(self)
-
- def cleanup_module(self):
- Module.cleanup_module(self)
- for mdc in self.mdclist:
- mdc.cleanup_module()
+ mdc.add_module(manager)
break
+ manager.add_lustre_module('lmv', 'lmv')
def correct_level(self, level, op=None):
return level
self.nspath = self.db.get_val('nspath', '')
self.mkfsoptions = self.db.get_val('mkfsoptions', '')
self.mountfsoptions = self.db.get_val('mountfsoptions', '')
+ self.obdtype = self.db.get_val('obdtype', '')
self.root_squash = self.db.get_val('root_squash', '')
self.no_root_squash = self.db.get_val('no_root_squash', '')
- self.cachetype = self.db.get_val('cachetype', '')
# overwrite the orignal MDSDEV name and uuid with the MDS name and uuid
target_uuid = self.db.get_first_ref('target')
- mds = self.db.lookup(target_uuid)
- self.name = mds.getName()
- self.filesystem_uuids = mds.get_refs('filesystem')
- self.lmv_uuid = ''
+ self.mds = self.db.lookup(target_uuid)
+ self.name = self.mds.getName()
+ self.client_uuids = self.mds.get_refs('client')
+
+ # LMV instance
+ self.lmv_uuid = ""
self.lmv = ''
- self.master_mds = ""
- if not self.filesystem_uuids:
- self.lmv_uuid = self.db.get_first_ref('lmv')
- if not self.lmv_uuid:
- panic("ALERT: can't find lvm uuid")
- if self.lmv_uuid:
- self.lmv = self.db.lookup(self.lmv_uuid)
- if self.lmv:
- self.filesystem_uuids = self.lmv.get_refs('filesystem')
- self.master_mds = self.lmv_uuid
+
+ self.master_uuid = ""
+ self.master = ''
+
+ # it is possible to have MDS with no clients. It is master MDS
+ # in configuration with CMOBD.
+ self.lmv_uuid = self.db.get_first_ref('lmv')
+ if self.lmv_uuid:
+ self.lmv = self.db.lookup(self.lmv_uuid)
+ if self.lmv:
+ self.client_uuids = self.lmv.get_refs('client')
+ self.master_uuid = self.lmv_uuid
+
# FIXME: if fstype not set, then determine based on kernel version
self.format = self.db.get_val('autoformat', "no")
- if mds.get_val('failover', 0):
+ if self.mds.get_val('failover', 0):
self.failover_mds = 'f'
else:
self.failover_mds = 'n'
- active_uuid = get_active_target(mds)
+ active_uuid = get_active_target(self.mds)
if not active_uuid:
panic("No target device found:", target_uuid)
if active_uuid == self.uuid:
self.active = 1
else:
self.active = 0
- if self.active and config.group and config.group != mds.get_val('group'):
+ if self.active and config.group and config.group != self.mds.get_val('group'):
self.active = 0
- self.inode_size = self.db.get_val_int('inodesize', 0)
- if self.inode_size == 0:
+ # default inode inode for case when neither LOV either
+ # LMV is accessible.
+ self.inode_size = 256
+
+ inode_size = self.db.get_val_int('inodesize', 0)
+ if not inode_size == 0:
+ self.inode_size = inode_size
+ else:
# find the LOV for this MDS
- lovconfig_uuid = mds.get_first_ref('lovconfig')
- if not lovconfig_uuid:
- if not self.lmv_uuid:
- panic("No LOV found for lovconfig ", lovconfig.name)
-
- if not self.lmv:
- panic("No LMV initialized and not lovconfig_uuid found")
-
- lovconfig_uuid = self.lmv.get_first_ref('lovconfig')
- lovconfig = self.lmv.lookup(lovconfig_uuid)
- lov_uuid = lovconfig.get_first_ref('lov')
- if not lov_uuid:
- panic("No LOV found for lovconfig ", lovconfig.name)
- else:
- lovconfig = mds.lookup(lovconfig_uuid)
- lov_uuid = lovconfig.get_first_ref('lov')
- if not lov_uuid:
- panic("No LOV found for lovconfig ", lovconfig.name)
-
- if self.lmv:
- lovconfig_uuid = self.lmv.get_first_ref('lovconfig')
- lovconfig = self.lmv.lookup(lovconfig_uuid)
- lov_uuid = lovconfig.get_first_ref('lov')
-
- lov = LOV(self.db.lookup(lov_uuid), lov_uuid, 'FS_name', config_only = 1)
-
- # default stripe count controls default inode_size
- if (lov.stripe_cnt > 0):
+ lovconfig_uuid = self.mds.get_first_ref('lovconfig')
+ if lovconfig_uuid or self.lmv:
+ if self.lmv:
+ lovconfig_uuid = self.lmv.get_first_ref('lovconfig')
+ lovconfig = self.lmv.lookup(lovconfig_uuid)
+ lov_uuid = lovconfig.get_first_ref('lov')
+ if not lov_uuid:
+ panic(self.mds.getName() + ": No LOV found for lovconfig ",
+ lovconfig.name)
+ else:
+ lovconfig = self.mds.lookup(lovconfig_uuid)
+ lov_uuid = lovconfig.get_first_ref('lov')
+ if not lov_uuid:
+ panic(self.mds.getName() + ": No LOV found for lovconfig ",
+ lovconfig.name)
+
+ if self.lmv:
+ lovconfig_uuid = self.lmv.get_first_ref('lovconfig')
+ lovconfig = self.lmv.lookup(lovconfig_uuid)
+ lov_uuid = lovconfig.get_first_ref('lov')
+
+ lov = LOV(self.db.lookup(lov_uuid), lov_uuid, 'FS_name',
+ config_only = 1)
+
+ # default stripe count controls default inode_size
stripe_count = lov.stripe_cnt
- else:
- stripe_count = len(lov.devlist)
- if stripe_count > 77:
- self.inode_size = 4096
- elif stripe_count > 35:
- self.inode_size = 2048
- elif stripe_count > 13:
- self.inode_size = 1024
- elif stripe_count > 3:
- self.inode_size = 512
- else:
- self.inode_size = 256
+ if stripe_count > 77:
+ self.inode_size = 4096
+ elif stripe_count > 35:
+ self.inode_size = 2048
+ elif stripe_count > 13:
+ self.inode_size = 1024
+ elif stripe_count > 3:
+ self.inode_size = 512
+ else:
+ self.inode_size = 256
self.target_dev_uuid = self.uuid
self.uuid = target_uuid
+
# setup LMV
- if self.master_mds:
- client_uuid = generate_client_uuid(self.name)
+ if self.master_uuid:
client_uuid = self.name + "_lmv_" + "UUID"
- self.master = LMV(self.db.lookup(self.lmv_uuid), client_uuid, self.name, self.name)
- self.master_mds = self.master.name
+ self.master = LMV(self.db.lookup(self.lmv_uuid), client_uuid,
+ self.name, self.name)
+ self.master_uuid = self.master.name
- # modules
- self.add_lustre_module('mdc', 'mdc')
- self.add_lustre_module('osc', 'osc')
- self.add_lustre_module('lov', 'lov')
- self.add_lustre_module('lmv', 'lmv')
- self.add_lustre_module('ost', 'ost')
- self.add_lustre_module('mds', 'mds')
+ def add_module(self, manager):
+ if self.active:
+ manager.add_lustre_module('mdc', 'mdc')
+ manager.add_lustre_module('osc', 'osc')
+ manager.add_lustre_module('ost', 'ost')
+ manager.add_lustre_module('lov', 'lov')
+ manager.add_lustre_module('mds', 'mds')
- if self.fstype == 'smfs':
- self.add_lustre_module('smfs', 'smfs')
+ if self.fstype == 'smfs':
+ manager.add_lustre_module('smfs', 'smfs')
+
+ if self.fstype == 'ldiskfs':
+ manager.add_lustre_module('ldiskfs', 'ldiskfs')
- if self.fstype == 'ldiskfs':
- self.add_lustre_module('ldiskfs', 'ldiskfs')
+ if self.fstype:
+ manager.add_lustre_module('lvfs', 'fsfilt_%s' % (self.fstype))
+
+ # if fstype is smfs, then we should also take care about backing
+ # store fs.
+ if self.fstype == 'smfs':
+ manager.add_lustre_module('lvfs', 'fsfilt_%s' % (self.backfstype))
- if self.fstype:
- self.add_lustre_module('lvfs', 'fsfilt_%s' % (self.fstype))
+ for option in string.split(self.mountfsoptions, ','):
+ if option == 'snap':
+ if not self.fstype == 'smfs':
+ panic("mountoptions has 'snap', but fstype is not smfs.")
+ manager.add_lustre_module('lvfs', 'fsfilt_snap_%s' % (self.fstype))
+ manager.add_lustre_module('lvfs', 'fsfilt_snap_%s' % (self.backfstype))
- # if fstype is smfs, then we should also take care about backing
- # store fs.
- if self.fstype == 'smfs':
- self.add_lustre_module('lvfs', 'fsfilt_%s' % (self.backfstype))
-
- for options in string.split(self.mountfsoptions, ','):
- if options == 'snap':
- if not self.fstype == 'smfs':
- panic("mountoptions with snap, but fstype is not smfs\n")
- self.add_lustre_module('lvfs', 'fsfilt_snap_%s' % (self.fstype))
- self.add_lustre_module('lvfs', 'fsfilt_snap_%s' % (self.backfstype))
- def load_module(self):
- if self.active:
- Module.load_module(self)
+ # add LMV modules
+ if self.master_uuid:
+ self.master.add_module(manager)
def prepare(self):
if not config.record and is_prepared(self.name):
self.write_conf()
self.info(self.devpath, self.fstype, self.size, self.format)
run_acceptors()
+
# prepare LMV
- if self.master_mds:
+ if self.master_uuid:
self.master.prepare()
+
# never reformat here
blkdev = block_dev(self.devpath, self.size, self.fstype, 0,
self.format, self.journal_size, self.inode_size,
self.mkfsoptions, self.backfstype, self.backdevpath)
-
+
if not is_prepared('MDT'):
lctl.newdev("mdt", 'MDT', 'MDT_UUID', setup ="")
- try:
+ try:
mountfsoptions = def_mount_options(self.fstype, 'mds')
-
+
if config.mountfsoptions:
if mountfsoptions:
mountfsoptions = mountfsoptions + ',' + config.mountfsoptions
mountfsoptions = mountfsoptions + ',' + self.mountfsoptions
else:
mountfsoptions = self.mountfsoptions
-
+
if self.fstype == 'smfs':
realdev = self.fstype
-
+
if mountfsoptions:
- mountfsoptions = "%s,type=%s,dev=%s" % (mountfsoptions,
- self.backfstype,
+ mountfsoptions = "%s,type=%s,dev=%s" % (mountfsoptions,
+ self.backfstype,
blkdev)
else:
- mountfsoptions = "type=%s,dev=%s" % (self.backfstype,
+ mountfsoptions = "type=%s,dev=%s" % (self.backfstype,
blkdev)
else:
realdev = blkdev
-
+
print 'MDS mount options: ' + mountfsoptions
-
- if not self.master_mds:
- self.master_mds = 'dumb'
- if not self.cachetype:
- self.cachetype = 'dumb'
- lctl.newdev("mds", self.name, self.uuid,
- setup ="%s %s %s %s %s %s" %(realdev, self.fstype,
+
+ if not self.master_uuid:
+ self.master_uuid = 'dumb'
+
+ if not self.obdtype:
+ self.obdtype = 'dumb'
+
+ if not self.client_uuids:
+ lctl.newdev("mds", self.name, self.uuid,
+ setup ="%s %s %s %s %s %s" %(realdev, self.fstype,
+ 'dumb', mountfsoptions,
+ self.master_uuid, self.obdtype))
+ else:
+ lctl.newdev("mds", self.name, self.uuid,
+ setup ="%s %s %s %s %s %s" %(realdev, self.fstype,
self.name, mountfsoptions,
- self.master_mds, self.cachetype))
+ self.master_uuid, self.obdtype))
if development_mode():
procentry = "/proc/fs/lustre/mds/grp_hash_upcall"
lctl.root_squash(self.name, config.root_squash, nsnid)
def write_conf(self):
+ if not self.client_uuids:
+ return 0
+
do_cleanup = 0
if not is_prepared(self.name):
self.info(self.devpath, self.fstype, self.format)
if self.fstype == 'smfs':
realdev = self.fstype
-
+
if mountfsoptions:
- mountfsoptions = "%s,type=%s,dev=%s" % (mountfsoptions,
- self.backfstype,
+ mountfsoptions = "%s,type=%s,dev=%s" % (mountfsoptions,
+ self.backfstype,
blkdev)
else:
- mountfsoptions = "type=%s,dev=%s" % (self.backfstype,
+ mountfsoptions = "type=%s,dev=%s" % (self.backfstype,
blkdev)
else:
realdev = blkdev
-
- print 'MDS mount options: ' + mountfsoptions
+
+ print 'MDS mount options: ' + mountfsoptions
- # As mount options are passed by 4th param to config tool, we need
+ if not self.obdtype:
+ self.obdtype = 'dumb'
+
+ # As mount options are passed by 4th param to config tool, we need
# to pass something in 3rd param. But we do not want this 3rd param
# be counted as a profile name for reading log on MDS setup, thus,
- # we pass there some predefined sign like 'dumb', which will be
+ # we pass there some predefined sign like 'dumb', which will be
# checked in MDS code and skipped. Probably there is more nice way
# like pass empty string and check it in config tool and pass null
# as 4th param.
lctl.newdev("mds", self.name, self.uuid,
- setup ="%s %s %s %s" %(realdev, self.fstype,
- 'dumb', mountfsoptions))
+ setup ="%s %s %s %s %s %s" %(realdev, self.fstype,
+ 'dumb', mountfsoptions,
+ 'dumb', self.obdtype))
do_cleanup = 1
- # record logs for the MDS lov
- for uuid in self.filesystem_uuids:
- log("recording clients for filesystem:", uuid)
- fs = self.db.lookup(uuid)
-
- # this is ugly, should be organized nice later.
- target_uuid = self.db.get_first_ref('target')
- mds = self.db.lookup(target_uuid)
-
- lovconfig_uuid = mds.get_first_ref('lovconfig')
- if lovconfig_uuid:
- lovconfig = mds.lookup(lovconfig_uuid)
- obd_uuid = lovconfig.get_first_ref('lov')
- else:
- obd_uuid = fs.get_first_ref('obd')
+ # record logs for all MDS clients
+ for obd_uuid in self.client_uuids:
+ log("recording client:", obd_uuid)
client_uuid = generate_client_uuid(self.name)
- client = VOSC(self.db.lookup(obd_uuid), client_uuid, self.name,
- self.name)
+ client = VOSC(self.db.lookup(obd_uuid), client_uuid,
+ self.name, self.name)
config.record = 1
lctl.clear_log(self.name, self.name)
lctl.record(self.name, self.name)
e.dump()
cleanup_error(e.rc)
Module.cleanup(self)
-
- if self.fstype == 'smfs':
- clean_loop(self.backdevpath)
- else:
- clean_loop(self.devpath)
+
+ clean_dev(self.devpath, self.fstype, self.backfstype,
+ self.backdevpath)
def msd_remaining(self):
out = lctl.device_list()
def safe_to_clean_modules(self):
return not self.msd_remaining()
-
+
def cleanup(self):
if not self.active:
debug(self.uuid, "not active")
cleanup_error(e.rc)
Module.cleanup(self)
# cleanup LMV
- if self.master_mds:
+ if self.master_uuid:
self.master.cleanup()
if not self.msd_remaining() and is_prepared('MDT'):
try:
print "cleanup failed: ", self.name
e.dump()
cleanup_error(e.rc)
-
- if self.fstype == 'smfs':
- clean_loop(self.backdevpath)
- else:
- clean_loop(self.devpath)
+
+ clean_dev(self.devpath, self.fstype, self.backfstype,
+ self.backdevpath)
def correct_level(self, level, op=None):
- #if self.master_mds:
+ #if self.master_uuid:
# level = level + 2
return level
self.active = 0
if self.active and config.group and config.group != ost.get_val('group'):
self.active = 0
-
+
self.target_dev_uuid = self.uuid
self.uuid = target_uuid
- # modules
- self.add_lustre_module('ost', 'ost')
- if self.fstype == 'smfs':
- self.add_lustre_module('smfs', 'smfs')
- # FIXME: should we default to ext3 here?
- if self.fstype == 'ldiskfs':
- self.add_lustre_module('ldiskfs', 'ldiskfs')
- if self.fstype:
- self.add_lustre_module('lvfs' , 'fsfilt_%s' % (self.fstype))
- if self.fstype == 'smfs':
- self.add_lustre_module('lvfs' , 'fsfilt_%s' % (self.backfstype))
-
- for options in self.mountfsoptions:
- if options == 'snap':
- if not self.fstype == 'smfs':
- panic("mountoptions with snap, but fstype is not smfs\n")
- self.add_lustre_module('lvfs', 'fsfilt_snap_%s' % (self.fstype))
- self.add_lustre_module('lvfs', 'fsfilt_snap_%s' % (self.backfstype))
+
+ def add_module(self, manager):
+ if self.active:
+ manager.add_lustre_module('ost', 'ost')
+
+ if self.fstype == 'smfs':
+ manager.add_lustre_module('smfs', 'smfs')
+
+ if self.fstype == 'ldiskfs':
+ manager.add_lustre_module('ldiskfs', 'ldiskfs')
+ if self.fstype:
+ manager.add_lustre_module('lvfs' , 'fsfilt_%s' % (self.fstype))
+ if self.fstype == 'smfs':
+ manager.add_lustre_module('lvfs' , 'fsfilt_%s' % (self.backfstype))
- self.add_lustre_module(self.osdtype, self.osdtype)
+ for option in self.mountfsoptions:
+ if option == 'snap':
+ if not self.fstype == 'smfs':
+ panic("mountoptions with snap, but fstype is not smfs\n")
+ manager.add_lustre_module('lvfs', 'fsfilt_snap_%s' % (self.fstype))
+ manager.add_lustre_module('lvfs', 'fsfilt_snap_%s' % (self.backfstype))
- def load_module(self):
- if self.active:
- Module.load_module(self)
+ manager.add_lustre_module(self.osdtype, self.osdtype)
# need to check /proc/mounts and /etc/mtab before
# formatting anything.
self.backdevpath)
mountfsoptions = def_mount_options(self.fstype, 'ost')
-
+
if config.mountfsoptions:
if mountfsoptions:
mountfsoptions = mountfsoptions + ',' + config.mountfsoptions
mountfsoptions = mountfsoptions + ',' + self.mountfsoptions
else:
mountfsoptions = self.mountfsoptions
-
+
if self.fstype == 'smfs':
realdev = self.fstype
-
+
if mountfsoptions:
- mountfsoptions = "%s,type=%s,dev=%s" % (mountfsoptions,
- self.backfstype,
+ mountfsoptions = "%s,type=%s,dev=%s" % (mountfsoptions,
+ self.backfstype,
blkdev)
else:
- mountfsoptions = "type=%s,dev=%s" % (self.backfstype,
+ mountfsoptions = "type=%s,dev=%s" % (self.backfstype,
blkdev)
else:
realdev = blkdev
-
+
print 'OSD mount options: ' + mountfsoptions
-
+
lctl.newdev(self.osdtype, self.name, self.uuid,
setup ="%s %s %s %s" %(realdev, self.fstype,
- self.failover_ost,
+ self.failover_ost,
mountfsoptions))
if not is_prepared('OSS'):
lctl.newdev("ost", 'OSS', 'OSS_UUID', setup ="")
e.dump()
cleanup_error(e.rc)
if not self.osdtype == 'obdecho':
- if self.fstype == 'smfs':
- clean_loop(self.backdevpath)
- else:
- clean_loop(self.devpath)
+ clean_dev(self.devpath, self.fstype, self.backfstype,
+ self.backdevpath)
def correct_level(self, level, op=None):
return level
+def mgmt_uuid_for_fs(mtpt_name):
+ if not mtpt_name:
+ return ''
+ mtpt_db = toplustreDB.lookup_name(mtpt_name)
+ fs_uuid = mtpt_db.get_first_ref('filesystem')
+ fs = toplustreDB.lookup(fs_uuid)
+ if not fs:
+ return ''
+ return fs.get_first_ref('mgmt')
+
# Generic client module, used by OSC and MDC
class Client(Module):
def __init__(self, tgtdb, uuid, module, fs_name, self_name=None,
module_dir=None):
self.target_name = tgtdb.getName()
self.target_uuid = tgtdb.getUUID()
+ self.module_dir = module_dir
+ self.module = module
self.db = tgtdb
self.active = 1
- self.backup_targets = []
- self.tgt_dev_uuid = get_active_target(tgtdb)
+ self.tgt_dev_uuid = get_active_target(tgtdb)
if not self.tgt_dev_uuid:
panic("No target device found for target(1):", self.target_name)
- self.kmod = kmod(config.lustre, config.portals)
self._server = None
self._connected = 0
self.name = self_name
self.uuid = uuid
self.lookup_server(self.tgt_dev_uuid)
-
- self.lookup_backup_targets()
+ mgmt_uuid = mgmt_uuid_for_fs(fs_name)
+ if mgmt_uuid:
+ self.mgmt_name = mgmtcli_name_for_uuid(mgmt_uuid)
+ else:
+ self.mgmt_name = ''
self.fs_name = fs_name
- if not module_dir:
- module_dir = module
- self.add_lustre_module(module_dir, module)
+ if not self.module_dir:
+ self.module_dir = module
+
+ def add_module(self, manager):
+ manager.add_lustre_module(self.module_dir, self.module)
def lookup_server(self, srv_uuid):
""" Lookup a server's network information """
self._server_nets = get_ost_net(self.db, srv_uuid)
if len(self._server_nets) == 0:
panic ("Unable to find a server for:", srv_uuid)
+
def get_name(self):
return self.name
+
def get_servers(self):
return self._server_nets
- def lookup_backup_targets(self):
- """ Lookup alternative network information """
- prof_list = toplustreDB.get_refs('profile')
- for prof_uuid in prof_list:
- prof_db = toplustreDB.lookup(prof_uuid)
- if not prof_db:
- panic("profile:", prof_uuid, "not found.")
- for ref_class, ref_uuid in prof_db.get_all_refs():
- if ref_class in ('osd', 'mdsdev'):
- devdb = toplustreDB.lookup(ref_uuid)
- uuid = devdb.get_first_ref('target')
- if self.target_uuid == uuid and self.tgt_dev_uuid != ref_uuid:
- self.backup_targets.append(ref_uuid)
def prepare(self, ignore_connect_failure = 0):
self.info(self.target_uuid)
debug("%s active" % self.target_uuid)
inactive_p = ""
lctl.newdev(self.module, self.name, self.uuid,
- setup ="%s %s %s" % (self.target_uuid, srv.nid_uuid,
- inactive_p))
- for tgt_dev_uuid in self.backup_targets:
- this_nets = get_ost_net(toplustreDB, tgt_dev_uuid)
- if len(this_nets) == 0:
- panic ("Unable to find a server for:", tgt_dev_uuid)
- srv = choose_local_server(this_nets)
- if srv:
- lctl.connect(srv)
- else:
- routes = find_route(this_nets);
- if len(routes) == 0:
- panic("no route to", tgt_dev_uuid)
- for (srv, r) in routes:
- lctl.add_route_host(r[0]. srv.nid_uuid, r[1], r[3])
- if srv:
- lctl.add_conn(self.name, srv.nid_uuid);
+ setup ="%s %s %s %s" % (self.target_uuid, srv.nid_uuid,
+ inactive_p, self.mgmt_name))
def cleanup(self):
if is_prepared(self.name):
e.dump()
cleanup_error(e.rc)
- for tgt_dev_uuid in self.backup_targets:
- this_net = get_ost_net(toplustreDB, tgt_dev_uuid)
- srv = choose_local_server(this_net)
- if srv:
- lctl.disconnect(srv)
- else:
- for (srv, r) in find_route(this_net):
- lctl.del_route_host(r[0]. srv.nid_uuid, r[1], r[3])
-
-
def correct_level(self, level, op=None):
return level
def permits_inactive(self):
return 1
-class VLOV(Module):
- def __init__(self, db, uuid, fs_name, name_override = None, config_only = None):
- Module.__init__(self, 'VLOV', db)
- if name_override != None:
- self.name = "lov_%s" % name_override
- self.add_lustre_module('lov', 'lov')
- self.stripe_sz = 65536
- self.stripe_off = 0
- self.pattern = 0
- self.stripe_cnt = 1
- self.desc_uuid = self.uuid
- self.uuid = generate_client_uuid(self.name)
- self.fs_name = fs_name
- self.osc = get_osc(db, self.uuid, fs_name)
- if not self.osc:
- panic('osc not found:', self.uuid)
- if config_only:
- self.config_only = 1
- return
- self.config_only = None
- def get_uuid(self):
- return self.uuid
- def get_name(self):
- return self.name
- def prepare(self):
- if not config.record and is_prepared(self.name):
- return
- lctl.lov_setup(self.name, self.uuid, self.desc_uuid, self.stripe_cnt,
- self.stripe_sz, self.stripe_off, self.pattern)
- target_uuid = self.osc.target_uuid
- try:
- self.osc.active = 1
- self.osc.prepare(ignore_connect_failure=0)
- except CommandError, e:
- print "Error preparing OSC %s\n" % osc.uuid
- raise e
- lctl.lov_add_obd(self.name, self.uuid, target_uuid, 0, 1)
+def mgmtcli_name_for_uuid(uuid):
+ return 'MGMTCLI_%s' % uuid
- def cleanup(self):
- target_uuid = self.osc.target_uuid
- self.osc.cleanup()
- if is_prepared(self.name):
- Module.cleanup(self)
- if self.config_only:
- panic("Can't clean up config_only LOV ", self.name)
-
- def load_module(self):
- if self.config_only:
- panic("Can't load modules for config_only LOV ", self.name)
- self.osc.load_module()
- Module.load_module(self)
-
- def cleanup_module(self):
- if self.config_only:
- panic("Can't cleanup modules for config_only LOV ", self.name)
- Module.cleanup_module(self)
- self.osc.cleanup_module()
-
- def correct_level(self, level, op=None):
- return level
+class ManagementClient(Client):
+ def __init__(self, db, uuid):
+ Client.__init__(self, db, uuid, 'mgmt_cli', '',
+ self_name = mgmtcli_name_for_uuid(db.getUUID()),
+ module_dir = 'mgmt')
class CMOBD(Module):
- def __init__(self,db):
+ def __init__(self, db):
Module.__init__(self, 'CMOBD', db)
- self.name = self.db.getName();
+ self.name = self.db.getName();
self.uuid = generate_client_uuid(self.name)
self.master_uuid = self.db.get_first_ref('masterobd')
self.cache_uuid = self.db.get_first_ref('cacheobd')
- self.add_lustre_module('cmobd', 'cmobd')
+
master_obd = self.db.lookup(self.master_uuid)
if not master_obd:
panic('master obd not found:', self.master_uuid)
+
cache_obd = self.db.lookup(self.cache_uuid)
if not cache_obd:
panic('cache obd not found:', self.cache_uuid)
-
- if master_obd.get_class() == 'ost':
- self.client_uuid = generate_client_uuid(self.name)
- self.master= VLOV(master_obd, self.client_uuid, self.name,
- "%s_master" % (self.name))
- self.master_uuid = self.master.get_uuid()
- else:
- self.master = get_mdc(db, self.name, self.master_uuid)
+
+ master_class = master_obd.get_class()
+ cache_class = cache_obd.get_class()
+
+ if master_class == 'ost' or master_class == 'lov':
+ self.master = LOV(master_obd, self.master_uuid, self.name,
+ "%s_master" % (self.name));
+ self.cache = LOV(cache_obd, self.cache_uuid, self.name,
+ "%s_cache" % (self.name));
+ if master_class == 'mds':
+ self.master = get_mdc(db, self.name, self.master_uuid)
+ if cache_class == 'mds':
+ self.cache = get_mdc(db, self.name, self.cache_uuid)
+
+ if master_class == 'lmv':
+ self.master = LMV(master_obd, self.master_uuid, self.name,
+ "%s_master" % (self.name));
+ if cache_class == 'lmv':
+ self.cache = LMV(cache_obd, self.cache_uuid, self.name,
+ "%s_cache" % (self.name));
+
# need to check /proc/mounts and /etc/mtab before
# formatting anything.
# FIXME: check if device is already formatted.
setup ="%s %s" %(self.master_uuid,
self.cache_uuid))
+ def get_uuid(self):
+ return self.uuid
+ def get_name(self):
+ return self.name
+ def get_master_name(self):
+ return self.master.name
+ def get_cache_name(self):
+ return self.cache.name
+
def cleanup(self):
if is_prepared(self.name):
Module.cleanup(self)
self.master.cleanup()
- def load_module(self):
- self.master.load_module()
- Module.load_module(self)
-
- def cleanup_module(self):
- Module.cleanup_module(self)
- self.master.cleanup_module()
+ def add_module(self, manager):
+ manager.add_lustre_module('cmobd', 'cmobd')
+ self.master.add_module(manager)
def correct_level(self, level, op=None):
return level
class COBD(Module):
- def __init__(self, db, uuid, name, type, name_override = None):
+ def __init__(self, db, uuid, name):
Module.__init__(self, 'COBD', db)
- self.name = self.db.getName();
+ self.name = self.db.getName();
self.uuid = generate_client_uuid(self.name)
- self.real_uuid = self.db.get_first_ref('realobd')
+ self.master_uuid = self.db.get_first_ref('masterobd')
self.cache_uuid = self.db.get_first_ref('cacheobd')
- self.add_lustre_module('cobd', 'cobd')
- real_obd = self.db.lookup(self.real_uuid)
- if not real_obd:
- panic('real obd not found:', self.real_uuid)
+
+ master_obd = self.db.lookup(self.master_uuid)
+ if not master_obd:
+ panic('master obd not found:', self.master_uuid)
+
cache_obd = self.db.lookup(self.cache_uuid)
if not cache_obd:
panic('cache obd not found:', self.cache_uuid)
- if type == 'obd':
- self.real = LOV(real_obd, self.real_uuid, name,
- "%s_real" % (self.name));
- self.cache = LOV(cache_obd, self.cache_uuid, name,
- "%s_cache" % (self.name));
- else:
- self.real = get_mdc(db, name, self.real_uuid)
+
+ master_class = master_obd.get_class()
+ cache_class = cache_obd.get_class()
+
+ if master_class == 'ost' or master_class == 'lov':
+ self.master = LOV(master_obd, self.master_uuid, name,
+ "%s_master" % (self.name));
+ self.cache = LOV(cache_obd, self.cache_uuid, name,
+ "%s_cache" % (self.name));
+ if master_class == 'mds':
+ self.master = get_mdc(db, name, self.master_uuid)
+ if cache_class == 'mds':
self.cache = get_mdc(db, name, self.cache_uuid)
+
+ if master_class == 'lmv':
+ self.master = LMV(master_obd, self.master_uuid, self.name,
+ "%s_master" % (self.name));
+ if cache_class == 'lmv':
+ self.cache = LMV(cache_obd, self.cache_uuid, self.name,
+ "%s_cache" % (self.name));
+
# need to check /proc/mounts and /etc/mtab before
# formatting anything.
# FIXME: check if device is already formatted.
def get_uuid(self):
return self.uuid
+
def get_name(self):
return self.name
- def get_real_name(self):
- return self.real.name
+
+ def get_master_name(self):
+ return self.master.name
+
def get_cache_name(self):
return self.cache.name
+
def prepare(self):
- self.real.prepare()
+ self.master.prepare()
self.cache.prepare()
if not config.record and is_prepared(self.name):
return
- self.info(self.real_uuid, self.cache_uuid)
+ self.info(self.master_uuid, self.cache_uuid)
lctl.newdev("cobd", self.name, self.uuid,
- setup ="%s %s" %(self.real.name,
+ setup ="%s %s" %(self.master.name,
self.cache.name))
def cleanup(self):
if is_prepared(self.name):
Module.cleanup(self)
- self.real.cleanup()
+ self.master.cleanup()
self.cache.cleanup()
- def load_module(self):
- self.real.load_module()
- Module.load_module(self)
-
- def cleanup_module(self):
- Module.cleanup_module(self)
- self.real.cleanup_module()
+ def add_module(self, manager):
+ manager.add_lustre_module('cobd', 'cobd')
+ self.master.add_module(manager)
# virtual interface for OSC and LOV
class VOSC(Module):
self.osc = LOV(db, client_uuid, name, name_override)
self.type = 'lov'
elif db.get_class() == 'cobd':
- self.osc = COBD(db, client_uuid, name, 'obd')
+ self.osc = COBD(db, client_uuid, name)
self.type = 'cobd'
else:
self.osc = OSC(db, client_uuid, name)
self.type = 'osc'
+
def get_uuid(self):
return self.osc.get_uuid()
+
def get_name(self):
return self.osc.get_name()
+
def prepare(self):
self.osc.prepare()
+
def cleanup(self):
self.osc.cleanup()
- def load_module(self):
- self.osc.load_module()
- def cleanup_module(self):
- self.osc.cleanup_module()
+
+ def add_module(self, manager):
+ self.osc.add_module(manager)
+
def correct_level(self, level, op=None):
return self.osc.correct_level(level, op)
if db.get_class() == 'lmv':
self.mdc = LMV(db, client_uuid, name)
elif db.get_class() == 'cobd':
- self.mdc = COBD(db, client_uuid, name, 'mds')
+ self.mdc = COBD(db, client_uuid, name)
else:
self.mdc = MDC(db, client_uuid, name)
+
def get_uuid(self):
return self.mdc.uuid
+
def get_name(self):
return self.mdc.name
+
def prepare(self):
self.mdc.prepare()
+
def cleanup(self):
self.mdc.cleanup()
- def load_module(self):
- self.mdc.load_module()
- def cleanup_module(self):
- self.mdc.cleanup_module()
+
+ def add_module(self, manager):
+ self.mdc.add_module(manager)
+
def correct_level(self, level, op=None):
return self.mdc.correct_level(level, op)
class ECHO_CLIENT(Module):
def __init__(self,db):
Module.__init__(self, 'ECHO_CLIENT', db)
- self.add_lustre_module('obdecho', 'obdecho')
self.obd_uuid = self.db.get_first_ref('obd')
obd = self.db.lookup(self.obd_uuid)
self.uuid = generate_client_uuid(self.name)
Module.cleanup(self)
self.osc.cleanup()
- def load_module(self):
- self.osc.load_module()
- Module.load_module(self)
-
- def cleanup_module(self):
- Module.cleanup_module(self)
- self.osc.cleanup_module()
+ def add_module(self, manager):
+ self.osc.add_module(manager)
+ manager.add_lustre_module('obdecho', 'obdecho')
def correct_level(self, level, op=None):
return level
int(random.random() * 1048576))
return client_uuid[:36]
-def my_rstrip(s, chars):
- """my_rstrip(s, chars) -> strips any instances of the characters
- found in chars from the right side of string s"""
- # XXX required because python versions pre 2.2.3 don't allow
- #string.rstrip() to take alternate char lists
- import string
- ns=s
- try:
- ns = string.rstrip(s, '/')
- except TypeError, e:
- for i in range(len(s) - 1, 0, -1):
- if s[i] in chars:
- continue
- else:
- ns = s[0:i+1]
- break
- return ns
-
class Mountpoint(Module):
def __init__(self,db):
Module.__init__(self, 'MTPT', db)
if not self.mds_uuid:
self.mds_uuid = fs.get_first_ref('mds')
self.obd_uuid = fs.get_first_ref('obd')
+ self.mgmt_uuid = fs.get_first_ref('mgmt')
client_uuid = generate_client_uuid(self.name)
ost = self.db.lookup(self.obd_uuid)
if not ost:
panic("no ost: ", self.obd_uuid)
-
+
mds = self.db.lookup(self.mds_uuid)
if not mds:
panic("no mds: ", self.mds_uuid)
-
- self.add_lustre_module('mdc', 'mdc')
- self.add_lustre_module('lmv', 'lmv')
- self.add_lustre_module('llite', 'llite')
-
+
self.vosc = VOSC(ost, client_uuid, self.name)
self.vmdc = VMDC(mds, client_uuid, self.name)
+
+ if self.mgmt_uuid:
+ self.mgmtcli = ManagementClient(db.lookup(self.mgmt_uuid),
+ client_uuid)
+ else:
+ self.mgmtcli = None
def prepare(self):
if not config.record and fs_is_mounted(self.path):
log(self.path, "already mounted.")
return
run_acceptors()
+ if self.mgmtcli:
+ self.mgmtcli.prepare()
self.vosc.prepare()
self.vmdc.prepare()
vmdc_name = self.vmdc.get_name()
self.clientoptions = ',' + self.clientoptions
# Linux kernel will deal with async and not pass it to ll_fill_super,
# so replace it with Lustre async
- self.clientoptions = string.replace(self.clientoptions, "async",
+ self.clientoptions = string.replace(self.clientoptions, "async",
"lasync")
cmd = "mount -t lustre_lite -o osc=%s,mdc=%s%s %s %s" % \
- (self.vosc.get_name(), vmdc_name, self.clientoptions,
+ (self.vosc.get_name(), vmdc_name, self.clientoptions,
config.config, self.path)
run("mkdir", self.path)
ret, val = run(cmd)
if ret:
- self.vmdc.cleanup()
+ self.vmdc.cleanup()
self.vosc.cleanup()
panic("mount failed:", self.path, ":", string.join(val))
self.vmdc.cleanup()
self.vosc.cleanup()
+ if self.mgmtcli:
+ self.mgmtcli.cleanup()
- def load_module(self):
- self.vosc.load_module()
- Module.load_module(self)
+ def add_module(self, manager):
+ manager.add_lustre_module('mdc', 'mdc')
+
+ if self.mgmtcli:
+ self.mgmtcli.add_module(manager)
+
+ self.vosc.add_module(manager)
+ self.vmdc.add_module(manager)
- def cleanup_module(self):
- Module.cleanup_module(self)
- self.vosc.cleanup_module()
+ manager.add_lustre_module('llite', 'llite')
def correct_level(self, level, op=None):
return level
for n in nlist:
n[1].prepare()
-def doModules(services):
+def doLoadModules(services):
+ if config.nomod:
+ return
+
+ # adding all needed modules from all services
+ for s in services:
+ n = newService(s[1])
+ n.add_module(mod_manager)
+
+ # loading all registered modules
+ mod_manager.load_modules()
+
+def doUnloadModules(services):
if config.nomod:
return
+
+ # adding all needed modules from all services
for s in services:
n = newService(s[1])
- n.load_module()
+ if n.safe_to_clean_modules():
+ n.add_module(mod_manager)
+
+ # unloading all registered modules
+ mod_manager.cleanup_modules()
def doCleanup(services):
if config.nosetup:
return
slist = []
+
for s in services:
n = newService(s[1])
n.level = s[0]
nlist.append((nl, n[1]))
nlist.sort()
nlist.reverse()
+
for n in nlist:
if n[1].safe_to_clean():
n[1].cleanup()
-def doUnloadModules(services):
- if config.nomod:
- return
- services.reverse()
- for s in services:
- n = newService(s[1])
- if n.safe_to_clean_modules():
- n.cleanup_module()
-
#
# Load profile for
def doHost(lustreDB, hosts):
prof_list = node_db.get_refs('profile')
if config.write_conf:
- for_each_profile(node_db, prof_list, doModules)
+ for_each_profile(node_db, prof_list, doLoadModules)
sys_make_devices()
for_each_profile(node_db, prof_list, doWriteconf)
for_each_profile(node_db, prof_list, doUnloadModules)
sys_set_netmem_max('/proc/sys/net/core/rmem_max', MAXTCPBUF)
sys_set_netmem_max('/proc/sys/net/core/wmem_max', MAXTCPBUF)
- for_each_profile(node_db, prof_list, doModules)
+ for_each_profile(node_db, prof_list, doLoadModules)
sys_set_debug_path()
sys_set_ptldebug(ptldebug)
]
def main():
- global lctl, config, toplustreDB, CONFIG_FILE
+ global lctl, config, toplustreDB, CONFIG_FILE, mod_manager
# in the upcall this is set to SIG_IGN
signal.signal(signal.SIGCHLD, signal.SIG_DFL)
lctl.clear_log(config.record_device, config.record_log)
lctl.record(config.record_device, config.record_log)
+ # init module manager
+ mod_manager = kmod_manager(config.lustre, config.portals)
+
doHost(lustreDB, node_list)
if not config.record:
static int lfs_dirstripe(int argc, char **argv);
static int lfs_find(int argc, char **argv);
static int lfs_getstripe(int argc, char **argv);
+static int lfs_showfid(int argc, char **argv);
static int lfs_osts(int argc, char **argv);
static int lfs_check(int argc, char **argv);
static int lfs_catinfo(int argc, char **argv);
"usage: find [--obd <uuid>] [--quiet | --verbose] [--recursive] <dir|file> ..."},
{"getstripe", lfs_getstripe, 0,
"To list the striping pattern for given filename.\n"
- "usage:getstripe <filename>"},
+ "usage: getstripe <filename>"},
+ {"showfid", lfs_showfid, 0,
+ "To list the fid and store cookie for given filename.\n"
+ "usage: showfid [--quiet | --verbose] [--recursive] <dir|file> ..."},
{"check", lfs_check, 0,
"Display the status of MDS or OSTs (as specified in the command)\n"
"or all the servers (MDS and OSTs).\n"
return CMD_HELP;
do {
- rc = llapi_find(argv[optind], obduuid, recursive,verbose,quiet);
+ rc = llapi_find(argv[optind], obduuid, recursive, verbose, quiet, 0);
} while (++optind < argc && !rc);
if (rc)
optind = 1;
do {
- rc = llapi_find(argv[optind], obduuid, 0, 0, 0);
+ rc = llapi_find(argv[optind], obduuid, 0, 0, 0, 0);
} while (++optind < argc && !rc);
if (rc)
return rc;
}
+static int lfs_showfid(int argc, char **argv)
+{
+ struct option long_opts[] = {
+ {"quiet", 0, 0, 'q'},
+ {"recursive", 0, 0, 'r'},
+ {"verbose", 0, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+ char short_opts[] = "hqrv";
+ int quiet, verbose, recursive, c, rc;
+
+ optind = 0;
+ quiet = verbose = recursive = 0;
+ while ((c = getopt_long(argc, argv, short_opts,
+ long_opts, NULL)) != -1) {
+ switch (c) {
+ case 'q':
+ quiet++;
+ verbose = 0;
+ break;
+ case 'r':
+ recursive = 1;
+ break;
+ case 'v':
+ verbose++;
+ quiet = 0;
+ break;
+ case '?':
+ return CMD_HELP;
+ break;
+ default:
+ fprintf(stderr, "error: %s: option '%s' unrecognized\n",
+ argv[0], argv[optind - 1]);
+ return CMD_HELP;
+ }
+ }
+
+ if (optind >= argc)
+ return CMD_HELP;
+
+ do {
+ rc = llapi_find(argv[optind], NULL, recursive, verbose, quiet, 1);
+ } while (++optind < argc && !rc);
+
+ if (rc)
+ fprintf(stderr, "error: %s: find failed\n", argv[0]);
+
+ return rc;
+}
+
static int lfs_osts(int argc, char **argv)
{
FILE *fp;
mnt = getmntent(fp);
while (feof(fp) == 0 && ferror(fp) ==0) {
if (llapi_is_lustre_mnttype(mnt->mnt_type)) {
- rc = llapi_find(mnt->mnt_dir, obduuid, 0, 0, 0);
+ rc = llapi_find(mnt->mnt_dir, obduuid, 0, 0, 0, 0);
if (rc)
fprintf(stderr,
"error: lfs osts failed on %s\n",
strcpy(obd_types[1], "mdc");
} else {
fprintf(stderr, "error: %s: option '%s' unrecognized\n",
- argv[0], argv[1]);
- return CMD_HELP;
+ argv[0], argv[1]);
+ return CMD_HELP;
}
fp = setmntent(MOUNTED, "r");
}
struct find_param {
- int recursive;
- int verbose;
- int quiet;
- struct obd_uuid *obduuid;
- int lumlen;
- struct lov_user_md *lum;
- int got_uuids;
- int obdindex;
- __u32 *obdgens;
+ int recursive;
+ int verbose;
+ int quiet;
+ int showfid;
+ struct obd_uuid *obduuid;
+ int datalen;
+ struct lov_user_md *data;
+ int got_uuids;
+ int obdindex;
+ __u32 *obdgens;
};
/* XXX Max obds per lov currently hardcoded to 1000 in lov/lov_obd.c */
static int prepare_find(struct find_param *param)
{
- param->lumlen = lov_mds_md_size(MAX_LOV_UUID_COUNT);
- if ((param->lum = malloc(param->lumlen)) == NULL) {
- err_msg("unable to allocate %d bytes of memory for ioctl",
- param->lumlen);
- return ENOMEM;
+ if (param->showfid) {
+ param->datalen = PATH_MAX + 1;
+ if ((param->data = malloc(param->datalen)) == NULL) {
+ err_msg("unable to allocate %d bytes of memory for ioctl",
+ param->datalen);
+ return ENOMEM;
+ }
+ } else {
+ param->datalen = lov_mds_md_size(MAX_LOV_UUID_COUNT);
+ if ((param->data = malloc(param->datalen)) == NULL) {
+ err_msg("unable to allocate %d bytes of memory for ioctl",
+ param->datalen);
+ return ENOMEM;
+ }
}
-
param->got_uuids = 0;
param->obdindex = OBD_NOT_FOUND;
-
return 0;
}
{
if (param->obduuid)
free(param->obduuid);
- if (param->lum)
- free(param->lum);
+ if (param->data)
+ free(param->data);
}
-int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, __u32 *obdgens,
- int *ost_count)
+int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp,
+ __u32 *obdgens, int *ost_count)
{
struct obd_ioctl_data data = { 0, };
struct lov_desc desc = { 0, };
{
struct obd_uuid uuids[1024], *uuidp;
__u32 obdgens[1024], *genp;
-
int obdcount = 1024;
int rc, i;
void llapi_lov_dump_user_lmm(struct find_param *param, char *dname, char *fname)
{
- switch(*(__u32 *)param->lum) { /* lum->lmm_magic */
+ switch(*(__u32 *)param->data) { /* lum->lmm_magic */
case LOV_USER_MAGIC_V1:
- lov_dump_user_lmm_v1(param->lum, dname, fname, param->obdindex,
+ lov_dump_user_lmm_v1(param->data, dname, fname, param->obdindex,
param->quiet, param->verbose,
(param->verbose || !param->obduuid));
break;
default:
- printf("unknown lmm_magic: 0x%08X\n", *(__u32 *)param->lum);
+ printf("unknown lmm_magic: 0x%08X\n", *(__u32 *)param->data);
return;
}
}
+void llapi_dump_fid(struct find_param *param, char *dname, char *fname)
+{
+ if (!param->quiet) {
+ int n = 0;
+ char path[PATH_MAX + 1];
+
+ n = snprintf(path, PATH_MAX, "%s/%s",
+ dname, fname);
+
+ if (n > 40)
+ n = 1;
+ else
+ n = 40 - n;
+
+ printf("%s:%*s"DLID4"\n", path, n, "",
+ OLID4((struct lustre_id *)param->data));
+ }
+}
+
int llapi_file_get_stripe(char *path, struct lov_user_md *lum)
{
char *dname, *fname;
return rc;
}
+int llapi_file_get_fid(char *path, void *data)
+{
+ char *dname, *fname;
+ int fd, rc = 0;
+
+ fname = strrchr(path, '/');
+
+ if (fname == NULL) {
+ dname = (char *)malloc(2);
+ if (dname == NULL)
+ return ENOMEM;
+ strcpy(dname, ".");
+ fname = path;
+ } else {
+ dname = (char *)malloc(fname - path + 1);
+ if (dname == NULL)
+ return ENOMEM;
+ strncpy(dname, path, fname - path);
+ dname[fname - path] = '\0';
+ fname++;
+
+ if (!strlen(fname))
+ fname = ".";
+ }
+
+ if ((fd = open(dname, O_RDONLY)) == -1) {
+ free(dname);
+ return errno;
+ }
+
+ strncpy((char *)data, fname, strlen(fname));
+ if (ioctl(fd, IOC_MDC_SHOWFID, (void *)data) == -1) {
+ close(fd);
+ free(dname);
+ return errno;
+ }
+
+ if (close(fd) == -1)
+ rc = errno;
+
+ free(dname);
+ return rc;
+}
+
/* short term backwards compat only */
int op_get_file_stripe(char *path, struct lov_user_md *lum)
{
{
int rc;
- strncpy((char *)param->lum, fname, param->lumlen);
+ if (param->showfid) {
+ char path[PATH_MAX + 1];
- rc = ioctl(dirfd(dir), IOC_MDC_GETSTRIPE, (void *)param->lum);
- if (rc) {
- if (errno == ENODATA) {
- if (!param->obduuid && !param->quiet)
- fprintf(stderr,
- "%s/%s has no stripe info\n",
+ snprintf(path, PATH_MAX, "%s/%s", dname, fname);
+ rc = llapi_file_get_fid(path, (void *)param->data);
+ if (rc) {
+ err_msg("IOC_MDC_SHOWFID ioctl failed");
+ return rc;
+ }
+ llapi_dump_fid(param, dname, fname);
+ } else {
+ strncpy((char *)param->data, fname, param->datalen);
+ rc = ioctl(dirfd(dir), IOC_MDC_GETSTRIPE, (void *)param->data);
+ if (rc) {
+ if (errno == ENODATA) {
+ if (!param->obduuid && !param->quiet)
+ fprintf(stderr,
+ "%s/%s has no stripe info\n",
+ dname, fname);
+ rc = 0;
+ } else if (errno == EISDIR) {
+ fprintf(stderr, "process_file on directory %s/%s!\n",
dname, fname);
- rc = 0;
- } else if (errno == EISDIR) {
- fprintf(stderr, "process_file on directory %s/%s!\n",
- dname, fname);
- /* add fname to directory list; */
- rc = errno;
- } else {
- err_msg("IOC_MDC_GETSTRIPE ioctl failed");
- rc = errno;
+ /* add fname to directory list; */
+ rc = errno;
+ } else {
+ err_msg("IOC_MDC_GETSTRIPE ioctl failed");
+ rc = errno;
+ }
+ return rc;
}
- return rc;
+ llapi_lov_dump_user_lmm(param, dname, fname);
}
-
- llapi_lov_dump_user_lmm(param, dname, fname);
-
return 0;
}
static int process_dir(DIR *dir, char *dname, struct find_param *param)
{
+ char path[PATH_MAX + 1];
struct dirent64 *dirp;
DIR *subdir;
- char path[1024];
int rc;
- if (!param->got_uuids) {
- rc = setup_obd_uuids(dir, dname, param);
- if (rc)
+ /* retrieve dir's stripe info */
+ if (param->showfid) {
+ rc = llapi_file_get_fid(dname, (void *)param->data);
+ if (rc) {
+ err_msg("IOC_MDC_SHOWFID ioctl failed");
return rc;
- }
+ }
+ llapi_dump_fid(param, dname, "");
+ } else {
+ if (!param->got_uuids) {
+ rc = setup_obd_uuids(dir, dname, param);
+ if (rc)
+ return rc;
+ }
- /* retrieve dir's stripe info */
- strncpy((char *)param->lum, dname, param->lumlen);
- rc = ioctl(dirfd(dir), LL_IOC_LOV_GETSTRIPE, (void *)param->lum);
- if (rc) {
- if (errno == ENODATA) {
- if (!param->obduuid && param->verbose)
- printf("%s/%s has no stripe info\n", dname, "");
- rc = 0;
+ strncpy((char *)param->data, dname, param->datalen);
+ rc = ioctl(dirfd(dir), LL_IOC_LOV_GETSTRIPE, (void *)param->data);
+ if (rc) {
+ if (errno == ENODATA) {
+ if (!param->obduuid && param->verbose)
+ printf("%s/%s has no stripe info\n", dname, "");
+ rc = 0;
+ } else {
+ err_msg("IOC_MDC_GETSTRIPE ioctl failed");
+ return errno;
+ }
} else {
- err_msg("IOC_MDC_GETSTRIPE ioctl failed");
- return errno;
+ llapi_lov_dump_user_lmm(param, dname, "");
}
- } else {
- llapi_lov_dump_user_lmm(param, dname, "");
}
/* Handle the contents of the directory */
* know d_type should be valid for lustre and this
* tool only makes sense for lustre filesystems. */
return EINVAL;
- break;
case DT_DIR:
if (!param->recursive)
break;
err_msg("\"%.40s\" opendir failed", dname);
rc = errno;
} else {
- if (!param->got_uuids)
- rc = setup_obd_uuids(dir, dname, param);
+ if (!param->showfid) {
+ if (!param->got_uuids)
+ rc = setup_obd_uuids(dir, dname, param);
+ }
if (rc == 0)
rc = process_file(dir, dname, fname, param);
closedir(dir);
}
int llapi_find(char *path, struct obd_uuid *obduuid, int recursive,
- int verbose, int quiet)
+ int verbose, int quiet, int showfid)
{
struct find_param param;
int ret = 0;
memset(¶m, 0, sizeof(param));
param.recursive = recursive;
+ param.showfid = showfid;
param.verbose = verbose;
param.quiet = quiet;
if (obduuid) {
--add cobd
--node node_name
- --real_obd obd_name
+ --master_obd obd_name
--cache_obd obd_name
--add cmobd
--node node_name
- --master_dev obd_name
- --cache_dev obd_name
+ --master_obd obd_name
+ --cache_obd obd_name
--commit - Close a configuration version, and start a new one
"""
# cobd
- ('real_obd', "Specify the real device for the cache obd system.", PARAM),
+ ('master_obd', "Specify the real device for the cache obd system.", PARAM),
('cache_obd', "Specify the cache device for the cache obd system.", PARAM),
('cobd', "Specify COBD name", PARAM),
# cmobd
- ('master_dev', "Specify the master device for the cmobd system.", PARAM),
- ('cache_dev', "Specify the cache device for the cmobd obd system.", PARAM),
+ ('master_obd', "Specify the master device for the cmobd system.", PARAM),
+ ('cache_obd', "Specify the cache device for the cmobd obd system.", PARAM),
('cmobd', "Specify COBD name", PARAM),
self.addElement(osd, "nspath", nspath)
return osd
- def cobd(self, name, uuid, real_uuid, cache_uuid):
+ def cobd(self, name, uuid, master_uuid, cache_uuid):
cobd = self.newService("cobd", name, uuid)
- cobd.appendChild(self.ref("realobd",real_uuid))
+ cobd.appendChild(self.ref("masterobd",master_uuid))
cobd.appendChild(self.ref("cacheobd",cache_uuid))
return cobd
- def cmobd(self, name, uuid, real_uuid, cache_uuid):
+ def cmobd(self, name, uuid, master_uuid, cache_uuid):
cmobd = self.newService("cmobd", name, uuid)
- cmobd.appendChild(self.ref("masterobd",real_uuid))
+ cmobd.appendChild(self.ref("masterobd",master_uuid))
cmobd.appendChild(self.ref("cacheobd",cache_uuid))
return cmobd
def mds(self, name, uuid, mdd_uuid, group="", lmv=""):
mds = self.newService("mds", name, uuid)
- mds.appendChild(self.ref("active",mdd_uuid))
+ mds.appendChild(self.ref("active", mdd_uuid))
if group:
self.addElement(mds, "group", group)
return mds
profile.appendChild(gen.ref(ref, uuid))
return 1
-# ensure that uuid is not already in the profile
-# return true if uuid is added
-def node_found_target_by_dev(gen, lustre, node, devname):
- refname = "%s_ref" % "profile"
- ret = node.getElementsByTagName(refname)
- if not ret:
- error('node has no profile ref:', node)
- prof_uuid = ret[0].getAttribute('uuidref')
- profile = lookup(node.parentNode, prof_uuid)
- if not profile:
- error("no profile found:", prof_uuid)
-
- osd_list = lustre.getElementsByTagName('osd')
-
- for osd in osd_list:
- obd_dev = osd.getElementsByTagName('dev')
- if obd_dev and obd_dev[0].getAttribute('dev') == devname:
- for ost in lustre.getElementsByTagName('ost'):
- active_ret = ost.getElementsByTagName('active_ref')
- if active_ret[0].getAttribute('uuidref') == osd.getAttribute('uuid'):
- return ost.getAttribute('uuid')
-
- mdsdev_list = lustre.getElementsByTagName('mdsdev')
-
- for mdsdev in mdsdev_list:
- obd_dev = mdsdev.getElementsByTagName('dev')
- if obd_dev and obd_dev[0].getAttribute('dev') == devname:
- for mds in lustre.getElementsByTagName('mds'):
- active_ret = mds.getElementsByTagName('active_ref')
- if active_ret[0].getAttribute('uuidref') == mdsdev.getAttribute('uuid'):
- return mds.getAttribute('uuid')
-
- return ""
-
def get_attr(dom_node, attr, default=""):
v = dom_node.getAttribute(attr)
if v:
rtbl.appendChild(gen.route(gw_net_type, gw, gw_cluster_id, tgt_cluster_id,
lo, hi))
-
def add_mds(gen, lustre, options):
node_name = get_option(options, 'node')
mds_name = get_option(options, 'mds')
name = get_option(options, 'cmobd')
uuid = new_uuid(name)
- real_name = get_option(options, 'master_dev')
- cache_name = get_option(options, 'cache_dev')
+ master_name = get_option(options, 'master_obd')
+ cache_name = get_option(options, 'cache_obd')
+
+ master_uuid = name2uuid(lustre, master_name, tag='lov', fatal=0)
+ cache_uuid = name2uuid(lustre, cache_name, tag='lov', fatal=0)
+
+ if not master_uuid or not cache_uuid:
+ if not master_uuid:
+ master_uuid = name2uuid(lustre, master_name, tag='ost', fatal=0)
+ if not cache_uuid:
+ cache_uuid = name2uuid(lustre, cache_name, tag='ost', fatal=0)
+
+ if not master_uuid or not cache_uuid:
+ if not master_uuid:
+ master_uuid = name2uuid(lustre, master_name, tag='lmv', fatal=0)
+ if not cache_uuid:
+ cache_uuid = name2uuid(lustre, cache_name, tag='lmv', fatal=0)
+
+ if not master_uuid or not cache_uuid:
+ if not master_uuid:
+ master_uuid = name2uuid(lustre, master_name, tag='mds', fatal=0)
+ if not cache_uuid:
+ cache_uuid = name2uuid(lustre, cache_name, tag='mds', fatal=0)
+
+ if not master_uuid:
+ panic("add_cmobd", "cannot find master_uuid by name '" +
+ master_name + "'")
+ if not cache_uuid:
+ panic("add_cmobd", "cannot find cache_uuid by name '" +
+ cache_name + "'")
node = findByName(lustre, node_name, "node")
node_add_profile(gen, node, "cmobd", uuid)
- real_uuid = node_found_target_by_dev(gen, lustre, node, real_name)
- cache_uuid = node_found_target_by_dev(gen, lustre, node, cache_name)
- if not real_uuid:
- panic("add_cmobd", "can not find real_uuid")
- if not cache_uuid:
- panic("add_cmobd", "can not find cache_uuid")
- cmobd = gen.cmobd(name, uuid, real_uuid, cache_uuid)
+
+ master_node = lookup(lustre, master_uuid)
+ cache_node = lookup(lustre, cache_uuid)
+ if not master_node:
+ panic("cmobd_add", "cannot find master node by its uuid " +
+ master_uuid);
+ if not cache_node:
+ panic("cmobd_add", "cannot find cache node by its uuid " +
+ cache_uuid);
+
+ active = master_node.getElementsByTagName('active_ref')
+ if active:
+ active_uuid = active[0].getAttribute('uuidref')
+ active_node = lookup(lustre, active_uuid)
+ if not active_node.getElementsByTagName('obdtype'):
+ gen.addElement(active_node, 'obdtype', 'master')
+
+ active = cache_node.getElementsByTagName('active_ref')
+ if active:
+ active_uuid = active[0].getAttribute('uuidref')
+ active_node = lookup(lustre, active_uuid)
+ if not active_node.getElementsByTagName('obdtype'):
+ gen.addElement(active_node, 'obdtype', 'cache')
+
+ cmobd = gen.cmobd(name, uuid, master_uuid, cache_uuid)
lustre.appendChild(cmobd)
def add_cobd(gen, lustre, options):
name = get_option(options, 'cobd')
uuid = new_uuid(name)
- real_name = get_option(options, 'real_obd')
+ master_name = get_option(options, 'master_obd')
cache_name = get_option(options, 'cache_obd')
- real_uuid = name2uuid(lustre, real_name, tag='lov', fatal=0)
+ master_uuid = name2uuid(lustre, master_name, tag='lov', fatal=0)
cache_uuid = name2uuid(lustre, cache_name, tag='lov', fatal=0)
- if real_uuid:
- node = lookup(lustre, real_uuid)
+ if master_uuid:
+ node = lookup(lustre, master_uuid)
rets = node.getElementsByTagName('lov_tgt')
for ret in rets:
ost_uuid = ret.getAttribute('uuidref')
ost_node = lookup(lustre, ost_uuid)
- ret = ost_node.getElementsByTagName('active_ref')
- if ret:
- osd_uuid = ret[0].getAttribute('uuidref')
+ active = ost_node.getElementsByTagName('active_ref')
+ if active:
+ osd_uuid = active[0].getAttribute('uuidref')
osd_node = lookup(lustre, osd_uuid)
- gen.addElement(osd_node, 'cachetype', 'master')
+ if not osd_node.getElementsByTagName('obdtype'):
+ gen.addElement(osd_node, 'obdtype', 'master')
if cache_uuid:
node = lookup(lustre, cache_uuid)
for ret in rets:
ost_uuid = ret.getAttribute('uuidref')
ost_node = lookup(lustre, ost_uuid)
- ret = ost_node.getElementsByTagName('active_ref')
- if ret:
- osd_uuid = ret[0].getAttribute('uuidref')
+ active = ost_node.getElementsByTagName('active_ref')
+ if active:
+ osd_uuid = active[0].getAttribute('uuidref')
osd_node = lookup(lustre, osd_uuid)
- gen.addElement(osd_node, 'cachetype', 'cache')
+ if not osd_node.getElementsByTagName('obdtype'):
+ gen.addElement(osd_node, 'obdtype', 'cache')
- if not real_uuid or not cache_uuid:
- real_uuid = name2uuid(lustre,real_name, tag='mds')
+ if not master_uuid or not cache_uuid:
+ master_uuid = name2uuid(lustre,master_name, tag='mds')
cache_uuid = name2uuid(lustre,cache_name, tag='mds')
- if real_uuid:
- mds_node = lookup(lustre, real_uuid)
+ if master_uuid:
+ mds_node = lookup(lustre, master_uuid)
ret = mds_node.getElementsByTagName('active_ref')
if ret:
mdsdev_uuid = ret[0].getAttribute('uuidref')
mdsdev_node = lookup(lustre, mdsdev_uuid)
- gen.addElement(mdsdev_node, 'cachetype', 'master')
+ if not mdsdev_node.getElementsByTagName('obdtype'):
+ gen.addElement(mdsdev_node, 'obdtype', 'master')
if cache_uuid:
mds_node = lookup(lustre, cache_uuid)
ret = mds_node.getElementsByTagName('active_ref')
if ret:
mdsdev_uuid = ret[0].getAttribute('uuidref')
mdsdev_node = lookup(lustre, mdsdev_uuid)
- gen.addElement(mdsdev_node, 'cachetype', 'cache')
+ if not mdsdev_node.getElementsByTagName('obdtype'):
+ gen.addElement(mdsdev_node, 'obdtype', 'cache')
node = findByName(lustre, node_name, "node")
- cobd = gen.cobd(name, uuid, real_uuid, cache_uuid)
+ cobd = gen.cobd(name, uuid, master_uuid, cache_uuid)
lustre.appendChild(cobd)
-
def add_echo_client(gen, lustre, options):
""" add an echo client to the profile for this node. """
node_name = get_option(options, 'node')
warning("name:", lov_orig, "already used. using:", name)
mds_name = get_option(options, 'mds')
- if not mds_name:
- if not lmv_name:
- error("LOV: MDS or LMV must be specified.");
+ if not mds_name and not lmv_name:
+ error("LOV: MDS or LMV must be specified.");
stripe_sz = get_option_int(options, 'stripe_sz')
stripe_cnt = get_option_int(options, 'stripe_cnt')
if ret:
error("LOV: ", name, " already exists.")
- if not mds_name:
+ if lmv_name:
mds_uuid = name2uuid(lustre, lmv_name, 'lmv')
else:
mds_uuid = name2uuid(lustre, mds_name, 'mds')
if mds_name:
mds = findByName(lustre, mds_name, "mds")
mds.appendChild(gen.ref("lovconfig", lovconfig_uuid))
+ mds.appendChild(gen.ref("client", uuid))
+
if lmv_name:
lmv = findByName(lustre, lmv_name, "lmv")
lmv.appendChild(gen.ref("lovconfig", lovconfig_uuid))
+ lmv.appendChild(gen.ref("client", uuid))
+
lovconfig = gen.lovconfig(lovconfig_name, lovconfig_uuid, uuid)
lustre.appendChild(lovconfig)
def new_filesystem(gen, lustre, mds_uuid, obd_uuid, mgmt_uuid):
fs_name = new_name("FS_fsname")
fs_uuid = new_uuid(fs_name)
- cobd = lookup(lustre, mds_uuid)
- #SHOULD appendChild filesystem to real mds not cobd
- ret = cobd.getElementsByTagName("cacheobd_ref")
- if ret:
- cacheobd_uuid = ret[0].getAttribute('uuidref')
- cacheobd = lookup(lustre, cacheobd_uuid)
- cacheobd.appendChild(gen.ref("filesystem", fs_uuid))
- ret = cobd.getElementsByTagName("realobd_ref")
- if ret:
- realobd_uuid = ret[0].getAttribute('uuidref')
- realobd = lookup(lustre, realobd_uuid)
- realobd.appendChild(gen.ref("filesystem", fs_uuid))
- else:
- cobd.appendChild(gen.ref("filesystem", fs_uuid))
+
+ obd = lookup(lustre, mds_uuid)
+ obd.appendChild(gen.ref("client", obd_uuid))
+
fs = gen.filesystem(fs_name, fs_uuid, mds_uuid, obd_uuid, mgmt_uuid)
lustre.appendChild(fs)
return fs_uuid
if not mds_uuid:
mds_uuid = name2uuid(lustre, mds_name, tag='lmv', fatal=0)
if not mds_uuid:
- mds_uuid = name2uuid(lustre, mds_name, tag='cobd', fatal=1)
- obd_uuid = name2uuid(lustre, obd_name, tag='lov', fatal=0)
- if obd_uuid == '':
- obd_uuid = name2uuid(lustre, obd_name, tag='cobd')
+ mds_uuid = name2uuid(lustre, mds_name, tag='cobd', fatal=1)
+
+ obd_uuid = name2uuid(lustre, obd_name, tag='ost', fatal=0)
+ if not obd_uuid:
+ obd_uuid = name2uuid(lustre, obd_name, tag='lov', fatal=0)
+ if not obd_uuid:
+ obd_uuid = name2uuid(lustre, obd_name, tag='cobd', fatal=1)
if mgmt_name:
mgmt_uuid = name2uuid(lustre, mgmt_name, tag='mgmt', fatal=1)
else:
mgmt_uuid = ''
+
fs_uuid = lookup_filesystem(lustre, mds_uuid, obd_uuid)
if not fs_uuid:
- fs_uuid = new_filesystem(gen, lustre, mds_uuid, obd_uuid, mgmt_uuid)
+ fs_uuid = new_filesystem(gen, lustre, mds_uuid,
+ obd_uuid, mgmt_uuid)
return fs_uuid
def add_mtpt(gen, lustre, options):
#include "parser.h"
#include <stdio.h>
-static char * lcfg_devname;
+static char *lcfg_devname;
void lcfg_set_devname(char *name)
{
return rc;
}
-
int jt_llog_check(int argc, char **argv)
{
struct obd_ioctl_data data;
return rc;
}
-
int jt_obd_reint_sync(int argc, char **argv)
{
struct obd_ioctl_data data;
IOC_PACK(argv[0], data);
rc = l_ioctl(OBD_DEV_ID, OBD_IOC_CMOBD_SYNC, buf);
- if (rc)
- fprintf(stderr, "OBD_IOC_CMOBD_SYNC failed: rc=%d\n",
- rc);
+ if (rc) {
+ fprintf(stderr, "OBD_IOC_CMOBD_SYNC failed: %s\n",
+ strerror(errno));
+ }
return rc;
}
IOC_PACK(argv[0], data);
rc = l_ioctl(OBD_DEV_ID, OBD_IOC_COBD_CON, buf);
- if (rc)
- fprintf(stderr, "OBD_IOC_CMOBD_SYNC failed: rc=%d\n",
- rc);
+ if (rc) {
+ fprintf(stderr, "OBD_IOC_COBD_CON failed: %s\n",
+ strerror(errno));
+ }
return rc;
}
-
int jt_obd_cache_off(int argc, char **argv)
{
struct obd_ioctl_data data;
return CMD_HELP;
IOC_PACK(argv[0], data);
rc = l_ioctl(OBD_DEV_ID, OBD_IOC_COBD_COFF, buf);
- if (rc)
- fprintf(stderr, "OBD_IOC_CMOBD_SYNC failed: rc=%d\n",
- rc);
+ if (rc) {
+ fprintf(stderr, "OBD_IOC_COBD_COFF failed: %s\n",
+ strerror(errno));
+ }
return rc;
}
-
int jt_obd_snap_add(int argc, char **argv)
{
-#if 1
- return -1;
-#else
-# error "FIX the missing #defines before committing"
struct obd_ioctl_data data;
int rc = 0;
rc = l_ioctl(SMFS_DEV_ID, OBD_IOC_SMFS_SNAP_ADD, buf);
unregister_ioc_dev(SMFS_DEV_ID);
+ if (rc) {
+ fprintf(stderr, "OBD_IOC_SNAP_ADD failed: rc=%s\n",
+ strerror(errno));
+ }
- if (rc)
- fprintf(stderr, "OBD_IOC_SNAP_ADD failed: rc=%d\n", rc);
return rc;
-#endif
}
-
static void signal_server(int sig)
{
if (sig == SIGINT) {
do_disconnect("sigint", 1);
exit(1);
} else
- fprintf(stderr, "%s: got signal %d\n", jt_cmdname("sigint"), sig);
+ fprintf(stderr, "%s: got signal %d\n",
+ jt_cmdname("sigint"), sig);
}
int obd_initialize(int argc, char **argv)
CHECK_MEMBER(obdo, o_misc);
CHECK_MEMBER(obdo, o_easize);
CHECK_MEMBER(obdo, o_mds);
+ CHECK_MEMBER(obdo, o_mds);
CHECK_MEMBER(obdo, o_padding);
CHECK_MEMBER(obdo, o_inline);
}
void
-check_ll_fid(void)
+check_lustre_stc(void)
{
BLANK_LINE();
- CHECK_STRUCT(ll_fid);
- CHECK_MEMBER(ll_fid, id);
- CHECK_MEMBER(ll_fid, generation);
- CHECK_MEMBER(ll_fid, f_type);
+ CHECK_STRUCT(lustre_stc);
+ CHECK_MEMBER(lustre_stc, u.e3s.l3s_ino);
+ CHECK_MEMBER(lustre_stc, u.e3s.l3s_gen);
+ CHECK_MEMBER(lustre_stc, u.e3s.l3s_type);
}
void
{
BLANK_LINE();
CHECK_STRUCT(mds_body);
- CHECK_MEMBER(mds_body, fid1);
- CHECK_MEMBER(mds_body, fid2);
+ CHECK_MEMBER(mds_body, id1);
+ CHECK_MEMBER(mds_body, id2);
CHECK_MEMBER(mds_body, handle);
CHECK_MEMBER(mds_body, size);
CHECK_MEMBER(mds_body, blocks);
CHECK_MEMBER(mds_body, io_epoch);
- CHECK_MEMBER(mds_body, ino);
CHECK_MEMBER(mds_body, valid);
CHECK_MEMBER(mds_body, mode);
CHECK_MEMBER(mds_body, uid);
CHECK_MEMBER(mds_body, flags);
CHECK_MEMBER(mds_body, rdev);
CHECK_MEMBER(mds_body, nlink);
- CHECK_MEMBER(mds_body, generation);
CHECK_MEMBER(mds_body, eadatasize);
- CHECK_MEMBER(mds_body, mds);
CHECK_VALUE(FMODE_READ);
CHECK_VALUE(FMODE_WRITE);
CHECK_STRUCT(mds_rec_setattr);
CHECK_MEMBER(mds_rec_setattr, sa_opcode);
CHECK_MEMBER(mds_rec_setattr, sa_valid);
- CHECK_MEMBER(mds_rec_setattr, sa_fid);
+ CHECK_MEMBER(mds_rec_setattr, sa_id);
CHECK_MEMBER(mds_rec_setattr, sa_mode);
CHECK_MEMBER(mds_rec_setattr, sa_uid);
CHECK_MEMBER(mds_rec_setattr, sa_gid);
CHECK_MEMBER(mds_rec_create, cr_flags);
CHECK_MEMBER(mds_rec_create, cr_mode);
CHECK_MEMBER(mds_rec_create, cr_padding);
- CHECK_MEMBER(mds_rec_create, cr_fid);
- CHECK_MEMBER(mds_rec_create, cr_replayfid);
+ CHECK_MEMBER(mds_rec_create, cr_id);
+ CHECK_MEMBER(mds_rec_create, cr_replayid);
CHECK_MEMBER(mds_rec_create, cr_time);
CHECK_MEMBER(mds_rec_create, cr_rdev);
}
CHECK_STRUCT(mds_rec_link);
CHECK_MEMBER(mds_rec_link, lk_opcode);
CHECK_MEMBER(mds_rec_link, lk_padding);
- CHECK_MEMBER(mds_rec_link, lk_fid1);
- CHECK_MEMBER(mds_rec_link, lk_fid2);
+ CHECK_MEMBER(mds_rec_link, lk_id1);
+ CHECK_MEMBER(mds_rec_link, lk_id2);
CHECK_MEMBER(mds_rec_link, lk_time);
}
CHECK_STRUCT(mds_rec_unlink);
CHECK_MEMBER(mds_rec_unlink, ul_opcode);
CHECK_MEMBER(mds_rec_unlink, ul_mode);
- CHECK_MEMBER(mds_rec_unlink, ul_fid1);
- CHECK_MEMBER(mds_rec_unlink, ul_fid2);
+ CHECK_MEMBER(mds_rec_unlink, ul_id1);
+ CHECK_MEMBER(mds_rec_unlink, ul_id2);
CHECK_MEMBER(mds_rec_unlink, ul_time);
}
CHECK_STRUCT(mds_rec_rename);
CHECK_MEMBER(mds_rec_rename, rn_opcode);
CHECK_MEMBER(mds_rec_rename, rn_padding);
- CHECK_MEMBER(mds_rec_rename, rn_fid1);
- CHECK_MEMBER(mds_rec_rename, rn_fid2);
+ CHECK_MEMBER(mds_rec_rename, rn_id1);
+ CHECK_MEMBER(mds_rec_rename, rn_id2);
CHECK_MEMBER(mds_rec_rename, rn_time);
}
BLANK_LINE();
CHECK_STRUCT(llog_create_rec);
CHECK_MEMBER(llog_create_rec, lcr_hdr);
- CHECK_MEMBER(llog_create_rec, lcr_fid);
+ CHECK_MEMBER(llog_create_rec, lcr_id);
CHECK_MEMBER(llog_create_rec, lcr_oid);
CHECK_MEMBER(llog_create_rec, lcr_ogen);
}
BLANK_LINE();
CHECK_STRUCT(llog_size_change_rec);
CHECK_MEMBER(llog_size_change_rec, lsc_hdr);
- CHECK_MEMBER(llog_size_change_rec, lsc_fid);
+ CHECK_MEMBER(llog_size_change_rec, lsc_id);
CHECK_MEMBER(llog_size_change_rec, lsc_io_epoch);
CHECK_MEMBER(llog_size_change_rec, lsc_tail);
}
check_obd_ioobj();
check_niobuf_remote();
check_ost_body();
- check_ll_fid();
+ check_lustre_stc();
check_mds_status_req();
check_mds_body();
check_mds_rec_setattr();
void lustre_assert_wire_constants(void)
{
- /* Wire protocol assertions generated by 'wirecheck'
- * running on Linux build 2.4.24-cmd2 #1 SMP Tue Sep 14 10:34:54 MDT 2004 i686 i686 i386 GNU/
- * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
-
-
- /* Constants... */
- LASSERTF(PTLRPC_MSG_MAGIC == 0x0BD00BD0," found %lld\n",
- (long long)PTLRPC_MSG_MAGIC);
- LASSERTF(PTLRPC_MSG_VERSION == 0x00000003," found %lld\n",
- (long long)PTLRPC_MSG_VERSION);
- LASSERTF(PTL_RPC_MSG_REQUEST == 4711, " found %lld\n",
- (long long)PTL_RPC_MSG_REQUEST);
- LASSERTF(PTL_RPC_MSG_ERR == 4712, " found %lld\n",
- (long long)PTL_RPC_MSG_ERR);
- LASSERTF(PTL_RPC_MSG_REPLY == 4713, " found %lld\n",
- (long long)PTL_RPC_MSG_REPLY);
- LASSERTF(MSG_LAST_REPLAY == 1, " found %lld\n",
- (long long)MSG_LAST_REPLAY);
- LASSERTF(MSG_RESENT == 2, " found %lld\n",
- (long long)MSG_RESENT);
- LASSERTF(MSG_REPLAY == 4, " found %lld\n",
- (long long)MSG_REPLAY);
- LASSERTF(MSG_CONNECT_RECOVERING == 1, " found %lld\n",
- (long long)MSG_CONNECT_RECOVERING);
- LASSERTF(MSG_CONNECT_RECONNECT == 2, " found %lld\n",
- (long long)MSG_CONNECT_RECONNECT);
- LASSERTF(MSG_CONNECT_REPLAYABLE == 4, " found %lld\n",
- (long long)MSG_CONNECT_REPLAYABLE);
- LASSERTF(OST_REPLY == 0, " found %lld\n",
- (long long)OST_REPLY);
- LASSERTF(OST_GETATTR == 1, " found %lld\n",
- (long long)OST_GETATTR);
- LASSERTF(OST_SETATTR == 2, " found %lld\n",
- (long long)OST_SETATTR);
- LASSERTF(OST_READ == 3, " found %lld\n",
- (long long)OST_READ);
- LASSERTF(OST_WRITE == 4, " found %lld\n",
- (long long)OST_WRITE);
- LASSERTF(OST_CREATE == 5, " found %lld\n",
- (long long)OST_CREATE);
- LASSERTF(OST_DESTROY == 6, " found %lld\n",
- (long long)OST_DESTROY);
- LASSERTF(OST_GET_INFO == 7, " found %lld\n",
- (long long)OST_GET_INFO);
- LASSERTF(OST_CONNECT == 8, " found %lld\n",
- (long long)OST_CONNECT);
- LASSERTF(OST_DISCONNECT == 9, " found %lld\n",
- (long long)OST_DISCONNECT);
- LASSERTF(OST_PUNCH == 10, " found %lld\n",
- (long long)OST_PUNCH);
- LASSERTF(OST_OPEN == 11, " found %lld\n",
- (long long)OST_OPEN);
- LASSERTF(OST_CLOSE == 12, " found %lld\n",
- (long long)OST_CLOSE);
- LASSERTF(OST_STATFS == 13, " found %lld\n",
- (long long)OST_STATFS);
- LASSERTF(OST_SAN_READ == 14, " found %lld\n",
- (long long)OST_SAN_READ);
- LASSERTF(OST_SAN_WRITE == 15, " found %lld\n",
- (long long)OST_SAN_WRITE);
- LASSERTF(OST_SYNC == 16, " found %lld\n",
- (long long)OST_SYNC);
- LASSERTF(OST_LAST_OPC == 18, " found %lld\n",
- (long long)OST_LAST_OPC);
- LASSERTF(OBD_OBJECT_EOF == 0xffffffffffffffffULL," found %lld\n",
- (long long)OBD_OBJECT_EOF);
- LASSERTF(OST_REQ_HAS_OA1 == 1, " found %lld\n",
- (long long)OST_REQ_HAS_OA1);
- LASSERTF(MDS_GETATTR == 33, " found %lld\n",
- (long long)MDS_GETATTR);
- LASSERTF(MDS_GETATTR_LOCK == 34, " found %lld\n",
- (long long)MDS_GETATTR_LOCK);
- LASSERTF(MDS_CLOSE == 35, " found %lld\n",
- (long long)MDS_CLOSE);
- LASSERTF(MDS_REINT == 36, " found %lld\n",
- (long long)MDS_REINT);
- LASSERTF(MDS_READPAGE == 37, " found %lld\n",
- (long long)MDS_READPAGE);
- LASSERTF(MDS_CONNECT == 38, " found %lld\n",
- (long long)MDS_CONNECT);
- LASSERTF(MDS_DISCONNECT == 39, " found %lld\n",
- (long long)MDS_DISCONNECT);
- LASSERTF(MDS_GETSTATUS == 40, " found %lld\n",
- (long long)MDS_GETSTATUS);
- LASSERTF(MDS_STATFS == 41, " found %lld\n",
- (long long)MDS_STATFS);
- LASSERTF(MDS_PIN == 42, " found %lld\n",
- (long long)MDS_PIN);
- LASSERTF(MDS_UNPIN == 43, " found %lld\n",
- (long long)MDS_UNPIN);
- LASSERTF(MDS_SYNC == 44, " found %lld\n",
- (long long)MDS_SYNC);
- LASSERTF(MDS_DONE_WRITING == 45, " found %lld\n",
- (long long)MDS_DONE_WRITING);
- LASSERTF(MDS_LAST_OPC == 46, " found %lld\n",
- (long long)MDS_LAST_OPC);
- LASSERTF(REINT_SETATTR == 1, " found %lld\n",
- (long long)REINT_SETATTR);
- LASSERTF(REINT_CREATE == 2, " found %lld\n",
- (long long)REINT_CREATE);
- LASSERTF(REINT_LINK == 3, " found %lld\n",
- (long long)REINT_LINK);
- LASSERTF(REINT_UNLINK == 4, " found %lld\n",
- (long long)REINT_UNLINK);
- LASSERTF(REINT_RENAME == 5, " found %lld\n",
- (long long)REINT_RENAME);
- LASSERTF(REINT_OPEN == 6, " found %lld\n",
- (long long)REINT_OPEN);
- LASSERTF(REINT_MAX == 8, " found %lld\n",
- (long long)REINT_MAX);
- LASSERTF(DISP_IT_EXECD == 1, " found %lld\n",
- (long long)DISP_IT_EXECD);
- LASSERTF(DISP_LOOKUP_EXECD == 2, " found %lld\n",
- (long long)DISP_LOOKUP_EXECD);
- LASSERTF(DISP_LOOKUP_NEG == 4, " found %lld\n",
- (long long)DISP_LOOKUP_NEG);
- LASSERTF(DISP_LOOKUP_POS == 8, " found %lld\n",
- (long long)DISP_LOOKUP_POS);
- LASSERTF(DISP_OPEN_CREATE == 16, " found %lld\n",
- (long long)DISP_OPEN_CREATE);
- LASSERTF(DISP_OPEN_OPEN == 32, " found %lld\n",
- (long long)DISP_OPEN_OPEN);
- LASSERTF(MDS_STATUS_CONN == 1, " found %lld\n",
- (long long)MDS_STATUS_CONN);
- LASSERTF(MDS_STATUS_LOV == 2, " found %lld\n",
- (long long)MDS_STATUS_LOV);
- LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n",
- (long long)MDS_OPEN_HAS_EA);
- LASSERTF(LDLM_ENQUEUE == 101, " found %lld\n",
- (long long)LDLM_ENQUEUE);
- LASSERTF(LDLM_CONVERT == 102, " found %lld\n",
- (long long)LDLM_CONVERT);
- LASSERTF(LDLM_CANCEL == 103, " found %lld\n",
- (long long)LDLM_CANCEL);
- LASSERTF(LDLM_BL_CALLBACK == 104, " found %lld\n",
- (long long)LDLM_BL_CALLBACK);
- LASSERTF(LDLM_CP_CALLBACK == 105, " found %lld\n",
- (long long)LDLM_CP_CALLBACK);
- LASSERTF(LDLM_LAST_OPC == 107, " found %lld\n",
- (long long)LDLM_LAST_OPC);
- LASSERTF(LCK_EX == 1, " found %lld\n",
- (long long)LCK_EX);
- LASSERTF(LCK_PW == 2, " found %lld\n",
- (long long)LCK_PW);
- LASSERTF(LCK_PR == 4, " found %lld\n",
- (long long)LCK_PR);
- LASSERTF(LCK_CW == 8, " found %lld\n",
- (long long)LCK_CW);
- LASSERTF(LCK_CR == 16, " found %lld\n",
- (long long)LCK_CR);
- LASSERTF(LCK_NL == 32, " found %lld\n",
- (long long)LCK_NL);
- LASSERTF(PTLBD_QUERY == 200, " found %lld\n",
- (long long)PTLBD_QUERY);
- LASSERTF(PTLBD_READ == 201, " found %lld\n",
- (long long)PTLBD_READ);
- LASSERTF(PTLBD_WRITE == 202, " found %lld\n",
- (long long)PTLBD_WRITE);
- LASSERTF(PTLBD_FLUSH == 203, " found %lld\n",
- (long long)PTLBD_FLUSH);
- LASSERTF(PTLBD_CONNECT == 204, " found %lld\n",
- (long long)PTLBD_CONNECT);
- LASSERTF(PTLBD_DISCONNECT == 205, " found %lld\n",
- (long long)PTLBD_DISCONNECT);
- LASSERTF(PTLBD_LAST_OPC == 206, " found %lld\n",
- (long long)PTLBD_LAST_OPC);
- LASSERTF(MGMT_CONNECT == 250, " found %lld\n",
- (long long)MGMT_CONNECT);
- LASSERTF(MGMT_DISCONNECT == 251, " found %lld\n",
- (long long)MGMT_DISCONNECT);
- LASSERTF(MGMT_EXCEPTION == 252, " found %lld\n",
- (long long)MGMT_EXCEPTION);
- LASSERTF(OBD_PING == 400, " found %lld\n",
- (long long)OBD_PING);
- LASSERTF(OBD_LOG_CANCEL == 401, " found %lld\n",
- (long long)OBD_LOG_CANCEL);
- LASSERTF(OBD_LAST_OPC == 402, " found %lld\n",
- (long long)OBD_LAST_OPC);
- /* Sizes and Offsets */
-
-
- /* Checks for struct lustre_handle */
- LASSERTF((int)sizeof(struct lustre_handle) == 8, " found %lld\n",
- (long long)(int)sizeof(struct lustre_handle));
- LASSERTF((int)offsetof(struct lustre_handle, cookie) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lustre_handle, cookie));
- LASSERTF((int)sizeof(((struct lustre_handle *)0)->cookie) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_handle *)0)->cookie));
-
- /* Checks for struct lustre_msg */
- LASSERTF((int)sizeof(struct lustre_msg) == 64, " found %lld\n",
- (long long)(int)sizeof(struct lustre_msg));
- LASSERTF((int)offsetof(struct lustre_msg, handle) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, handle));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->handle) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->handle));
- LASSERTF((int)offsetof(struct lustre_msg, magic) == 8, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, magic));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->magic) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->magic));
- LASSERTF((int)offsetof(struct lustre_msg, type) == 12, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, type));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->type));
- LASSERTF((int)offsetof(struct lustre_msg, version) == 16, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, version));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->version) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->version));
- LASSERTF((int)offsetof(struct lustre_msg, opc) == 20, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, opc));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->opc) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->opc));
- LASSERTF((int)offsetof(struct lustre_msg, last_xid) == 24, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, last_xid));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->last_xid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->last_xid));
- LASSERTF((int)offsetof(struct lustre_msg, last_committed) == 32, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, last_committed));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->last_committed) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->last_committed));
- LASSERTF((int)offsetof(struct lustre_msg, transno) == 40, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, transno));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->transno) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->transno));
- LASSERTF((int)offsetof(struct lustre_msg, status) == 48, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, status));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->status) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->status));
- LASSERTF((int)offsetof(struct lustre_msg, flags) == 52, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, flags));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->flags));
- LASSERTF((int)offsetof(struct lustre_msg, bufcount) == 60, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, bufcount));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->bufcount) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->bufcount));
- LASSERTF((int)offsetof(struct lustre_msg, buflens[7]) == 92, " found %lld\n",
- (long long)(int)offsetof(struct lustre_msg, buflens[7]));
- LASSERTF((int)sizeof(((struct lustre_msg *)0)->buflens[7]) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lustre_msg *)0)->buflens[7]));
-
- /* Checks for struct obdo */
- LASSERTF((int)sizeof(struct obdo) == 176, " found %lld\n",
- (long long)(int)sizeof(struct obdo));
- LASSERTF((int)offsetof(struct obdo, o_id) == 0, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_id));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_id));
- LASSERTF((int)offsetof(struct obdo, o_gr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_gr));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_gr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_gr));
- LASSERTF((int)offsetof(struct obdo, o_atime) == 32, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_atime));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_atime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_atime));
- LASSERTF((int)offsetof(struct obdo, o_mtime) == 24, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_mtime));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_mtime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_mtime));
- LASSERTF((int)offsetof(struct obdo, o_ctime) == 40, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_ctime));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_ctime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_ctime));
- LASSERTF((int)offsetof(struct obdo, o_size) == 16, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_size));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_size));
- LASSERTF((int)offsetof(struct obdo, o_blocks) == 48, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_blocks));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_blocks) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_blocks));
- LASSERTF((int)offsetof(struct obdo, o_grant) == 56, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_grant));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_grant) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_grant));
- LASSERTF((int)offsetof(struct obdo, o_blksize) == 64, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_blksize));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_blksize) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_blksize));
- LASSERTF((int)offsetof(struct obdo, o_mode) == 68, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_mode));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_mode));
- LASSERTF((int)offsetof(struct obdo, o_uid) == 72, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_uid));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_uid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_uid));
- LASSERTF((int)offsetof(struct obdo, o_gid) == 76, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_gid));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_gid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_gid));
- LASSERTF((int)offsetof(struct obdo, o_flags) == 80, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_flags));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_flags));
- LASSERTF((int)offsetof(struct obdo, o_nlink) == 84, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_nlink));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_nlink) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_nlink));
- LASSERTF((int)offsetof(struct obdo, o_generation) == 88, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_generation));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_generation) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_generation));
- LASSERTF((int)offsetof(struct obdo, o_valid) == 92, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_valid));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_valid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_valid));
- LASSERTF((int)offsetof(struct obdo, o_misc) == 96, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_misc));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_misc) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_misc));
- LASSERTF((int)offsetof(struct obdo, o_easize) == 100, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_easize));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_easize));
- LASSERTF((int)offsetof(struct obdo, o_mds) == 104, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_mds));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_mds) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_mds));
- LASSERTF((int)offsetof(struct obdo, o_padding) == 108, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_padding));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_padding) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_padding));
- LASSERTF((int)offsetof(struct obdo, o_inline) == 112, " found %lld\n",
- (long long)(int)offsetof(struct obdo, o_inline));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 64, " found %lld\n",
- (long long)(int)sizeof(((struct obdo *)0)->o_inline));
- LASSERTF(OBD_MD_FLID == 1, " found %lld\n",
- (long long)OBD_MD_FLID);
- LASSERTF(OBD_MD_FLATIME == 2, " found %lld\n",
- (long long)OBD_MD_FLATIME);
- LASSERTF(OBD_MD_FLMTIME == 4, " found %lld\n",
- (long long)OBD_MD_FLMTIME);
- LASSERTF(OBD_MD_FLCTIME == 8, " found %lld\n",
- (long long)OBD_MD_FLCTIME);
- LASSERTF(OBD_MD_FLSIZE == 16, " found %lld\n",
- (long long)OBD_MD_FLSIZE);
- LASSERTF(OBD_MD_FLBLOCKS == 32, " found %lld\n",
- (long long)OBD_MD_FLBLOCKS);
- LASSERTF(OBD_MD_FLBLKSZ == 64, " found %lld\n",
- (long long)OBD_MD_FLBLKSZ);
- LASSERTF(OBD_MD_FLMODE == 128, " found %lld\n",
- (long long)OBD_MD_FLMODE);
- LASSERTF(OBD_MD_FLTYPE == 256, " found %lld\n",
- (long long)OBD_MD_FLTYPE);
- LASSERTF(OBD_MD_FLUID == 512, " found %lld\n",
- (long long)OBD_MD_FLUID);
- LASSERTF(OBD_MD_FLGID == 1024, " found %lld\n",
- (long long)OBD_MD_FLGID);
- LASSERTF(OBD_MD_FLFLAGS == 2048, " found %lld\n",
- (long long)OBD_MD_FLFLAGS);
- LASSERTF(OBD_MD_FLNLINK == 8192, " found %lld\n",
- (long long)OBD_MD_FLNLINK);
- LASSERTF(OBD_MD_FLGENER == 16384, " found %lld\n",
- (long long)OBD_MD_FLGENER);
- LASSERTF(OBD_MD_FLINLINE == 32768, " found %lld\n",
- (long long)OBD_MD_FLINLINE);
- LASSERTF(OBD_MD_FLRDEV == 65536, " found %lld\n",
- (long long)OBD_MD_FLRDEV);
- LASSERTF(OBD_MD_FLEASIZE == 131072, " found %lld\n",
- (long long)OBD_MD_FLEASIZE);
- LASSERTF(OBD_MD_LINKNAME == 262144, " found %lld\n",
- (long long)OBD_MD_LINKNAME);
- LASSERTF(OBD_MD_FLHANDLE == 524288, " found %lld\n",
- (long long)OBD_MD_FLHANDLE);
- LASSERTF(OBD_MD_FLCKSUM == 1048576, " found %lld\n",
- (long long)OBD_MD_FLCKSUM);
- LASSERTF(OBD_MD_FLQOS == 2097152, " found %lld\n",
- (long long)OBD_MD_FLQOS);
- LASSERTF(OBD_MD_FLOSCOPQ == 4194304, " found %lld\n",
- (long long)OBD_MD_FLOSCOPQ);
- LASSERTF(OBD_MD_FLCOOKIE == 8388608, " found %lld\n",
- (long long)OBD_MD_FLCOOKIE);
- LASSERTF(OBD_MD_FLGROUP == 16777216, " found %lld\n",
- (long long)OBD_MD_FLGROUP);
- LASSERTF(OBD_FL_INLINEDATA == 1, " found %lld\n",
- (long long)OBD_FL_INLINEDATA);
- LASSERTF(OBD_FL_OBDMDEXISTS == 2, " found %lld\n",
- (long long)OBD_FL_OBDMDEXISTS);
- LASSERTF(OBD_FL_DELORPHAN == 4, " found %lld\n",
- (long long)OBD_FL_DELORPHAN);
- LASSERTF(OBD_FL_NORPC == 8, " found %lld\n",
- (long long)OBD_FL_NORPC);
- LASSERTF(OBD_FL_IDONLY == 16, " found %lld\n",
- (long long)OBD_FL_IDONLY);
- LASSERTF(OBD_FL_RECREATE_OBJS == 32, " found %lld\n",
- (long long)OBD_FL_RECREATE_OBJS);
-
- /* Checks for struct lov_mds_md_v1 */
- LASSERTF((int)sizeof(struct lov_mds_md_v1) == 32, " found %lld\n",
- (long long)(int)sizeof(struct lov_mds_md_v1));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_magic) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_magic));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_pattern) == 4, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_pattern));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_object_id) == 8, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_object_id));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_object_gr) == 16, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_object_gr));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_size));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_count));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count));
- LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_objects) == 32, " found %lld\n",
- (long long)(int)offsetof(struct lov_mds_md_v1, lmm_objects));
- LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects) == 0, " found %lld\n",
- (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects));
-
- /* Checks for struct lov_ost_data_v1 */
- LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, " found %lld\n",
- (long long)(int)sizeof(struct lov_ost_data_v1));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_object_id) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_object_id));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_object_gr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_object_gr));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_gen) == 16, " found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_gen));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen));
- LASSERTF((int)offsetof(struct lov_ost_data_v1, l_ost_idx) == 20, " found %lld\n",
- (long long)(int)offsetof(struct lov_ost_data_v1, l_ost_idx));
- LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx));
- LASSERTF(LOV_MAGIC_V0 == 198183888, " found %lld\n",
- (long long)LOV_MAGIC_V0);
- LASSERTF(LOV_MAGIC_V1 == 198249424, " found %lld\n",
- (long long)LOV_MAGIC_V1);
- LASSERTF(LOV_PATTERN_RAID0 == 1, " found %lld\n",
- (long long)LOV_PATTERN_RAID0);
- LASSERTF(LOV_PATTERN_RAID1 == 2, " found %lld\n",
- (long long)LOV_PATTERN_RAID1);
-
- /* Checks for struct obd_statfs */
- LASSERTF((int)sizeof(struct obd_statfs) == 144, " found %lld\n",
- (long long)(int)sizeof(struct obd_statfs));
- LASSERTF((int)offsetof(struct obd_statfs, os_type) == 0, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_type));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_type) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_type));
- LASSERTF((int)offsetof(struct obd_statfs, os_blocks) == 8, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_blocks));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_blocks) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_blocks));
- LASSERTF((int)offsetof(struct obd_statfs, os_bfree) == 16, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_bfree));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bfree) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_bfree));
- LASSERTF((int)offsetof(struct obd_statfs, os_bavail) == 24, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_bavail));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bavail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_bavail));
- LASSERTF((int)offsetof(struct obd_statfs, os_ffree) == 40, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_ffree));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_ffree) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_ffree));
- LASSERTF((int)offsetof(struct obd_statfs, os_fsid) == 48, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_fsid));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fsid) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_fsid));
- LASSERTF((int)offsetof(struct obd_statfs, os_bsize) == 88, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_bsize));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bsize) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_bsize));
- LASSERTF((int)offsetof(struct obd_statfs, os_namelen) == 92, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_namelen));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_namelen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_namelen));
- LASSERTF((int)offsetof(struct obd_statfs, os_spare) == 104, " found %lld\n",
- (long long)(int)offsetof(struct obd_statfs, os_spare));
- LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare));
-
- /* Checks for struct obd_ioobj */
- LASSERTF((int)sizeof(struct obd_ioobj) == 24, " found %lld\n",
- (long long)(int)sizeof(struct obd_ioobj));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_id) == 0, " found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_id));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_id));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_gr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_gr));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_gr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_gr));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_type) == 16, " found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_type));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_type));
- LASSERTF((int)offsetof(struct obd_ioobj, ioo_bufcnt) == 20, " found %lld\n",
- (long long)(int)offsetof(struct obd_ioobj, ioo_bufcnt));
- LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
-
- /* Checks for struct niobuf_remote */
- LASSERTF((int)sizeof(struct niobuf_remote) == 16, " found %lld\n",
- (long long)(int)sizeof(struct niobuf_remote));
- LASSERTF((int)offsetof(struct niobuf_remote, offset) == 0, " found %lld\n",
- (long long)(int)offsetof(struct niobuf_remote, offset));
- LASSERTF((int)sizeof(((struct niobuf_remote *)0)->offset) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct niobuf_remote *)0)->offset));
- LASSERTF((int)offsetof(struct niobuf_remote, len) == 8, " found %lld\n",
- (long long)(int)offsetof(struct niobuf_remote, len));
- LASSERTF((int)sizeof(((struct niobuf_remote *)0)->len) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct niobuf_remote *)0)->len));
- LASSERTF((int)offsetof(struct niobuf_remote, flags) == 12, " found %lld\n",
- (long long)(int)offsetof(struct niobuf_remote, flags));
- LASSERTF((int)sizeof(((struct niobuf_remote *)0)->flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct niobuf_remote *)0)->flags));
- LASSERTF(OBD_BRW_READ == 1, " found %lld\n",
- (long long)OBD_BRW_READ);
- LASSERTF(OBD_BRW_WRITE == 2, " found %lld\n",
- (long long)OBD_BRW_WRITE);
- LASSERTF(OBD_BRW_SYNC == 8, " found %lld\n",
- (long long)OBD_BRW_SYNC);
- LASSERTF(OBD_BRW_FROM_GRANT == 32, " found %lld\n",
- (long long)OBD_BRW_FROM_GRANT);
-
- /* Checks for struct ost_body */
- LASSERTF((int)sizeof(struct ost_body) == 176, " found %lld\n",
- (long long)(int)sizeof(struct ost_body));
- LASSERTF((int)offsetof(struct ost_body, oa) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ost_body, oa));
- LASSERTF((int)sizeof(((struct ost_body *)0)->oa) == 176, " found %lld\n",
- (long long)(int)sizeof(((struct ost_body *)0)->oa));
-
- /* Checks for struct ll_fid */
- LASSERTF((int)sizeof(struct ll_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(struct ll_fid));
- LASSERTF((int)offsetof(struct ll_fid, id) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ll_fid, id));
- LASSERTF((int)sizeof(((struct ll_fid *)0)->id) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ll_fid *)0)->id));
- LASSERTF((int)offsetof(struct ll_fid, generation) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ll_fid, generation));
- LASSERTF((int)sizeof(((struct ll_fid *)0)->generation) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ll_fid *)0)->generation));
- LASSERTF((int)offsetof(struct ll_fid, f_type) == 12, " found %lld\n",
- (long long)(int)offsetof(struct ll_fid, f_type));
- LASSERTF((int)sizeof(((struct ll_fid *)0)->f_type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ll_fid *)0)->f_type));
-
- /* Checks for struct mds_status_req */
- LASSERTF((int)sizeof(struct mds_status_req) == 8, " found %lld\n",
- (long long)(int)sizeof(struct mds_status_req));
- LASSERTF((int)offsetof(struct mds_status_req, flags) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_status_req, flags));
- LASSERTF((int)sizeof(((struct mds_status_req *)0)->flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_status_req *)0)->flags));
- LASSERTF((int)offsetof(struct mds_status_req, repbuf) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_status_req, repbuf));
- LASSERTF((int)sizeof(((struct mds_status_req *)0)->repbuf) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_status_req *)0)->repbuf));
-
- /* Checks for struct mds_body */
- LASSERTF((int)sizeof(struct mds_body) == 136, " found %lld\n",
- (long long)(int)sizeof(struct mds_body));
- LASSERTF((int)offsetof(struct mds_body, fid1) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, fid1));
- LASSERTF((int)sizeof(((struct mds_body *)0)->fid1) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->fid1));
- LASSERTF((int)offsetof(struct mds_body, fid2) == 24, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, fid2));
- LASSERTF((int)sizeof(((struct mds_body *)0)->fid2) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->fid2));
- LASSERTF((int)offsetof(struct mds_body, handle) == 48, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, handle));
- LASSERTF((int)sizeof(((struct mds_body *)0)->handle) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->handle));
- LASSERTF((int)offsetof(struct mds_body, size) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, size));
- LASSERTF((int)sizeof(((struct mds_body *)0)->size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->size));
- LASSERTF((int)offsetof(struct mds_body, blocks) == 64, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, blocks));
- LASSERTF((int)sizeof(((struct mds_body *)0)->blocks) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->blocks));
- LASSERTF((int)offsetof(struct mds_body, io_epoch) == 72, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, io_epoch));
- LASSERTF((int)sizeof(((struct mds_body *)0)->io_epoch) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->io_epoch));
- LASSERTF((int)offsetof(struct mds_body, ino) == 80, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, ino));
- LASSERTF((int)sizeof(((struct mds_body *)0)->ino) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->ino));
- LASSERTF((int)offsetof(struct mds_body, valid) == 84, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, valid));
- LASSERTF((int)sizeof(((struct mds_body *)0)->valid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->valid));
- LASSERTF((int)offsetof(struct mds_body, mode) == 88, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, mode));
- LASSERTF((int)sizeof(((struct mds_body *)0)->mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->mode));
- LASSERTF((int)offsetof(struct mds_body, uid) == 92, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, uid));
- LASSERTF((int)sizeof(((struct mds_body *)0)->uid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->uid));
- LASSERTF((int)offsetof(struct mds_body, gid) == 96, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, gid));
- LASSERTF((int)sizeof(((struct mds_body *)0)->gid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->gid));
- LASSERTF((int)offsetof(struct mds_body, mtime) == 100, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, mtime));
- LASSERTF((int)sizeof(((struct mds_body *)0)->mtime) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->mtime));
- LASSERTF((int)offsetof(struct mds_body, ctime) == 104, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, ctime));
- LASSERTF((int)sizeof(((struct mds_body *)0)->ctime) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->ctime));
- LASSERTF((int)offsetof(struct mds_body, atime) == 108, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, atime));
- LASSERTF((int)sizeof(((struct mds_body *)0)->atime) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->atime));
- LASSERTF((int)offsetof(struct mds_body, flags) == 112, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, flags));
- LASSERTF((int)sizeof(((struct mds_body *)0)->flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->flags));
- LASSERTF((int)offsetof(struct mds_body, rdev) == 116, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, rdev));
- LASSERTF((int)sizeof(((struct mds_body *)0)->rdev) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->rdev));
- LASSERTF((int)offsetof(struct mds_body, nlink) == 120, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, nlink));
- LASSERTF((int)sizeof(((struct mds_body *)0)->nlink) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->nlink));
- LASSERTF((int)offsetof(struct mds_body, generation) == 124, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, generation));
- LASSERTF((int)sizeof(((struct mds_body *)0)->generation) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->generation));
- LASSERTF((int)offsetof(struct mds_body, eadatasize) == 128, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, eadatasize));
- LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->eadatasize));
- LASSERTF((int)offsetof(struct mds_body, mds) == 132, " found %lld\n",
- (long long)(int)offsetof(struct mds_body, mds));
- LASSERTF((int)sizeof(((struct mds_body *)0)->mds) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_body *)0)->mds));
- LASSERTF(FMODE_READ == 1, " found %lld\n",
- (long long)FMODE_READ);
- LASSERTF(FMODE_WRITE == 2, " found %lld\n",
- (long long)FMODE_WRITE);
- LASSERTF(FMODE_EXEC == 4, " found %lld\n",
- (long long)FMODE_EXEC);
- LASSERTF(MDS_OPEN_CREAT == 64, " found %lld\n",
- (long long)MDS_OPEN_CREAT);
- LASSERTF(MDS_OPEN_EXCL == 128, " found %lld\n",
- (long long)MDS_OPEN_EXCL);
- LASSERTF(MDS_OPEN_TRUNC == 512, " found %lld\n",
- (long long)MDS_OPEN_TRUNC);
- LASSERTF(MDS_OPEN_APPEND == 1024, " found %lld\n",
- (long long)MDS_OPEN_APPEND);
- LASSERTF(MDS_OPEN_SYNC == 4096, " found %lld\n",
- (long long)MDS_OPEN_SYNC);
- LASSERTF(MDS_OPEN_DIRECTORY == 65536, " found %lld\n",
- (long long)MDS_OPEN_DIRECTORY);
- LASSERTF(MDS_OPEN_DELAY_CREATE == 16777216, " found %lld\n",
- (long long)MDS_OPEN_DELAY_CREATE);
- LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n",
- (long long)MDS_OPEN_HAS_EA);
-
- /* Checks for struct mds_rec_setattr */
- LASSERTF((int)sizeof(struct mds_rec_setattr) == 80, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_setattr));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_valid) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_valid));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_valid));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fid) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_fid));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fid));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mode) == 32, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_mode));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mode));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_uid) == 36, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_uid));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_uid));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_gid) == 40, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_gid));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_gid));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_attr_flags) == 44, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_attr_flags));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_size) == 48, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_size));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_size));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_atime) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_atime));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_atime));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mtime) == 64, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_mtime));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime));
- LASSERTF((int)offsetof(struct mds_rec_setattr, sa_ctime) == 72, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_setattr, sa_ctime));
- LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime));
-
- /* Checks for struct mds_rec_create */
- LASSERTF((int)sizeof(struct mds_rec_create) == 80, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_create));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_opcode));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_flags) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_flags));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_flags));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_mode) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_mode));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_mode));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_padding) == 12, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_padding));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_padding) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_padding));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_fid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_fid));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fid));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_replayfid) == 40, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_replayfid));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_replayfid));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_time) == 64, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_time));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_time));
- LASSERTF((int)offsetof(struct mds_rec_create, cr_rdev) == 72, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_create, cr_rdev));
- LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_rdev));
-
- /* Checks for struct mds_rec_link */
- LASSERTF((int)sizeof(struct mds_rec_link) == 64, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_link));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_opcode));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_padding) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_padding));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_padding) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_padding));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_fid1) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_fid1));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid1));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_fid2) == 32, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_fid2));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid2));
- LASSERTF((int)offsetof(struct mds_rec_link, lk_time) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_link, lk_time));
- LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_time));
-
- /* Checks for struct mds_rec_unlink */
- LASSERTF((int)sizeof(struct mds_rec_unlink) == 64, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_unlink));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_mode) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_mode));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_mode));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid1) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_fid1));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid2) == 32, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_fid2));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2));
- LASSERTF((int)offsetof(struct mds_rec_unlink, ul_time) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_unlink, ul_time));
- LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_time));
-
- /* Checks for struct mds_rec_rename */
- LASSERTF((int)sizeof(struct mds_rec_rename) == 64, " found %lld\n",
- (long long)(int)sizeof(struct mds_rec_rename));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_opcode) == 0, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_opcode));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_opcode));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_padding) == 4, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_padding));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_padding) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_padding));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid1) == 8, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_fid1));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid1));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid2) == 32, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_fid2));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid2));
- LASSERTF((int)offsetof(struct mds_rec_rename, rn_time) == 56, " found %lld\n",
- (long long)(int)offsetof(struct mds_rec_rename, rn_time));
- LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_time));
-
- /* Checks for struct lov_desc */
- LASSERTF((int)sizeof(struct lov_desc) == 72, " found %lld\n",
- (long long)(int)sizeof(struct lov_desc));
- LASSERTF((int)offsetof(struct lov_desc, ld_tgt_count) == 0, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_tgt_count));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_tgt_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_tgt_count));
- LASSERTF((int)offsetof(struct lov_desc, ld_active_tgt_count) == 4, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_active_tgt_count));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count));
- LASSERTF((int)offsetof(struct lov_desc, ld_default_stripe_count) == 8, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_default_stripe_count));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count));
- LASSERTF((int)offsetof(struct lov_desc, ld_pattern) == 12, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_pattern));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_pattern) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_pattern));
- LASSERTF((int)offsetof(struct lov_desc, ld_default_stripe_size) == 16, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_default_stripe_size));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size));
- LASSERTF((int)offsetof(struct lov_desc, ld_default_stripe_offset) == 24, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_default_stripe_offset));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset));
- LASSERTF((int)offsetof(struct lov_desc, ld_uuid) == 32, " found %lld\n",
- (long long)(int)offsetof(struct lov_desc, ld_uuid));
- LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct lov_desc *)0)->ld_uuid));
-
- /* Checks for struct ldlm_res_id */
- LASSERTF((int)sizeof(struct ldlm_res_id) == 32, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_res_id));
- LASSERTF((int)offsetof(struct ldlm_res_id, name[4]) == 32, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_res_id, name[4]));
- LASSERTF((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_res_id *)0)->name[4]));
-
- /* Checks for struct ldlm_extent */
- LASSERTF((int)sizeof(struct ldlm_extent) == 24, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_extent));
- LASSERTF((int)offsetof(struct ldlm_extent, start) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_extent, start));
- LASSERTF((int)sizeof(((struct ldlm_extent *)0)->start) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_extent *)0)->start));
- LASSERTF((int)offsetof(struct ldlm_extent, end) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_extent, end));
- LASSERTF((int)sizeof(((struct ldlm_extent *)0)->end) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_extent *)0)->end));
- LASSERTF((int)offsetof(struct ldlm_extent, gid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_extent, gid));
- LASSERTF((int)sizeof(((struct ldlm_extent *)0)->gid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_extent *)0)->gid));
-
- /* Checks for struct ldlm_flock */
- LASSERTF((int)sizeof(struct ldlm_flock) == 40, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_flock));
- LASSERTF((int)offsetof(struct ldlm_flock, start) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, start));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->start) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->start));
- LASSERTF((int)offsetof(struct ldlm_flock, end) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, end));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->end) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->end));
- LASSERTF((int)offsetof(struct ldlm_flock, pid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, pid));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->pid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->pid));
- LASSERTF((int)offsetof(struct ldlm_flock, blocking_pid) == 24, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, blocking_pid));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->blocking_pid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->blocking_pid));
- LASSERTF((int)offsetof(struct ldlm_flock, blocking_export) == 32, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_flock, blocking_export));
- LASSERTF((int)sizeof(((struct ldlm_flock *)0)->blocking_export) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_flock *)0)->blocking_export));
-
- /* Checks for struct ldlm_intent */
- LASSERTF((int)sizeof(struct ldlm_intent) == 8, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_intent));
- LASSERTF((int)offsetof(struct ldlm_intent, opc) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_intent, opc));
- LASSERTF((int)sizeof(((struct ldlm_intent *)0)->opc) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_intent *)0)->opc));
-
- /* Checks for struct ldlm_resource_desc */
- LASSERTF((int)sizeof(struct ldlm_resource_desc) == 40, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_resource_desc));
- LASSERTF((int)offsetof(struct ldlm_resource_desc, lr_type) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_resource_desc, lr_type));
- LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_type));
- LASSERTF((int)offsetof(struct ldlm_resource_desc, lr_name) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_resource_desc, lr_name));
- LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_name));
-
- /* Checks for struct ldlm_lock_desc */
- LASSERTF((int)sizeof(struct ldlm_lock_desc) == 88, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_lock_desc));
- LASSERTF((int)offsetof(struct ldlm_lock_desc, l_resource) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_lock_desc, l_resource));
- LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_resource) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_resource));
- LASSERTF((int)offsetof(struct ldlm_lock_desc, l_req_mode) == 40, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_lock_desc, l_req_mode));
- LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode));
- LASSERTF((int)offsetof(struct ldlm_lock_desc, l_granted_mode) == 44, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_lock_desc, l_granted_mode));
- LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode));
- LASSERTF((int)offsetof(struct ldlm_lock_desc, l_policy_data) == 48, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_lock_desc, l_policy_data));
- LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data));
-
- /* Checks for struct ldlm_request */
- LASSERTF((int)sizeof(struct ldlm_request) == 112, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_request));
- LASSERTF((int)offsetof(struct ldlm_request, lock_flags) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_flags));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_flags));
- LASSERTF((int)offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_desc));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 88, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_desc));
- LASSERTF((int)offsetof(struct ldlm_request, lock_handle1) == 96, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_handle1));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_handle1) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_handle1));
- LASSERTF((int)offsetof(struct ldlm_request, lock_handle2) == 104, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_handle2));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_handle2) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_handle2));
-
- /* Checks for struct ldlm_reply */
- LASSERTF((int)sizeof(struct ldlm_reply) == 120, " found %lld\n",
- (long long)(int)sizeof(struct ldlm_reply));
- LASSERTF((int)offsetof(struct ldlm_reply, lock_flags) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_reply, lock_flags));
- LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_flags));
- LASSERTF((int)offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_request, lock_desc));
- LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 88, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_request *)0)->lock_desc));
- LASSERTF((int)offsetof(struct ldlm_reply, lock_handle) == 96, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_reply, lock_handle));
- LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_handle) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_handle));
- LASSERTF((int)offsetof(struct ldlm_reply, lock_policy_res1) == 104, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_reply, lock_policy_res1));
- LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1));
- LASSERTF((int)offsetof(struct ldlm_reply, lock_policy_res2) == 112, " found %lld\n",
- (long long)(int)offsetof(struct ldlm_reply, lock_policy_res2));
- LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2));
-
- /* Checks for struct ost_lvb */
- LASSERTF((int)sizeof(struct ost_lvb) == 40, " found %lld\n",
- (long long)(int)sizeof(struct ost_lvb));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_size) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_size));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_size) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_size));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_mtime) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_mtime));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_mtime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_mtime));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_atime) == 16, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_atime));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_atime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_atime));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_ctime) == 24, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_ctime));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_ctime) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_ctime));
- LASSERTF((int)offsetof(struct ost_lvb, lvb_blocks) == 32, " found %lld\n",
- (long long)(int)offsetof(struct ost_lvb, lvb_blocks));
- LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_blocks) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_blocks));
-
- /* Checks for struct ptlbd_op */
- LASSERTF((int)sizeof(struct ptlbd_op) == 12, " found %lld\n",
- (long long)(int)sizeof(struct ptlbd_op));
- LASSERTF((int)offsetof(struct ptlbd_op, op_cmd) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op_cmd));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op_cmd));
- LASSERTF((int)offsetof(struct ptlbd_op, op_lun) == 2, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op_lun));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op_lun));
- LASSERTF((int)offsetof(struct ptlbd_op, op_niob_cnt) == 4, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op_niob_cnt));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt));
- LASSERTF((int)offsetof(struct ptlbd_op, op__padding) == 6, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op__padding));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op__padding));
- LASSERTF((int)offsetof(struct ptlbd_op, op_block_cnt) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_op, op_block_cnt));
- LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_op *)0)->op_block_cnt));
-
- /* Checks for struct ptlbd_niob */
- LASSERTF((int)sizeof(struct ptlbd_niob) == 24, " found %lld\n",
- (long long)(int)sizeof(struct ptlbd_niob));
- LASSERTF((int)offsetof(struct ptlbd_niob, n_xid) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_niob, n_xid));
- LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_xid));
- LASSERTF((int)offsetof(struct ptlbd_niob, n_block_nr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_niob, n_block_nr));
- LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_block_nr));
- LASSERTF((int)offsetof(struct ptlbd_niob, n_offset) == 16, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_niob, n_offset));
- LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_offset));
- LASSERTF((int)offsetof(struct ptlbd_niob, n_length) == 20, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_niob, n_length));
- LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_length));
-
- /* Checks for struct ptlbd_rsp */
- LASSERTF((int)sizeof(struct ptlbd_rsp) == 4, " found %lld\n",
- (long long)(int)sizeof(struct ptlbd_rsp));
- LASSERTF((int)offsetof(struct ptlbd_rsp, r_status) == 0, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_rsp, r_status));
- LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_status));
- LASSERTF((int)offsetof(struct ptlbd_rsp, r_error_cnt) == 2, " found %lld\n",
- (long long)(int)offsetof(struct ptlbd_rsp, r_error_cnt));
- LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2, " found %lld\n",
- (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt));
-
- /* Checks for struct llog_logid */
- LASSERTF((int)sizeof(struct llog_logid) == 20, " found %lld\n",
- (long long)(int)sizeof(struct llog_logid));
- LASSERTF((int)offsetof(struct llog_logid, lgl_oid) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_oid));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oid));
- LASSERTF((int)offsetof(struct llog_logid, lgl_ogr) == 8, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_ogr));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogr) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogr));
- LASSERTF((int)offsetof(struct llog_logid, lgl_ogen) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid, lgl_ogen));
- LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen));
- LASSERTF(OST_SZ_REC == 274730752, " found %lld\n",
- (long long)OST_SZ_REC);
- LASSERTF(OST_RAID1_REC == 274731008, " found %lld\n",
- (long long)OST_RAID1_REC);
- LASSERTF(MDS_UNLINK_REC == 274801668, " found %lld\n",
- (long long)MDS_UNLINK_REC);
- LASSERTF(OBD_CFG_REC == 274857984, " found %lld\n",
- (long long)OBD_CFG_REC);
- LASSERTF(PTL_CFG_REC == 274923520, " found %lld\n",
- (long long)PTL_CFG_REC);
- LASSERTF(LLOG_GEN_REC == 274989056, " found %lld\n",
- (long long)LLOG_GEN_REC);
- LASSERTF(LLOG_HDR_MAGIC == 275010873, " found %lld\n",
- (long long)LLOG_HDR_MAGIC);
- LASSERTF(LLOG_LOGID_MAGIC == 275010875, " found %lld\n",
- (long long)LLOG_LOGID_MAGIC);
-
- /* Checks for struct llog_catid */
- LASSERTF((int)sizeof(struct llog_catid) == 32, " found %lld\n",
- (long long)(int)sizeof(struct llog_catid));
- LASSERTF((int)offsetof(struct llog_catid, lci_logid) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_catid, lci_logid));
- LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_logid) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llog_catid *)0)->lci_logid));
-
- /* Checks for struct llog_rec_hdr */
- LASSERTF((int)sizeof(struct llog_rec_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(struct llog_rec_hdr));
- LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_len) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_hdr, lrh_len));
- LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_len) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_len));
- LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_index) == 4, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_hdr, lrh_index));
- LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_index));
- LASSERTF((int)offsetof(struct llog_rec_hdr, lrh_type) == 8, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_hdr, lrh_type));
- LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type));
-
- /* Checks for struct llog_rec_tail */
- LASSERTF((int)sizeof(struct llog_rec_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(struct llog_rec_tail));
- LASSERTF((int)offsetof(struct llog_rec_tail, lrt_len) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_tail, lrt_len));
- LASSERTF((int)sizeof(((struct llog_rec_tail *)0)->lrt_len) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_len));
- LASSERTF((int)offsetof(struct llog_rec_tail, lrt_index) == 4, " found %lld\n",
- (long long)(int)offsetof(struct llog_rec_tail, lrt_index));
- LASSERTF((int)sizeof(((struct llog_rec_tail *)0)->lrt_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_index));
-
- /* Checks for struct llog_logid_rec */
- LASSERTF((int)sizeof(struct llog_logid_rec) == 64, " found %lld\n",
- (long long)(int)sizeof(struct llog_logid_rec));
- LASSERTF((int)offsetof(struct llog_logid_rec, lid_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid_rec, lid_hdr));
- LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_hdr));
- LASSERTF((int)offsetof(struct llog_logid_rec, lid_id) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid_rec, lid_id));
- LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_id));
- LASSERTF((int)offsetof(struct llog_logid_rec, lid_tail) == 56, " found %lld\n",
- (long long)(int)offsetof(struct llog_logid_rec, lid_tail));
- LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_tail));
-
- /* Checks for struct llog_create_rec */
- LASSERTF((int)sizeof(struct llog_create_rec) == 64, " found %lld\n",
- (long long)(int)sizeof(struct llog_create_rec));
- LASSERTF((int)offsetof(struct llog_create_rec, lcr_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_create_rec, lcr_hdr));
- LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_hdr));
- LASSERTF((int)offsetof(struct llog_create_rec, lcr_fid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_create_rec, lcr_fid));
- LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_fid));
- LASSERTF((int)offsetof(struct llog_create_rec, lcr_oid) == 40, " found %lld\n",
- (long long)(int)offsetof(struct llog_create_rec, lcr_oid));
- LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_oid));
- LASSERTF((int)offsetof(struct llog_create_rec, lcr_ogen) == 48, " found %lld\n",
- (long long)(int)offsetof(struct llog_create_rec, lcr_ogen));
- LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogen));
-
- /* Checks for struct llog_orphan_rec */
- LASSERTF((int)sizeof(struct llog_orphan_rec) == 40, " found %lld\n",
- (long long)(int)sizeof(struct llog_orphan_rec));
- LASSERTF((int)offsetof(struct llog_orphan_rec, lor_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_orphan_rec, lor_hdr));
- LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr));
- LASSERTF((int)offsetof(struct llog_orphan_rec, lor_oid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_orphan_rec, lor_oid));
- LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_oid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_oid));
- LASSERTF((int)offsetof(struct llog_orphan_rec, lor_ogen) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llog_orphan_rec, lor_ogen));
- LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen));
- LASSERTF((int)offsetof(struct llog_orphan_rec, lor_tail) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llog_orphan_rec, lor_tail));
- LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_tail));
-
- /* Checks for struct llog_unlink_rec */
- LASSERTF((int)sizeof(struct llog_unlink_rec) == 40, " found %lld\n",
- (long long)(int)sizeof(struct llog_unlink_rec));
- LASSERTF((int)offsetof(struct llog_unlink_rec, lur_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_unlink_rec, lur_hdr));
- LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr));
- LASSERTF((int)offsetof(struct llog_unlink_rec, lur_oid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_unlink_rec, lur_oid));
- LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_oid));
- LASSERTF((int)offsetof(struct llog_unlink_rec, lur_ogen) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llog_unlink_rec, lur_ogen));
- LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen));
- LASSERTF((int)offsetof(struct llog_unlink_rec, lur_tail) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llog_unlink_rec, lur_tail));
- LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_tail));
-
- /* Checks for struct llog_size_change_rec */
- LASSERTF((int)sizeof(struct llog_size_change_rec) == 56, " found %lld\n",
- (long long)(int)sizeof(struct llog_size_change_rec));
- LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_size_change_rec, lsc_hdr));
- LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr));
- LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_fid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_size_change_rec, lsc_fid));
- LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid) == 24, " found %lld\n",
- (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid));
- LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_io_epoch) == 40, " found %lld\n",
- (long long)(int)offsetof(struct llog_size_change_rec, lsc_io_epoch));
- LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch));
- LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_tail) == 48, " found %lld\n",
- (long long)(int)offsetof(struct llog_size_change_rec, lsc_tail));
- LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail));
-
- /* Checks for struct llog_gen */
- LASSERTF((int)sizeof(struct llog_gen) == 16, " found %lld\n",
- (long long)(int)sizeof(struct llog_gen));
- LASSERTF((int)offsetof(struct llog_gen, mnt_cnt) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen, mnt_cnt));
- LASSERTF((int)sizeof(((struct llog_gen *)0)->mnt_cnt) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen *)0)->mnt_cnt));
- LASSERTF((int)offsetof(struct llog_gen, conn_cnt) == 8, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen, conn_cnt));
- LASSERTF((int)sizeof(((struct llog_gen *)0)->conn_cnt) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen *)0)->conn_cnt));
-
- /* Checks for struct llog_gen_rec */
- LASSERTF((int)sizeof(struct llog_gen_rec) == 40, " found %lld\n",
- (long long)(int)sizeof(struct llog_gen_rec));
- LASSERTF((int)offsetof(struct llog_gen_rec, lgr_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen_rec, lgr_hdr));
- LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr));
- LASSERTF((int)offsetof(struct llog_gen_rec, lgr_gen) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen_rec, lgr_gen));
- LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_gen) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_gen));
- LASSERTF((int)offsetof(struct llog_gen_rec, lgr_tail) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llog_gen_rec, lgr_tail));
- LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_tail));
-
- /* Checks for struct llog_log_hdr */
- LASSERTF((int)sizeof(struct llog_log_hdr) == 8192, " found %lld\n",
- (long long)(int)sizeof(struct llog_log_hdr));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_hdr) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_hdr));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_hdr) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_hdr));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_timestamp) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_timestamp));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_count) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_count));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_count) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_count));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_bitmap_offset) == 28, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_bitmap_offset));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_size) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_size));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_size) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_size));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_flags) == 36, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_flags));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_flags));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_cat_idx) == 40, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_cat_idx));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_tgtuuid) == 44, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_tgtuuid));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_bitmap) == 88, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_bitmap));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap) == 8096, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap));
- LASSERTF((int)offsetof(struct llog_log_hdr, llh_tail) == 8184, " found %lld\n",
- (long long)(int)offsetof(struct llog_log_hdr, llh_tail));
- LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tail) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tail));
-
- /* Checks for struct llog_cookie */
- LASSERTF((int)sizeof(struct llog_cookie) == 32, " found %lld\n",
- (long long)(int)sizeof(struct llog_cookie));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_lgl) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_lgl));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_subsys) == 20, " found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_subsys));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys));
- LASSERTF((int)offsetof(struct llog_cookie, lgc_index) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llog_cookie, lgc_index));
- LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index));
-
- /* Checks for struct llogd_body */
- LASSERTF((int)sizeof(struct llogd_body) == 48, " found %lld\n",
- (long long)(int)sizeof(struct llogd_body));
- LASSERTF((int)offsetof(struct llogd_body, lgd_logid) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_logid));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_logid) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_logid));
- LASSERTF((int)offsetof(struct llogd_body, lgd_ctxt_idx) == 20, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_ctxt_idx));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx));
- LASSERTF((int)offsetof(struct llogd_body, lgd_llh_flags) == 24, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_llh_flags));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_llh_flags) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_llh_flags));
- LASSERTF((int)offsetof(struct llogd_body, lgd_index) == 28, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_index));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_index));
- LASSERTF((int)offsetof(struct llogd_body, lgd_saved_index) == 32, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_saved_index));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_saved_index));
- LASSERTF((int)offsetof(struct llogd_body, lgd_len) == 36, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_len));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_len));
- LASSERTF((int)offsetof(struct llogd_body, lgd_cur_offset) == 40, " found %lld\n",
- (long long)(int)offsetof(struct llogd_body, lgd_cur_offset));
- LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_body *)0)->lgd_cur_offset));
- LASSERTF(LLOG_ORIGIN_HANDLE_OPEN == 501, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_OPEN);
- LASSERTF(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
- LASSERTF(LLOG_ORIGIN_HANDLE_READ_HEADER == 503, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_READ_HEADER);
- LASSERTF(LLOG_ORIGIN_HANDLE_WRITE_REC == 504, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_WRITE_REC);
- LASSERTF(LLOG_ORIGIN_HANDLE_CLOSE == 505, " found %lld\n",
- (long long)LLOG_ORIGIN_HANDLE_CLOSE);
- LASSERTF(LLOG_ORIGIN_CONNECT == 506, " found %lld\n",
- (long long)LLOG_ORIGIN_CONNECT);
- LASSERTF(LLOG_CATINFO == 507, " found %lld\n",
- (long long)LLOG_CATINFO);
-
- /* Checks for struct llogd_conn_body */
- LASSERTF((int)sizeof(struct llogd_conn_body) == 40, " found %lld\n",
- (long long)(int)sizeof(struct llogd_conn_body));
- LASSERTF((int)offsetof(struct llogd_conn_body, lgdc_gen) == 0, " found %lld\n",
- (long long)(int)offsetof(struct llogd_conn_body, lgdc_gen));
- LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen) == 16, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen));
- LASSERTF((int)offsetof(struct llogd_conn_body, lgdc_logid) == 16, " found %lld\n",
- (long long)(int)offsetof(struct llogd_conn_body, lgdc_logid));
- LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid) == 20, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid));
- LASSERTF((int)offsetof(struct llogd_conn_body, lgdc_ctxt_idx) == 36, " found %lld\n",
- (long long)(int)offsetof(struct llogd_conn_body, lgdc_ctxt_idx));
- LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4, " found %lld\n",
- (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx));
}
-