]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/ocfs2/ocfs2.h
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[mv-sheeva.git] / fs / ocfs2 / ocfs2.h
index 3749c32c2fc49ca76ec9a94b5defee0d1579bb0b..1386281950dbead47e4b5528cde7caae706cb3f2 100644 (file)
@@ -209,6 +209,7 @@ enum ocfs2_mount_options
 struct ocfs2_journal;
 struct ocfs2_slot_info;
 struct ocfs2_recovery_map;
+struct ocfs2_replay_map;
 struct ocfs2_quota_recovery;
 struct ocfs2_dentry_lock;
 struct ocfs2_super
@@ -264,6 +265,7 @@ struct ocfs2_super
        atomic_t vol_state;
        struct mutex recovery_lock;
        struct ocfs2_recovery_map *recovery_map;
+       struct ocfs2_replay_map *replay_map;
        struct task_struct *recovery_thread_task;
        int disable_recovery;
        wait_queue_head_t checkpoint_event;
@@ -300,6 +302,7 @@ struct ocfs2_super
        struct ocfs2_cluster_connection *cconn;
        struct ocfs2_lock_res osb_super_lockres;
        struct ocfs2_lock_res osb_rename_lockres;
+       struct ocfs2_lock_res osb_nfs_sync_lockres;
        struct ocfs2_dlm_debug *osb_dlm_debug;
 
        struct dentry *osb_debug_root;
@@ -343,6 +346,9 @@ struct ocfs2_super
 
        unsigned int                    osb_dx_mask;
        u32                             osb_dx_seed[4];
+
+       /* the group we used to allocate inodes. */
+       u64                             osb_inode_alloc_group;
 };
 
 #define OCFS2_SB(sb)       ((struct ocfs2_super *)(sb)->s_fs_info)
@@ -408,6 +414,44 @@ static inline int ocfs2_supports_indexed_dirs(struct ocfs2_super *osb)
        return 0;
 }
 
+static inline unsigned int ocfs2_link_max(struct ocfs2_super *osb)
+{
+       if (ocfs2_supports_indexed_dirs(osb))
+               return OCFS2_DX_LINK_MAX;
+       return OCFS2_LINK_MAX;
+}
+
+static inline unsigned int ocfs2_read_links_count(struct ocfs2_dinode *di)
+{
+       u32 nlink = le16_to_cpu(di->i_links_count);
+       u32 hi = le16_to_cpu(di->i_links_count_hi);
+
+       if (di->i_dyn_features & cpu_to_le16(OCFS2_INDEXED_DIR_FL))
+               nlink |= (hi << OCFS2_LINKS_HI_SHIFT);
+
+       return nlink;
+}
+
+static inline void ocfs2_set_links_count(struct ocfs2_dinode *di, u32 nlink)
+{
+       u16 lo, hi;
+
+       lo = nlink;
+       hi = nlink >> OCFS2_LINKS_HI_SHIFT;
+
+       di->i_links_count = cpu_to_le16(lo);
+       di->i_links_count_hi = cpu_to_le16(hi);
+}
+
+static inline void ocfs2_add_links_count(struct ocfs2_dinode *di, int n)
+{
+       u32 links = ocfs2_read_links_count(di);
+
+       links += n;
+
+       ocfs2_set_links_count(di, links);
+}
+
 /* set / clear functions because cluster events can make these happen
  * in parallel so we want the transitions to be atomic. this also
  * means that any future flags osb_flags must be protected by spinlock
@@ -544,6 +588,16 @@ static inline u64 ocfs2_clusters_to_bytes(struct super_block *sb,
        return (u64)clusters << OCFS2_SB(sb)->s_clustersize_bits;
 }
 
+static inline u64 ocfs2_block_to_cluster_start(struct super_block *sb,
+                                              u64 blocks)
+{
+       int bits = OCFS2_SB(sb)->s_clustersize_bits - sb->s_blocksize_bits;
+       unsigned int clusters;
+
+       clusters = ocfs2_blocks_to_clusters(sb, blocks);
+       return (u64)clusters << bits;
+}
+
 static inline u64 ocfs2_align_bytes_to_clusters(struct super_block *sb,
                                                u64 bytes)
 {