Reorganize data elements to reduce struct sizes
[firefly-linux-kernel-4.4.55.git] / fs / ocfs2 / ocfs2.h
index adf5e2ebc2c436b60992dfc39ae506327aaf9054..65739b3b32766ae041e2d2ea629f17b612e68ec5 100644 (file)
@@ -47,6 +47,7 @@
 /* For struct ocfs2_blockcheck_stats */
 #include "blockcheck.h"
 
+#include "reservations.h"
 
 /* Caching of metadata buffers */
 
@@ -149,26 +150,33 @@ typedef void (*ocfs2_lock_callback)(int status, unsigned long data);
 struct ocfs2_lock_res {
        void                    *l_priv;
        struct ocfs2_lock_res_ops *l_ops;
-       spinlock_t               l_lock;
+
 
        struct list_head         l_blocked_list;
        struct list_head         l_mask_waiters;
 
-       enum ocfs2_lock_type     l_type;
        unsigned long            l_flags;
        char                     l_name[OCFS2_LOCK_ID_MAX_LEN];
-       int                      l_level;
        unsigned int             l_ro_holders;
        unsigned int             l_ex_holders;
-       struct ocfs2_dlm_lksb    l_lksb;
+       unsigned char            l_level;
+
+       /* Data packed - type enum ocfs2_lock_type */
+       unsigned char            l_type;
 
        /* used from AST/BAST funcs. */
-       enum ocfs2_ast_action    l_action;
-       enum ocfs2_unlock_action l_unlock_action;
-       int                      l_requested;
-       int                      l_blocking;
+       /* Data packed - enum type ocfs2_ast_action */
+       unsigned char            l_action;
+       /* Data packed - enum type ocfs2_unlock_action */
+       unsigned char            l_unlock_action;
+       unsigned char            l_requested;
+       unsigned char            l_blocking;
        unsigned int             l_pending_gen;
 
+       spinlock_t               l_lock;
+
+       struct ocfs2_dlm_lksb    l_lksb;
+
        wait_queue_head_t        l_event;
 
        struct list_head         l_debug_list;
@@ -341,6 +349,9 @@ struct ocfs2_super
         */
        unsigned int local_alloc_bits;
        unsigned int local_alloc_default_bits;
+       /* osb_clusters_at_boot can become stale! Do not trust it to
+        * be up to date. */
+       unsigned int osb_clusters_at_boot;
 
        enum ocfs2_local_alloc_state local_alloc_state; /* protected
                                                         * by osb_lock */
@@ -349,6 +360,11 @@ struct ocfs2_super
 
        u64 la_last_gd;
 
+       struct ocfs2_reservation_map    osb_la_resmap;
+
+       unsigned int    osb_resv_level;
+       unsigned int    osb_dir_resv_level;
+
        /* Next three fields are for local node slot recovery during
         * mount. */
        int dirty;
@@ -482,6 +498,13 @@ static inline int ocfs2_supports_indexed_dirs(struct ocfs2_super *osb)
        return 0;
 }
 
+static inline int ocfs2_supports_discontig_bg(struct ocfs2_super *osb)
+{
+       if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG)
+               return 1;
+       return 0;
+}
+
 static inline unsigned int ocfs2_link_max(struct ocfs2_super *osb)
 {
        if (ocfs2_supports_indexed_dirs(osb))
@@ -763,6 +786,12 @@ static inline unsigned int ocfs2_megabytes_to_clusters(struct super_block *sb,
        return megs << (20 - OCFS2_SB(sb)->s_clustersize_bits);
 }
 
+static inline unsigned int ocfs2_clusters_to_megabytes(struct super_block *sb,
+                                                      unsigned int clusters)
+{
+       return clusters >> (20 - OCFS2_SB(sb)->s_clustersize_bits);
+}
+
 static inline void _ocfs2_set_bit(unsigned int bit, unsigned long *bitmap)
 {
        ext2_set_bit(bit, bitmap);