* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
/* check if request's xid is equal to last one or not*/
static inline int req_xid_is_last(struct ptlrpc_request *req)
{
- struct lsd_client_data *lcd = req->rq_export->exp_mdt_data.med_lcd;
+ struct lsd_client_data *lcd = req->rq_export->exp_target_data.ted_lcd;
return (req->rq_xid == lcd->lcd_last_xid ||
req->rq_xid == lcd->lcd_last_close_xid);
}
/* file data for open files on MDS */
struct mdt_file_data {
struct portals_handle mfd_handle; /* must be first */
- struct list_head mfd_list; /* protected by med_open_lock */
+ cfs_list_t mfd_list; /* protected by med_open_lock */
__u64 mfd_xid; /* xid of the open request */
struct lustre_handle mfd_old_handle; /* old handle in replay case */
int mfd_mode; /* open mode provided by client */
struct mdt_object *mfd_object; /* point to opened object */
};
+/* mdt state flag bits */
+#define MDT_FL_CFGLOG 0
+#define MDT_FL_SYNCED 1
+
struct mdt_device {
/* super-class */
struct md_device mdt_md_dev;
mo_cos :1;
} mdt_opts;
/* mdt state flags */
- __u32 mdt_fl_cfglog:1,
- mdt_fl_synced:1;
+ unsigned long mdt_state;
/* lock to protect IOepoch */
- spinlock_t mdt_ioepoch_lock;
+ cfs_spinlock_t mdt_ioepoch_lock;
__u64 mdt_ioepoch;
/* transaction callbacks */
struct upcall_cache *mdt_identity_cache;
/* sptlrpc rules */
- rwlock_t mdt_sptlrpc_lock;
+ cfs_rwlock_t mdt_sptlrpc_lock;
struct sptlrpc_rule_set mdt_sptlrpc_rset;
/* capability keys */
/* root squash */
uid_t mdt_squash_uid;
gid_t mdt_squash_gid;
- struct list_head mdt_nosquash_nids;
+ cfs_list_t mdt_nosquash_nids;
char *mdt_nosquash_str;
int mdt_nosquash_strlen;
- struct rw_semaphore mdt_squash_sem;
+ cfs_rw_semaphore_t mdt_squash_sem;
cfs_proc_dir_entry_t *mdt_proc_entry;
struct lprocfs_stats *mdt_stats;
int mdt_sec_level;
};
-#define mdt_transno_lock mdt_lut.lut_translock
-#define mdt_last_transno mdt_lut.lut_last_transno
-#define mdt_last_rcvd mdt_lut.lut_last_rcvd
-#define mdt_mount_count mdt_lut.lut_mount_count
-#define mdt_lsd mdt_lut.lut_lsd
-#define mdt_client_bitmap_lock mdt_lut.lut_client_bitmap_lock
-#define mdt_client_bitmap mdt_lut.lut_client_bitmap
-
#define MDT_SERVICE_WATCHDOG_FACTOR (2)
#define MDT_ROCOMPAT_SUPP (OBD_ROCOMPAT_LOVOBJID)
#define MDT_INCOMPAT_SUPP (OBD_INCOMPAT_MDT | OBD_INCOMPAT_COMMON_LR | \
OBD_INCOMPAT_FID | OBD_INCOMPAT_IAM_DIR)
-#define MDT_COS_DEFAULT (1)
+#define MDT_COS_DEFAULT (0)
struct mdt_object {
struct lu_object_header mot_header;
int mot_ioepoch_count;
int mot_writecount;
/* Lock to protect object's IO epoch. */
- struct semaphore mot_ioepoch_sem;
+ cfs_semaphore_t mot_ioepoch_sem;
};
enum mdt_object_flags {
struct mdt_reint_record mti_rr;
/** md objects included in operation */
- struct mdt_object *mti_mos[PTLRPC_NUM_VERSIONS];
-
+ struct mdt_object *mti_mos;
+ __u64 mti_ver[PTLRPC_NUM_VERSIONS];
/*
* Operation specification (currently create and lookup)
*/
struct obd_uuid uuid[2]; /* for mdt_seq_init_cli() */
char ns_name[48]; /* for mdt_init0() */
struct lustre_cfg_bufs bufs; /* for mdt_stack_fini() */
- struct kstatfs ksfs; /* for mdt_statfs() */
+ cfs_kstatfs_t ksfs; /* for mdt_statfs() */
struct {
/* for mdt_readpage() */
struct lu_rdpg mti_rdpg;
struct md_attr mti_tmp_attr;
};
-#define mti_parent mti_mos[0]
-#define mti_child mti_mos[1]
-#define mti_parent1 mti_mos[2]
-#define mti_child1 mti_mos[3]
-
typedef void (*mdt_cb_t)(const struct mdt_device *mdt, __u64 transno,
void *data, int err);
struct mdt_commit_cb {
return info->mti_pill ? info->mti_pill->rc_req : NULL;
}
+static inline int req_is_replay(struct ptlrpc_request *req)
+{
+ LASSERT(req->rq_reqmsg);
+ return !!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY);
+}
+
static inline __u64 mdt_conn_flags(struct mdt_thread_info *info)
{
LASSERT(info->mti_exp);
int mdt_init_ucred(struct mdt_thread_info *, struct mdt_body *);
int mdt_init_ucred_reint(struct mdt_thread_info *);
void mdt_exit_ucred(struct mdt_thread_info *);
-int mdt_version_get_check(struct mdt_thread_info *, int);
+int mdt_version_get_check(struct mdt_thread_info *, struct mdt_object *, int);
+void mdt_version_get_save(struct mdt_thread_info *, struct mdt_object *, int);
+int mdt_version_get_check_save(struct mdt_thread_info *, struct mdt_object *,
+ int);
/* mdt_idmap.c */
int mdt_init_sec_level(struct mdt_thread_info *);
RETURN(1);
}
DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")",
- req->rq_export->exp_mdt_data.med_lcd->lcd_last_xid);
+ req->rq_export->exp_target_data.ted_lcd->lcd_last_xid);
}
RETURN(0);
}
int mdt_hsm_copytool_send(struct obd_export *exp);
/* lprocfs stuff */
+enum {
+ LPROC_MDT_OPEN = 0,
+ LPROC_MDT_CLOSE,
+ LPROC_MDT_MKNOD,
+ LPROC_MDT_LINK,
+ LPROC_MDT_UNLINK,
+ LPROC_MDT_MKDIR,
+ LPROC_MDT_RMDIR,
+ LPROC_MDT_RENAME,
+ LPROC_MDT_GETXATTR,
+ LPROC_MDT_SETXATTR,
+ LPROC_MDT_LAST,
+};
+void mdt_counter_incr(struct obd_export *exp, int opcode);
+void mdt_stats_counter_init(struct lprocfs_stats *stats);
void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars);
int mdt_procfs_init(struct mdt_device *mdt, const char *name);
int mdt_procfs_fini(struct mdt_device *mdt);
void mdt_time_start(const struct mdt_thread_info *info);
void mdt_time_end(const struct mdt_thread_info *info, int idx);
-enum {
- LPROC_MDT_NR
-};
-
/* Capability */
int mdt_ck_thread_start(struct mdt_device *mdt);
void mdt_ck_thread_stop(struct mdt_device *mdt);