Whamcloud - gitweb
LU-5577 obd: change brw_page->count to unsigned
[fs/lustre-release.git] / lustre / include / obd.h
index 8c966ab..ec69de4 100644 (file)
@@ -37,6 +37,7 @@
 #ifndef __OBD_H
 #define __OBD_H
 
+#include <linux/spinlock.h>
 #include <linux/obd.h>
 
 #include <lustre/lustre_idl.h>
@@ -107,7 +108,7 @@ struct lov_stripe_md {
                 __u32 lw_pattern;          /* striping pattern (RAID0, RAID1) */
                 __u16 lw_stripe_count;  /* number of objects being striped over */
                 __u16 lw_layout_gen;       /* generation of the layout */
-                char  lw_pool_name[LOV_MAXPOOLNAME]; /* pool name */
+               char  lw_pool_name[LOV_MAXPOOLNAME + 1]; /* pool name */
         } lsm_wire;
 
         struct lov_oinfo *lsm_oinfo[0];
@@ -191,7 +192,7 @@ struct obd_type {
 struct brw_page {
        obd_off  off;
        struct page *pg;
-       int count;
+       unsigned int count;
        obd_flag flag;
 };
 
@@ -228,10 +229,10 @@ struct client_obd {
         int                      cl_conn_count;
        /* max_mds_easize is purely a performance thing so we don't have to
         * call obd_size_diskmd() all the time. */
-       int                      cl_default_mds_easize;
-       int                      cl_max_mds_easize;
-       int                      cl_default_mds_cookiesize;
-       int                      cl_max_mds_cookiesize;
+       __u32                    cl_default_mds_easize;
+       __u32                    cl_max_mds_easize;
+       __u32                    cl_default_mds_cookiesize;
+       __u32                    cl_max_mds_cookiesize;
 
         enum lustre_sec_part     cl_sp_me;
         enum lustre_sec_part     cl_sp_to;
@@ -273,14 +274,10 @@ struct client_obd {
          * blocking everywhere, but we don't want to slow down fast-path of
          * our main platform.)
          *
-         * Exact type of ->cl_loi_list_lock is defined in arch/obd.h together
-         * with client_obd_list_{un,}lock() and
-         * client_obd_list_lock_{init,done}() functions.
-        *
         * NB by Jinshan: though field names are still _loi_, but actually
         * osc_object{}s are in the list.
         */
-       client_obd_lock_t       cl_loi_list_lock;
+       spinlock_t              cl_loi_list_lock;
        struct list_head        cl_loi_ready_list;
        struct list_head        cl_loi_hp_ready_list;
        struct list_head        cl_loi_write_list;
@@ -302,13 +299,13 @@ struct client_obd {
        /* lru for osc caching pages */
        struct cl_client_cache  *cl_cache;
        struct list_head         cl_lru_osc; /* member of cl_cache->ccc_lru */
-       atomic_t                *cl_lru_left;
-       atomic_t                 cl_lru_busy;
-       atomic_t                 cl_lru_shrinkers;
-       atomic_t                 cl_lru_in_list;
+       atomic_long_t           *cl_lru_left;
+       atomic_long_t            cl_lru_busy;
+       atomic_long_t            cl_lru_in_list;
+       atomic_long_t            cl_unstable_count;
        struct list_head         cl_lru_list; /* lru page list */
-       client_obd_lock_t        cl_lru_list_lock; /* page list protector */
-       atomic_t                 cl_unstable_count;
+       spinlock_t               cl_lru_list_lock; /* page list protector */
+       atomic_t                 cl_lru_shrinkers;
 
        /* number of in flight destroy rpcs is limited to max_rpcs_in_flight */
        atomic_t                 cl_destroy_in_flight;
@@ -364,7 +361,6 @@ struct echo_client_obd {
        spinlock_t              ec_lock;
        struct list_head        ec_objects;
        struct list_head        ec_locks;
-       int                     ec_nstripes;
        __u64                   ec_unique;
 };
 
@@ -443,13 +439,12 @@ struct lmv_obd {
        struct obd_export       *exp;
        struct proc_dir_entry   *targets_proc_entry;
 
-       struct mutex            init_mutex;
+       struct mutex            lmv_init_mutex;
        int                     connected;
        int                     max_easize;
        int                     max_def_easize;
        int                     max_cookiesize;
        int                     max_def_cookiesize;
-       int                     server_timeout;
 
        __u32                   tgts_size; /* size of tgts array */
        struct lmv_tgt_desc     **tgts;
@@ -745,22 +740,18 @@ enum obd_cleanup_stage {
 #define KEY_INTERMDS            "inter_mds"
 #define KEY_LAST_ID             "last_id"
 #define KEY_LAST_FID           "last_fid"
-#define KEY_LOCK_TO_STRIPE      "lock_to_stripe"
 #define KEY_LOVDESC             "lovdesc"
 #define KEY_MAX_EASIZE         "max_easize"
 #define KEY_DEFAULT_EASIZE     "default_easize"
 #define KEY_MAX_COOKIESIZE     "max_cookiesize"
 #define KEY_DEFAULT_COOKIESIZE "default_cookiesize"
-#define KEY_MDS_CONN            "mds_conn"
 #define KEY_MGSSEC              "mgssec"
-#define KEY_NEXT_ID             "next_id"
 #define KEY_READ_ONLY           "read-only"
 #define KEY_REGISTER_TARGET     "register_target"
 #define KEY_SET_FS              "set_fs"
 #define KEY_TGT_COUNT           "tgt_count"
 /*      KEY_SET_INFO in lustre_idl.h */
 #define KEY_SPTLRPC_CONF        "sptlrpc_conf"
-#define KEY_CONNECT_FLAG        "connect_flags"
 
 #define KEY_CACHE_SET          "cache_set"
 #define KEY_CACHE_LRU_SHRINK   "cache_lru_shrink"
@@ -803,6 +794,14 @@ static inline int it_to_lock_mode(struct lookup_intent *it)
        return -EINVAL;
 }
 
+enum md_cli_flags {
+       CLI_SET_MEA     = 1 << 0,
+       CLI_RM_ENTRY    = 1 << 1,
+       CLI_HASH64      = 1 << 2,
+       CLI_API32       = 1 << 3,
+       CLI_MIGRATE     = 1 << 4,
+};
+
 struct md_op_data {
         struct lu_fid           op_fid1; /* operation fid1 (usualy parent) */
         struct lu_fid           op_fid2; /* operation fid2 (usualy child) */
@@ -812,7 +811,7 @@ struct md_op_data {
         struct lustre_handle    op_handle;
         obd_time                op_mod_time;
         const char             *op_name;
-        int                     op_namelen;
+       size_t                  op_namelen;
         __u32                   op_mode;
         struct lmv_stripe_md   *op_mea1;
         struct lmv_stripe_md   *op_mea2;
@@ -824,13 +823,14 @@ struct md_op_data {
        size_t                  op_data_size;
 
         /* iattr fields and blocks. */
-        struct iattr            op_attr;
-       __u64                   op_valid;
+       struct iattr            op_attr;
        loff_t                  op_attr_blocks;
+       unsigned int            op_attr_flags; /* LUSTRE_{SYNC,..}_FL */
+       __u64                   op_valid; /* OBD_MD_* */
 
        /* Size-on-MDS epoch and flags. */
        __u64                   op_ioepoch;
-       __u32                   op_flags;
+       enum md_op_flags        op_flags;
 
        /* Capa fields */
        struct obd_capa        *op_capa1;
@@ -840,20 +840,17 @@ struct md_op_data {
        enum mds_op_bias        op_bias;
 
        /* Used by readdir */
-       __u32                   op_npages;
+       unsigned int            op_max_pages;
 
        /* used to transfer info between the stacks of MD client
         * see enum op_cli_flags */
-       __u32                   op_cli_flags;
+       enum md_cli_flags       op_cli_flags;
 
        /* File object data version for HSM release, on client */
        __u64                   op_data_version;
        struct lustre_handle    op_lease_handle;
 };
 
-#define op_stripe_offset       op_ioepoch
-#define op_max_pages           op_valid
-
 struct md_callback {
        int (*md_blocking_ast)(struct ldlm_lock *lock,
                               struct ldlm_lock_desc *desc,
@@ -867,18 +864,18 @@ typedef int (* md_enqueue_cb_t)(struct ptlrpc_request *req,
                                 int rc);
 
 struct md_enqueue_info {
-        struct md_op_data       mi_data;
-        struct lookup_intent    mi_it;
-        struct lustre_handle    mi_lockh;
-        struct inode           *mi_dir;
-        md_enqueue_cb_t         mi_cb;
-        __u64                   mi_cbdata;
+       struct md_op_data       mi_data;
+       struct lookup_intent    mi_it;
+       struct lustre_handle    mi_lockh;
+       struct inode           *mi_dir;
+       md_enqueue_cb_t         mi_cb;
+       void                   *mi_cbdata;
 };
 
 struct obd_ops {
        struct module *o_owner;
        int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
-                          void *karg, void *uarg);
+                          void *karg, void __user *uarg);
         int (*o_get_info)(const struct lu_env *env, struct obd_export *,
                           __u32 keylen, void *key, __u32 *vallen, void *val,
                           struct lov_stripe_md *lsm);
@@ -932,13 +929,10 @@ struct obd_ops {
                         struct lov_stripe_md *mem_src);
         int (*o_unpackmd)(struct obd_export *exp,struct lov_stripe_md **mem_tgt,
                           struct lov_mds_md *disk_src, int disk_len);
-        int (*o_create)(const struct lu_env *env, struct obd_export *exp,
-                        struct obdo *oa, struct lov_stripe_md **ea,
-                        struct obd_trans_info *oti);
-        int (*o_destroy)(const struct lu_env *env, struct obd_export *exp,
-                         struct obdo *oa, struct lov_stripe_md *ea,
-                         struct obd_trans_info *oti, struct obd_export *md_exp,
-                         void *capa);
+       int (*o_create)(const struct lu_env *env, struct obd_export *exp,
+                       struct obdo *oa, struct obd_trans_info *oti);
+       int (*o_destroy)(const struct lu_env *env, struct obd_export *exp,
+                        struct obdo *oa, struct obd_trans_info *oti);
         int (*o_setattr)(const struct lu_env *, struct obd_export *exp,
                          struct obd_info *oinfo, struct obd_trans_info *oti);
         int (*o_setattr_async)(struct obd_export *exp, struct obd_info *oinfo,
@@ -966,11 +960,6 @@ struct obd_ops {
         int (*o_init_export)(struct obd_export *exp);
         int (*o_destroy_export)(struct obd_export *exp);
 
-        /* llog related obd_methods */
-        int (*o_llog_init)(struct obd_device *obd, struct obd_llog_group *grp,
-                           struct obd_device *disk_obd, int *idx);
-        int (*o_llog_finish)(struct obd_device *obd, int count);
-
         int (*o_import_event)(struct obd_device *, struct obd_import *,
                               enum obd_import_event);
 
@@ -1055,8 +1044,8 @@ struct md_ops {
                       struct md_open_data *, struct ptlrpc_request **);
 
        int (*m_create)(struct obd_export *, struct md_op_data *,
-                       const void *, int, int, __u32, __u32, cfs_cap_t,
-                       __u64, struct ptlrpc_request **);
+                       const void *, size_t, umode_t, uid_t, gid_t,
+                       cfs_cap_t, __u64, struct ptlrpc_request **);
 
        int (*m_enqueue)(struct obd_export *, struct ldlm_enqueue_info *,
                         const union ldlm_policy_data *,
@@ -1075,11 +1064,11 @@ struct md_ops {
                      struct ptlrpc_request **);
 
        int (*m_rename)(struct obd_export *, struct md_op_data *,
-                       const char *, int, const char *, int,
+                       const char *, size_t, const char *, size_t,
                        struct ptlrpc_request **);
 
        int (*m_setattr)(struct obd_export *, struct md_op_data *, void *,
-                        int , void *, int, struct ptlrpc_request **,
+                       size_t , void *, size_t, struct ptlrpc_request **,
                         struct md_open_data **mod);
 
        int (*m_fsync)(struct obd_export *, const struct lu_fid *,
@@ -1125,7 +1114,7 @@ struct md_ops {
        int (*m_getattr_name)(struct obd_export *, struct md_op_data *,
                              struct ptlrpc_request **);
 
-       int (*m_init_ea_size)(struct obd_export *, int, int, int, int);
+       int (*m_init_ea_size)(struct obd_export *, __u32, __u32, __u32, __u32);
 
        int (*m_get_lustre_md)(struct obd_export *, struct ptlrpc_request *,
                               struct obd_export *, struct obd_export *,
@@ -1176,8 +1165,6 @@ struct md_ops {
 
 struct lsm_operations {
         void (*lsm_free)(struct lov_stripe_md *);
-        int (*lsm_destroy)(struct lov_stripe_md *, struct obdo *oa,
-                           struct obd_export *md_exp);
         void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, obd_off *,
                                     obd_off *);
         void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, obd_off *,
@@ -1245,7 +1232,8 @@ static inline const char *lu_dev_name(const struct lu_device *lu_dev)
         return lu_dev->ld_obd->obd_name;
 }
 
-static inline bool filename_is_volatile(const char *name, int namelen, int *idx)
+static inline bool filename_is_volatile(const char *name, size_t namelen,
+                                       int *idx)
 {
        const char      *start;
        char            *end;