diff options
author | Mark Fasheh <mfasheh@suse.com> | 2008-11-20 20:54:57 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-04-03 14:39:16 -0400 |
commit | 198a1ca3b735986542c538e38b9499ffcaed7005 (patch) | |
tree | 3b02034534c4640e72623088a59d1e942c38e7c3 /fs/ocfs2/ocfs2.h | |
parent | e7c17e43090afe558c40bfb66637744c27bd2aeb (diff) |
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.h | 38 |
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) | |||
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
410 | 410 | ||
411 | static inline unsigned int ocfs2_link_max(struct ocfs2_super *osb) | ||
412 | { | ||
413 | if (ocfs2_supports_indexed_dirs(osb)) | ||
414 | return OCFS2_DX_LINK_MAX; | ||
415 | return OCFS2_LINK_MAX; | ||
416 | } | ||
417 | |||
418 | static inline unsigned int ocfs2_read_links_count(struct ocfs2_dinode *di) | ||
419 | { | ||
420 | u32 nlink = le16_to_cpu(di->i_links_count); | ||
421 | u32 hi = le16_to_cpu(di->i_links_count_hi); | ||
422 | |||
423 | if (di->i_dyn_features & cpu_to_le16(OCFS2_INDEXED_DIR_FL)) | ||
424 | nlink |= (hi << OCFS2_LINKS_HI_SHIFT); | ||
425 | |||
426 | return nlink; | ||
427 | } | ||
428 | |||
429 | static inline void ocfs2_set_links_count(struct ocfs2_dinode *di, u32 nlink) | ||
430 | { | ||
431 | u16 lo, hi; | ||
432 | |||
433 | lo = nlink; | ||
434 | hi = nlink >> OCFS2_LINKS_HI_SHIFT; | ||
435 | |||
436 | di->i_links_count = cpu_to_le16(lo); | ||
437 | di->i_links_count_hi = cpu_to_le16(hi); | ||
438 | } | ||
439 | |||
440 | static inline void ocfs2_add_links_count(struct ocfs2_dinode *di, int n) | ||
441 | { | ||
442 | u32 links = ocfs2_read_links_count(di); | ||
443 | |||
444 | links += n; | ||
445 | |||
446 | ocfs2_set_links_count(di, links); | ||
447 | } | ||
448 | |||
411 | /* set / clear functions because cluster events can make these happen | 449 | /* set / clear functions because cluster events can make these happen |
412 | * in parallel so we want the transitions to be atomic. this also | 450 | * in parallel so we want the transitions to be atomic. this also |
413 | * means that any future flags osb_flags must be protected by spinlock | 451 | * means that any future flags osb_flags must be protected by spinlock |