summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2010-05-17 15:14:17 +0800
committerTao Ma <tao.ma@oracle.com>2010-05-17 15:14:17 +0800
commitaf2bf0d86019e0b0306965321096f8380b7ca830 (patch)
tree6a203b0970b00229528ddcdb9adc6c0ce734461d /fs/ocfs2
parent8571882c21e5073b2f96147ec4ff9b7042339e1b (diff)
downloadop-kernel-dev-af2bf0d86019e0b0306965321096f8380b7ca830.zip
op-kernel-dev-af2bf0d86019e0b0306965321096f8380b7ca830.tar.gz
ocfs2: Add ocfs2_gd_is_discontig.
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>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/ocfs2_fs.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 67bb8a7..b01d0dd 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -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 */
OpenPOWER on IntegriCloud