summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ocfs2.h
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-11-20 17:54:57 -0800
committerMark Fasheh <mfasheh@suse.com>2009-04-03 11:39:16 -0700
commit198a1ca3b735986542c538e38b9499ffcaed7005 (patch)
tree3b02034534c4640e72623088a59d1e942c38e7c3 /fs/ocfs2/ocfs2.h
parente7c17e43090afe558c40bfb66637744c27bd2aeb (diff)
downloadtalos-obmc-linux-198a1ca3b735986542c538e38b9499ffcaed7005.tar.gz
talos-obmc-linux-198a1ca3b735986542c538e38b9499ffcaed7005.zip
ocfs2: Increase max links count
Since we've now got a directory format capable of handling a large number of entries, we can increase the maximum link count supported. This only gets increased if the directory indexing feature is turned on. Signed-off-by: Mark Fasheh <mfasheh@suse.com> Acked-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/ocfs2.h')
-rw-r--r--fs/ocfs2/ocfs2.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 3749c32c2fc4..fa3c6d3f0bd2 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -408,6 +408,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
OpenPOWER on IntegriCloud