Whamcloud - gitweb
LU-2158 lvfs: Remove functions from lvfs_linux.c
[fs/lustre-release.git] / lustre / include / obd.h
index f69baea..9b51c8f 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -576,6 +576,7 @@ struct ost_obd {
        struct ptlrpc_service   *ost_service;
        struct ptlrpc_service   *ost_create_service;
        struct ptlrpc_service   *ost_io_service;
+       struct ptlrpc_service   *ost_seq_service;
        struct mutex            ost_health_mutex;
 };
 
@@ -707,11 +708,11 @@ struct lov_obd {
 };
 
 struct lmv_tgt_desc {
-        struct obd_uuid         ltd_uuid;
-        struct obd_export      *ltd_exp;
-        int                     ltd_active; /* is this target up for requests */
-        int                     ltd_idx;
+       struct obd_uuid         ltd_uuid;
+       struct obd_export       *ltd_exp;
+       int                     ltd_idx;
        struct mutex            ltd_fid_mutex;
+       unsigned long           ltd_active:1; /* target up for requests */
 };
 
 enum placement_policy {
@@ -727,25 +728,22 @@ struct lmv_obd {
        int                     refcount;
        struct lu_client_fld    lmv_fld;
        spinlock_t              lmv_lock;
-        placement_policy_t      lmv_placement;
-        struct lmv_desc         desc;
-        struct obd_uuid         cluuid;
-        struct obd_export       *exp;
-
-        int                     connected;
-        int                     max_easize;
-        int                     max_def_easize;
-        int                     max_cookiesize;
-        int                     server_timeout;
-       struct mutex            init_mutex;
+       placement_policy_t      lmv_placement;
+       struct lmv_desc         desc;
+       struct obd_uuid         cluuid;
+       struct obd_export       *exp;
 
-        struct lmv_tgt_desc     *tgts;
-        int                     tgts_size;
+       struct mutex            init_mutex;
+       int                     connected;
+       int                     max_easize;
+       int                     max_def_easize;
+       int                     max_cookiesize;
+       int                     server_timeout;
 
-        struct obd_connect_data *datas;
-        int                     datas_size;
+       int                     tgts_size; /* size of tgts array */
+       struct lmv_tgt_desc     **tgts;
 
-        struct obd_connect_data conn_data;
+       struct obd_connect_data conn_data;
 };
 
 struct niobuf_local {
@@ -796,12 +794,46 @@ struct niobuf_local {
 #define LUSTRE_MGS_OBDNAME "MGS"
 #define LUSTRE_MGC_OBDNAME "MGC"
 
+static inline int is_osp_on_mdt(char *name)
+{
+       char   *ptr;
+
+       ptr = strrchr(name, '-');
+       if (ptr == NULL) {
+               CERROR("%s is not a obdname\n", name);
+               return 0;
+       }
+
+       /* 1.8 OSC/OSP name on MDT is fsname-OSTxxxx-osc */
+       if (strncmp(ptr + 1, "osc", 3) == 0)
+               return 1;
+
+       if (strncmp(ptr + 1, "MDT", 3) != 0)
+               return 0;
+
+       while (*(--ptr) != '-' && ptr != name);
+
+       if (ptr == name)
+               return 0;
+
+       if (strncmp(ptr + 1, LUSTRE_OSP_NAME, strlen(LUSTRE_OSP_NAME)) != 0 &&
+           strncmp(ptr + 1, LUSTRE_OSC_NAME, strlen(LUSTRE_OSC_NAME)) != 0)
+               return 0;
+
+       return 1;
+}
+
 /* Don't conflict with on-wire flags OBD_BRW_WRITE, etc */
 #define N_LOCAL_TEMP_PAGE 0x10000000
 
-static inline int is_osp_on_ost(char *name)
+/* Currently the connection osp is only for connecting MDT0, the
+ * name would either be
+ * fsname-MDT0000-osp-OSTxxxx or fsname-MDT0000-osp-MDT0000 */
+static inline int is_osp_for_connection(char *name)
 {
-       char   *ptr;
+       char    *ptr;
+       int     osp_on_mdt0 = 0;
+       char    *endptr;
 
        ptr = strrchr(name, '-');
        if (ptr == NULL) {
@@ -812,6 +844,19 @@ static inline int is_osp_on_ost(char *name)
        if (strncmp(ptr + 1, "OST", 3) != 0 && strncmp(ptr + 1, "MDT", 3) != 0)
                return 0;
 
+       if (strncmp(ptr + 1, "MDT", 3) == 0) {
+               int index;
+
+#ifdef __KERNEL__
+               index = simple_strtoul(ptr + 4, &endptr, 16);
+#else
+               index = strtoul(ptr + 4, &endptr, 16);
+#endif
+               if (index != 0)
+                       return 0;
+               osp_on_mdt0 = 1;
+       }
+
        /* match the "-osp" */
        if (ptr - name < strlen(LUSTRE_OSP_NAME) + 1)
                return 0;
@@ -823,6 +868,25 @@ static inline int is_osp_on_ost(char *name)
        if (strncmp(ptr + 1, LUSTRE_OSP_NAME, strlen(LUSTRE_OSP_NAME)) != 0)
                return 0;
 
+       if (osp_on_mdt0) {
+               int index = 0;
+               while (*(--ptr) != '-' && ptr != name);
+
+               if (ptr == name) {
+                       CERROR("%s is not a valid osp name\n", name);
+                       return 0;
+               }
+
+               if (strncmp(ptr + 1, "MDT", 3) != 0)
+                       return 0;
+#ifdef __KERNEL__
+               index = simple_strtoul(ptr + 4, &endptr, 16);
+#else
+               index = strtoul(ptr + 4, &endptr, 16);
+#endif
+               if (index != 0)
+                       return 0;
+       }
        return 1;
 }
 
@@ -1272,6 +1336,12 @@ typedef int (* md_enqueue_cb_t)(struct ptlrpc_request *req,
                                 struct md_enqueue_info *minfo,
                                 int rc);
 
+/* seq client type */
+enum lu_cli_type {
+       LUSTRE_SEQ_METADATA = 1,
+       LUSTRE_SEQ_DATA
+};
+
 struct md_enqueue_info {
         struct md_op_data       mi_data;
         struct lookup_intent    mi_it;
@@ -1320,9 +1390,10 @@ struct obd_ops {
                            void *localdata);
         int (*o_disconnect)(struct obd_export *exp);
 
-        /* Initialize/finalize fids infrastructure. */
-        int (*o_fid_init)(struct obd_export *exp);
-        int (*o_fid_fini)(struct obd_export *exp);
+       /* Initialize/finalize fids infrastructure. */
+       int (*o_fid_init)(struct obd_device *obd,
+                         struct obd_export *exp, enum lu_cli_type type);
+       int (*o_fid_fini)(struct obd_device *obd);
 
         /* Allocate new fid according to passed @hint. */
         int (*o_fid_alloc)(struct obd_export *exp, struct lu_fid *fid,
@@ -1623,8 +1694,6 @@ static inline const struct lsm_operations *lsm_op_find(int magic)
         }
 }
 
-int lvfs_check_io_health(struct obd_device *obd, struct file *file);
-
 /* Requests for obd_extent_calc() */
 #define OBD_CALC_STRIPE_START   1
 #define OBD_CALC_STRIPE_END     2