Whamcloud - gitweb
LU-9679 lustre: remove some "#ifdef CONFIG*" from .c files.
[fs/lustre-release.git] / lustre / include / obd.h
index 1c8bfa3..c0d70c6 100644 (file)
 #ifndef __OBD_H
 #define __OBD_H
 
+#include <linux/fs.h>
+#include <linux/posix_acl.h>
 #include <linux/kobject.h>
 #include <linux/spinlock.h>
 #include <linux/sysfs.h>
+#include <linux/xarray.h>
 
 #include <uapi/linux/lustre/lustre_idl.h>
 #include <lustre_lib.h>
@@ -118,6 +121,11 @@ struct brw_page {
        struct page     *pg;
        u32              count;
        u32              flag;
+       /* used for encryption: difference with offset in clear text page */
+       u16              bp_off_diff;
+       /* used for encryption: difference with count in clear text page */
+       u16              bp_count_diff;
+       u32              bp_padding;
 };
 
 struct timeout_item {
@@ -633,7 +641,7 @@ struct obd_device {
         /* uuid-export hash body */
        struct rhashtable               obd_uuid_hash;
         /* nid-export hash body */
-       struct cfs_hash             *obd_nid_hash;
+       struct rhltable                 obd_nid_hash;
        /* nid stats body */
        struct cfs_hash             *obd_nid_stats_hash;
        /* client_generation-export hash body */
@@ -682,12 +690,12 @@ struct obd_device {
        time64_t                obd_recovery_start;
        /* seconds, for lprocfs_status */
        time64_t                obd_recovery_end;
-       /* To tell timeouts from time stamps Lustre uses time_t
+       /* To tell timeouts from time stamps Lustre uses timeout_t
         * instead of time64_t.
         */
-       time_t                  obd_recovery_time_hard;
-       time_t                  obd_recovery_timeout;
-       int                     obd_recovery_ir_factor;
+       timeout_t                       obd_recovery_time_hard;
+       timeout_t                       obd_recovery_timeout;
+       int                             obd_recovery_ir_factor;
 
        /* new recovery stuff from CMD2 */
        int                             obd_replayed_locks;
@@ -752,6 +760,12 @@ void obd_uuid_del(struct obd_device *obd, struct obd_export *export);
 #ifdef HAVE_SERVER_SUPPORT
 struct obd_export *obd_uuid_lookup(struct obd_device *obd,
                                   struct obd_uuid *uuid);
+
+int obd_nid_export_for_each(struct obd_device *obd, lnet_nid_t nid,
+                           int cb(struct obd_export *exp, void *data),
+                           void *data);
+int obd_nid_add(struct obd_device *obd, struct obd_export *exp);
+void obd_nid_del(struct obd_device *obd, struct obd_export *exp);
 #endif
 
 /* get/set_info keys */
@@ -815,20 +829,20 @@ static inline int it_to_lock_mode(struct lookup_intent *it)
 }
 
 enum md_op_flags {
-       MF_MDC_CANCEL_FID1      = 1 << 0,
-       MF_MDC_CANCEL_FID2      = 1 << 1,
-       MF_MDC_CANCEL_FID3      = 1 << 2,
-       MF_MDC_CANCEL_FID4      = 1 << 3,
-       MF_GET_MDT_IDX          = 1 << 4,
+       MF_MDC_CANCEL_FID1      = BIT(0),
+       MF_MDC_CANCEL_FID2      = BIT(1),
+       MF_MDC_CANCEL_FID3      = BIT(2),
+       MF_MDC_CANCEL_FID4      = BIT(3),
+       MF_GET_MDT_IDX          = BIT(4),
 };
 
 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,
-       CLI_DIRTY_DATA  = 1 << 5,
+       CLI_SET_MEA     = BIT(0),
+       CLI_RM_ENTRY    = BIT(1),
+       CLI_HASH64      = BIT(2),
+       CLI_API32       = BIT(3),
+       CLI_MIGRATE     = BIT(4),
+       CLI_DIRTY_DATA  = BIT(5),
 };
 
 enum md_op_code {
@@ -1049,6 +1063,25 @@ struct lustre_md {
 #endif
 };
 
+#ifdef CONFIG_LUSTRE_FS_POSIX_ACL
+static inline void lmd_clear_acl(struct lustre_md *md)
+{
+       if (md->posix_acl) {
+               posix_acl_release(md->posix_acl);
+               md->posix_acl = NULL;
+       }
+}
+
+#define OBD_CONNECT_ACL_FLAGS  \
+       (OBD_CONNECT_ACL | OBD_CONNECT_UMASK | OBD_CONNECT_LARGE_ACL)
+#else
+static inline void lmd_clear_acl(struct lustre_md *md)
+{
+}
+
+#define OBD_CONNECT_ACL_FLAGS  (0)
+#endif
+
 struct md_open_data {
        struct obd_client_handle        *mod_och;
        struct ptlrpc_request           *mod_open_req;
@@ -1140,7 +1173,7 @@ struct md_ops {
 
        int (*m_free_lustre_md)(struct obd_export *, struct lustre_md *);
 
-       int (*m_merge_attr)(struct obd_export *,
+       int (*m_merge_attr)(struct obd_export *, const struct lu_fid *fid,
                            const struct lmv_stripe_md *lsm,
                            struct cl_attr *attr, ldlm_blocking_callback);
 
@@ -1295,4 +1328,16 @@ static inline void client_adjust_max_dirty(struct client_obd *cli)
                                           1 << (20 - PAGE_SHIFT));
 }
 
+static inline struct inode *page2inode(struct page *page)
+{
+       if (page->mapping) {
+               if (PageAnon(page))
+                       return NULL;
+               else
+                       return page->mapping->host;
+       } else {
+               return NULL;
+       }
+}
+
 #endif /* __OBD_H */