ocfs2: Structure updates for inline data
PATCH 11/15 ocfs2: Structure updates for inline data
Add the disk, network and memory structures needed to support data in inode.
Struct ocfs2_inline_data is defined and embedded in ocfs2_dinode for storing inline data.
A new inode field, i_dyn_features, is added to facilitate tracking of dynamic inode state. Since it will be used often, we want to mirror it on ocfs2_inode_info, and transfer it via the meta data lvb.
--- fs/ocfs2/dlmglue.c | 2 ++ fs/ocfs2/dlmglue.h | 4 ++-- fs/ocfs2/inode.c | 3 +++ fs/ocfs2/inode.h | 1 + fs/ocfs2/ocfs2.h | 7 +++++++ fs/ocfs2/ocfs2_fs.h | 44 ++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 57 insertions(+), 4 deletions(-)
fs/ocfs2/dlmglue.c +2 -0
@@ -1482,6 +1482,7 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode) lvb->lvb_imtime_packed =cpu_to_be64 (ocfs2_pack_timespec (&inode->i_mtime)); lvb->lvb_iattr =cpu_to_be32 (oi->ip_attr); + lvb->lvb_idynfeatures =cpu_to_be16 (oi->ip_dyn_features); lvb->lvb_igeneration =cpu_to_be32 (inode->i_generation); out:
@@ -1515,6 +1516,7 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)i_size_write (inode,be64_to_cpu (lvb->lvb_isize)); oi->ip_attr =be32_to_cpu (lvb->lvb_iattr); + oi->ip_dyn_features =be16_to_cpu (lvb->lvb_idynfeatures);ocfs2_set_inode_flags (inode);/* fast-symlinks are a special case */
fs/ocfs2/dlmglue.h +2 -2
@@ -29,12 +29,12 @@#include "dcache.h" -#define OCFS2_LVB_VERSION 4 +#define OCFS2_LVB_VERSION 5struct ocfs2_meta_lvb {__u8 lvb_version;__u8 lvb_reserved0; -__be16 lvb_reserved1; +__be16 lvb_idynfeatures;__be32 lvb_iclusters;__be32 lvb_iuid;__be32 lvb_igid;
fs/ocfs2/inode.c +3 -0
@@ -241,6 +241,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,OCFS2_I (inode)->ip_clusters =le32_to_cpu (fe->i_clusters);OCFS2_I (inode)->ip_attr =le32_to_cpu (fe->i_attr); +OCFS2_I (inode)->ip_dyn_features =le16_to_cpu (fe->i_dyn_features); inode->i_version =1 ; inode->i_generation =le32_to_cpu (fe->i_generation);
@@ -1220,6 +1221,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle, fe->i_clusters =cpu_to_le32 (OCFS2_I (inode)->ip_clusters);ocfs2_get_inode_flags (OCFS2_I (inode)); fe->i_attr =cpu_to_le32 (OCFS2_I (inode)->ip_attr); + fe->i_dyn_features =cpu_to_le16 (OCFS2_I (inode)->ip_dyn_features);spin_unlock (&OCFS2_I (inode)->ip_lock); fe->i_size =cpu_to_le64 (i_size_read (inode));
@@ -1257,6 +1259,7 @@ void ocfs2_refresh_inode(struct inode *inode,OCFS2_I (inode)->ip_clusters =le32_to_cpu (fe->i_clusters);OCFS2_I (inode)->ip_attr =le32_to_cpu (fe->i_attr); +OCFS2_I (inode)->ip_dyn_features =le16_to_cpu (fe->i_dyn_features);ocfs2_set_inode_flags (inode);i_size_write (inode,le64_to_cpu (fe->i_size)); inode->i_nlink =le16_to_cpu (fe->i_links_count);
fs/ocfs2/inode.h +1 -0
@@ -51,6 +51,7 @@ struct ocfs2_inode_infou32 ip_flags;/* see below */ u32 ip_attr;/* inode attributes */ +u16 ip_dyn_features;/* protected by recovery_lock. */ struct inode *ip_next_orphan;
fs/ocfs2/ocfs2.h +7 -0
@@ -319,6 +319,13 @@ static inline int ocfs2_writes_unwritten_extents(struct ocfs2_super *osb)return 0 ; } +static inline int ocfs2_supports_inline_data (struct ocfs2_super *osb) +{ +if (osb->s_feature_incompat &OCFS2_FEATURE_INCOMPAT_INLINE_DATA ) +return 1 ; +return 0 ; +} +/* set / clear functions because cluster events can make these happen * in parallel so we want the transitions to be atomic. this also * means that any future flags osb_flags must be protected by spinlock
fs/ocfs2/ocfs2_fs.h +42 -2
92 lines not on this page · raw message
Signature · 1 line
1.5.0.6
PATCH 11/15 ocfs2: Structure updates for inline data
Quoted 7 lines · Mark Fasheh
Add the disk, network and memory structures needed to support data in inode.
/*
+ * Data-in-inode header. This is only used ifi_flagshas
+ *OCFS2_INLINE_DATA_FLset.
+ */
+structocfs2_inline_data
I think you mean i_dyn_features. Otherwise, it looks good.
Signature · 10 lines
print STDOUT q Just another Perl hacker, unless $spring - Larry Wall Joel Becker Principal Software Developer Oracle E-mail: [email protected] Phone: (650) 506-8127
PATCH 11/15 ocfs2: Structure updates for inline data
Quoted 10 lines · Joel Becker
Quoted 7 lines · Mark Fasheh
Add the disk, network and memory structures needed to support data in inode.
/*
+ * Data-in-inode header. This is only used ifi_flagshas
+ *OCFS2_INLINE_DATA_FLset.
+ */
+structocfs2_inline_dataI think you mean
i_dyn_features. Otherwise, it looks good.
Good catch.
--Mark
--
Mark Fasheh
Senior Software Developer, Oracle
[email protected]