Skip to content

Commit

Permalink
ocfs2: Allocate discontiguous block groups.
Browse files Browse the repository at this point in the history
If we cannot get a contiguous region for a block group, allocate a
discontiguous one when the filesystem supports it.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
  • Loading branch information
Joel Becker authored and Tao Ma committed Apr 13, 2010
1 parent 4cbe424 commit 798db35
Show file tree
Hide file tree
Showing 3 changed files with 291 additions and 40 deletions.
7 changes: 7 additions & 0 deletions fs/ocfs2/ocfs2.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,13 @@ static inline int ocfs2_supports_indexed_dirs(struct ocfs2_super *osb)
return 0;
}

static inline int ocfs2_supports_discontig_bh(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))
Expand Down
20 changes: 20 additions & 0 deletions fs/ocfs2/ocfs2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,16 @@ static inline u16 ocfs2_extent_recs_per_eb(struct super_block *sb)
return size / sizeof(struct ocfs2_extent_rec);
}

static inline u16 ocfs2_extent_recs_per_gd(struct super_block *sb)
{
int size;

size = sb->s_blocksize -
offsetof(struct ocfs2_group_desc, bg_list.l_recs);

return size / sizeof(struct ocfs2_extent_rec);
}

static inline int ocfs2_dx_entries_per_leaf(struct super_block *sb)
{
int size;
Expand Down Expand Up @@ -1430,6 +1440,16 @@ static inline int ocfs2_extent_recs_per_eb(int blocksize)
return size / sizeof(struct ocfs2_extent_rec);
}

static inline int ocfs2_extent_recs_per_gd(int blocksize)
{
int size;

size = blocksize -
offsetof(struct ocfs2_group_desc, bg_list.l_recs);

return size / sizeof(struct ocfs2_extent_rec);
}

static inline int ocfs2_local_alloc_size(int blocksize)
{
int size;
Expand Down
Loading

0 comments on commit 798db35

Please sign in to comment.