aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ocfs2_fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/ocfs2_fs.h')
-rw-r--r--fs/ocfs2/ocfs2_fs.h46
1 files changed, 43 insertions, 3 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 1b46505e1e36..1055ba0af9bb 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -300,6 +300,12 @@ struct ocfs2_new_group_input {
300 */ 300 */
301#define OCFS2_DEFAULT_LOCAL_ALLOC_SIZE 8 301#define OCFS2_DEFAULT_LOCAL_ALLOC_SIZE 8
302 302
303/*
304 * Inline extended attribute size (in bytes)
305 * The value chosen should be aligned to 16 byte boundaries.
306 */
307#define OCFS2_MIN_XATTR_INLINE_SIZE 256
308
303struct ocfs2_system_inode_info { 309struct ocfs2_system_inode_info {
304 char *si_name; 310 char *si_name;
305 int si_iflags; 311 int si_iflags;
@@ -622,7 +628,8 @@ struct ocfs2_dinode {
622 belongs to */ 628 belongs to */
623 __le16 i_suballoc_bit; /* Bit offset in suballocator 629 __le16 i_suballoc_bit; /* Bit offset in suballocator
624 block group */ 630 block group */
625/*10*/ __le32 i_reserved0; 631/*10*/ __le16 i_reserved0;
632 __le16 i_xattr_inline_size;
626 __le32 i_clusters; /* Cluster count */ 633 __le32 i_clusters; /* Cluster count */
627 __le32 i_uid; /* Owner UID */ 634 __le32 i_uid; /* Owner UID */
628 __le32 i_gid; /* Owning GID */ 635 __le32 i_gid; /* Owning GID */
@@ -641,11 +648,12 @@ struct ocfs2_dinode {
641 __le32 i_atime_nsec; 648 __le32 i_atime_nsec;
642 __le32 i_ctime_nsec; 649 __le32 i_ctime_nsec;
643 __le32 i_mtime_nsec; 650 __le32 i_mtime_nsec;
644 __le32 i_attr; 651/*70*/ __le32 i_attr;
645 __le16 i_orphaned_slot; /* Only valid when OCFS2_ORPHANED_FL 652 __le16 i_orphaned_slot; /* Only valid when OCFS2_ORPHANED_FL
646 was set in i_flags */ 653 was set in i_flags */
647 __le16 i_dyn_features; 654 __le16 i_dyn_features;
648/*70*/ __le64 i_reserved2[8]; 655 __le64 i_xattr_loc;
656/*80*/ __le64 i_reserved2[7];
649/*B8*/ union { 657/*B8*/ union {
650 __le64 i_pad1; /* Generic way to refer to this 658 __le64 i_pad1; /* Generic way to refer to this
651 64bit union */ 659 64bit union */
@@ -846,6 +854,20 @@ static inline int ocfs2_max_inline_data(struct super_block *sb)
846 offsetof(struct ocfs2_dinode, id2.i_data.id_data); 854 offsetof(struct ocfs2_dinode, id2.i_data.id_data);
847} 855}
848 856
857static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb,
858 struct ocfs2_dinode *di)
859{
860 unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
861
862 if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
863 return sb->s_blocksize -
864 offsetof(struct ocfs2_dinode, id2.i_data.id_data) -
865 xattrsize;
866 else
867 return sb->s_blocksize -
868 offsetof(struct ocfs2_dinode, id2.i_data.id_data);
869}
870
849static inline int ocfs2_extent_recs_per_inode(struct super_block *sb) 871static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
850{ 872{
851 int size; 873 int size;
@@ -856,6 +878,24 @@ static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
856 return size / sizeof(struct ocfs2_extent_rec); 878 return size / sizeof(struct ocfs2_extent_rec);
857} 879}
858 880
881static inline int ocfs2_extent_recs_per_inode_with_xattr(
882 struct super_block *sb,
883 struct ocfs2_dinode *di)
884{
885 int size;
886 unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
887
888 if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
889 size = sb->s_blocksize -
890 offsetof(struct ocfs2_dinode, id2.i_list.l_recs) -
891 xattrsize;
892 else
893 size = sb->s_blocksize -
894 offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
895
896 return size / sizeof(struct ocfs2_extent_rec);
897}
898
859static inline int ocfs2_chain_recs_per_inode(struct super_block *sb) 899static inline int ocfs2_chain_recs_per_inode(struct super_block *sb)
860{ 900{
861 int size; 901 int size;