Whamcloud - gitweb
b=20334 fix conflicting ioctl numbers
[fs/lustre-release.git] / lustre / include / obd.h
index c1c0495..bb56150 100644 (file)
@@ -26,7 +26,7 @@
  * 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.
  */
 /*
@@ -54,9 +54,6 @@
 
 #define IOC_MDC_TYPE         'i'
 #define IOC_MDC_MIN_NR       20
-/* Moved to lustre_user.h
-#define IOC_MDC_LOOKUP       _IOWR(IOC_MDC_TYPE, 20, struct obd_ioctl_data *)
-#define IOC_MDC_GETSTRIPE    _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *) */
 #define IOC_MDC_MAX_NR       50
 
 #include <lustre/lustre_idl.h>
@@ -88,8 +85,7 @@ struct osc_async_rc {
 };
 
 struct lov_oinfo {                 /* per-stripe data structure */
-        __u64 loi_id;              /* object ID on the target OST */
-        __u64 loi_gr;              /* object group on the target OST */
+        struct ost_id   loi_oi;    /* object ID/Sequence on the target OST */
         int loi_ost_idx;           /* OST stripe index in lov_tgt_desc->tgts */
         int loi_ost_gen;           /* generation of this loi_ost_idx */
 
@@ -106,6 +102,8 @@ struct lov_oinfo {                 /* per-stripe data structure */
         struct ost_lvb loi_lvb;
         struct osc_async_rc     loi_ar;
 };
+#define loi_id  loi_oi.oi_id
+#define loi_seq loi_oi.oi_seq
 
 static inline void loi_kms_set(struct lov_oinfo *oinfo, __u64 kms)
 {
@@ -134,7 +132,7 @@ struct lov_stripe_md {
         struct {
                 /* Public members. */
                 __u64 lw_object_id;        /* lov object id */
-                __u64 lw_object_gr;        /* lov object group */
+                __u64 lw_object_seq;       /* lov object seq */
                 __u64 lw_maxbytes;         /* maximum possible file size */
 
                 /* LOV-private members start here -- only for use in lov/. */
@@ -149,7 +147,7 @@ struct lov_stripe_md {
 };
 
 #define lsm_object_id    lsm_wire.lw_object_id
-#define lsm_object_gr    lsm_wire.lw_object_gr
+#define lsm_object_seq   lsm_wire.lw_object_seq
 #define lsm_maxbytes     lsm_wire.lw_maxbytes
 #define lsm_magic        lsm_wire.lw_magic
 #define lsm_stripe_size  lsm_wire.lw_stripe_size
@@ -227,8 +225,10 @@ struct brw_page {
 
 struct ost_server_data;
 
+#define OBT_MAGIC       0xBDDECEAE
 /* hold common fields for "target" device */
 struct obd_device_target {
+        __u32                     obt_magic;
         struct super_block       *obt_sb;
         /** last_rcvd file */
         struct file              *obt_rcvd_filp;
@@ -342,6 +342,9 @@ struct filter_obd {
 
         int                      fo_fmd_max_num; /* per exp filter_mod_data */
         int                      fo_fmd_max_age; /* jiffies to fmd expiry */
+        unsigned long            fo_syncjournal:1, /* sync journal on writes */
+                                 fo_sync_lock_cancel:2;/* sync on lock cancel */
+
 
         /* sptlrpc stuff */
         cfs_rwlock_t             fo_sptlrpc_lock;
@@ -355,12 +358,6 @@ struct filter_obd {
         int                      fo_sec_level;
 };
 
-#define fo_translock            fo_obt.obt_lut->lut_translock
-#define fo_last_rcvd_slots      fo_obt.obt_lut->lut_client_bitmap
-#define fo_mount_count          fo_obt.obt_lut->lut_mount_count
-#define fo_rcvd_filp            fo_obt.obt_rcvd_filp
-#define fo_vfsmnt               fo_obt.obt_vfsmnt
-
 struct timeout_item {
         enum timeout_event ti_event;
         cfs_time_t         ti_timeout;
@@ -376,6 +373,14 @@ struct timeout_item {
 #define OSC_MAX_DIRTY_MB_MAX   2048     /* arbitrary, but < MAX_LONG bytes */
 #define OSC_DEFAULT_RESENDS      10
 
+/* possible values for fo_sync_lock_cancel */
+enum {
+        NEVER_SYNC_ON_CANCEL = 0,
+        BLOCKING_SYNC_ON_CANCEL = 1,
+        ALWAYS_SYNC_ON_CANCEL = 2,
+        NUM_SYNC_ON_CANCEL_STATES
+};
+
 #define MDC_MAX_RIF_DEFAULT       8
 #define MDC_MAX_RIF_MAX         512
 
@@ -487,6 +492,7 @@ struct client_obd {
 #define CL_NOT_QUOTACHECKED 1   /* client->cl_qchk_stat init value */
 
 struct mgs_obd {
+        struct obd_device_target         mgs_obt;
         struct ptlrpc_service           *mgs_service;
         struct vfsmount                 *mgs_vfsmnt;
         struct super_block              *mgs_sb;
@@ -534,7 +540,7 @@ struct mds_obd {
 
 
         struct lustre_quota_info         mds_quota_info;
-        cfs_semaphore_t                  mds_qonoff_sem;
+        cfs_rw_semaphore_t               mds_qonoff_sem;
         cfs_semaphore_t                  mds_health_sem;
         unsigned long                    mds_fl_user_xattr:1,
                                          mds_fl_acl:1,
@@ -552,14 +558,6 @@ struct mds_obd {
         cfs_rw_semaphore_t               mds_notify_lock;
 };
 
-#define mds_transno_lock         mds_obt.obt_translock
-#define mds_rcvd_filp            mds_obt.obt_rcvd_filp
-#define mds_server_data          mds_obt.obt_lsd
-#define mds_client_bitmap        mds_obt.obt_client_bitmap
-#define mds_mount_count          mds_obt.obt_mount_count
-#define mds_last_transno         mds_obt.obt_last_transno
-#define mds_vfsmnt               mds_obt.obt_vfsmnt
-
 /* lov objid */
 extern __u32 mds_max_ost_index;
 
@@ -640,6 +638,9 @@ struct lov_qos_rr {
         unsigned long       lqr_dirty:1;     /* recalc round-robin list */
 };
 
+/* allow statfs data caching for 1 second */
+#define OBD_STATFS_CACHE_SECONDS 1
+
 struct lov_statfs_data {
         struct obd_info   lsd_oi;
         struct obd_statfs lsd_statfs;
@@ -774,7 +775,7 @@ struct niobuf_local {
 
 #define LUSTRE_CMM_NAME         "cmm"
 #define LUSTRE_MDD_NAME         "mdd"
-#define LUSTRE_OSD_NAME         "osd"
+#define LUSTRE_OSD_NAME         "osd-ldiskfs"
 #define LUSTRE_VVP_NAME         "vvp"
 #define LUSTRE_LMV_NAME         "lmv"
 #define LUSTRE_CMM_MDC_NAME     "cmm-mdc"
@@ -930,13 +931,6 @@ struct target_recovery_data {
         cfs_completion_t  trd_finishing;
 };
 
-enum filter_groups {
-        FILTER_GROUP_MDS0 = 0,
-        FILTER_GROUP_LLOG = 1,
-        FILTER_GROUP_ECHO = 2 ,
-        FILTER_GROUP_MDS1_N_BASE = 3
-};
-
 /**
   * In HEAD for CMD, the object is created in group number which is 3>=
   * or indexing starts from 3. To test this assertions are added to disallow
@@ -947,48 +941,30 @@ enum filter_groups {
   * 2. The group number indexing starts from 0 instead of 3
   */
 
-static inline int filter_group_is_mds(obd_gr group)
-{
-        return (group == FILTER_GROUP_MDS0 ||
-                group >= FILTER_GROUP_MDS1_N_BASE);
-}
-
-#define LASSERT_MDS_GROUP(group) LASSERT(filter_group_is_mds(group))
+#define LASSERT_SEQ_IS_MDT(seq) LASSERT(fid_seq_is_mdt(seq))
 
-static inline __u64 objgrp_to_mdsno(obd_gr group)
+static inline __u64 objseq_to_mdsno(obd_seq seq)
 {
-        LASSERT(filter_group_is_mds(group));
-        if (group == FILTER_GROUP_MDS0)
+        LASSERT_SEQ_IS_MDT(seq);
+        if (seq == FID_SEQ_OST_MDT0)
                 return 0;
-        return group - FILTER_GROUP_MDS1_N_BASE + 1;
+        return seq - FID_SEQ_OST_MDT1 + 1;
 }
 
-static inline int mdt_to_obd_objgrp(int mdtid)
+static inline int mdt_to_obd_objseq(int mdtid)
 {
         /**
-         * MDS0 uses group 0 always, other MDSes will use groups from
-         * FILTER_GROUP_MDS1_N_BASE
+         * MDS0 uses seq 0 pre FID-on-OST, other MDSes will use seq from
+         * FID_SEQ_OST_MDT1
          */
         if (mdtid)
-                return FILTER_GROUP_MDS1_N_BASE + mdtid - 1;
+                return FID_SEQ_OST_MDT1 + mdtid - 1;
         return 0;
 }
 
-static inline __u64 obdo_mdsno(struct obdo *oa)
-{
-        LASSERT((oa->o_valid & OBD_MD_FLGROUP));
-        return objgrp_to_mdsno(oa->o_gr);
-}
-
-static inline int obdo_is_mds(struct obdo *oa)
-{
-        LASSERT(oa->o_valid & OBD_MD_FLGROUP);
-        return filter_group_is_mds(oa->o_gr);
-}
-
 struct obd_llog_group {
         cfs_list_t         olg_list;
-        int                olg_group;
+        int                olg_seq;
         struct llog_ctxt  *olg_ctxts[LLOG_MAX_CTXTS];
         cfs_waitq_t        olg_waitq;
         cfs_spinlock_t     olg_lock;
@@ -1173,6 +1149,7 @@ enum obd_cleanup_stage {
 /*      KEY_SET_INFO in lustre_idl.h */
 #define KEY_SPTLRPC_CONF        "sptlrpc_conf"
 #define KEY_CONNECT_FLAG        "connect_flags"
+#define KEY_SYNC_LOCK_CANCEL    "sync_lock_cancel"
 
 
 struct lu_context;
@@ -1348,8 +1325,8 @@ struct obd_ops {
                       struct lustre_handle *srconn, struct lov_stripe_md *src,
                       obd_size start, obd_size end, struct obd_trans_info *);
         int (*o_iterate)(struct lustre_handle *conn,
-                         int (*)(obd_id, obd_gr, void *),
-                         obd_id *startid, obd_gr group, void *data);
+                         int (*)(obd_id, obd_seq, void *),
+                         obd_id *startid, obd_seq seq, void *data);
         int (*o_preprw)(int cmd, struct obd_export *exp, struct obdo *oa,
                         int objcount, struct obd_ioobj *obj,
                         struct niobuf_remote *remote, int *nr_pages,
@@ -1371,7 +1348,7 @@ struct obd_ops {
         int (*o_cancel)(struct obd_export *, struct lov_stripe_md *md,
                         __u32 mode, struct lustre_handle *);
         int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
-                               int flags, void *opaque);
+                               ldlm_cancel_flags_t flags, void *opaque);
         int (*o_init_export)(struct obd_export *exp);
         int (*o_destroy_export)(struct obd_export *exp);
         int (*o_extent_calc)(struct obd_export *, struct lov_stripe_md *,
@@ -1539,8 +1516,8 @@ struct md_ops {
                                     struct lustre_handle *);
 
         int (*m_cancel_unused)(struct obd_export *, const struct lu_fid *,
-                               ldlm_policy_data_t *, ldlm_mode_t, int flags,
-                               void *opaque);
+                               ldlm_policy_data_t *, ldlm_mode_t,
+                               ldlm_cancel_flags_t flags, void *opaque);
         int (*m_renew_capa)(struct obd_export *, struct obd_capa *oc,
                             renew_capa_cb_t cb);
         int (*m_unpack_capa)(struct obd_export *, struct ptlrpc_request *,
@@ -1657,4 +1634,7 @@ static inline struct md_open_data *obd_mod_alloc(void)
         }                                                       \
 })
 
+extern void obdo_from_inode(struct obdo *dst, struct inode *src,
+                            struct lu_fid *parent, obd_flag valid);
+
 #endif /* __OBD_H */