Skip to content

Commit

Permalink
ocfs2: Add ocfs2_gd_is_discontig.
Browse files Browse the repository at this point in the history
Add ocfs2_gd_is_discontig so that we can test whether
a group descriptor is discontiguous or not.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
  • Loading branch information
Tao Ma committed May 17, 2010
1 parent 8571882 commit af2bf0d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fs/ocfs2/ocfs2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1574,5 +1574,19 @@ static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de,
de->file_type = ocfs2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
}

static inline int ocfs2_gd_is_discontig(struct ocfs2_group_desc *gd)
{
if ((offsetof(struct ocfs2_group_desc, bg_bitmap) +
le16_to_cpu(gd->bg_size)) !=
offsetof(struct ocfs2_group_desc, bg_list))
return 0;
/*
* Only valid to check l_next_free_rec if
* bg_bitmap + bg_size == bg_list.
*/
if (!gd->bg_list.l_next_free_rec)
return 0;
return 1;
}
#endif /* _OCFS2_FS_H */

0 comments on commit af2bf0d

Please sign in to comment.