ocfs2: Some patches for reflink. v3
cover ocfs2: Some patches for reflink. v3
Hi Joel,
This patch set integrate the fix for the bug tristan found.
Regards,
Tao
PATCH 1/2 ocfs2: Move ocfs2_complete_reflink to the right place.
As its name ocfs2_complete_reflink indicates, it should be called after all the work for reflink is done, so it really should be called after we reflink xattr successfully.
--- fs/ocfs2/refcounttree.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
fs/ocfs2/refcounttree.c +9 -5
@@ -4013,10 +4013,6 @@ static int ocfs2_create_reflink_node(struct inode *s_inode, goto out_unlock_refcount; } - ret =ocfs2_complete_reflink (s_inode, s_bh, t_inode, t_bh, preserve); -if (ret) -mlog_errno (ret); - out_unlock_refcount:ocfs2_unlock_refcount_tree (osb, ref_tree,1 );brelse (ref_root_bh);
@@ -4068,9 +4064,17 @@ static int __ocfs2_reflink(struct dentry *old_dentry, ret =ocfs2_reflink_xattrs (inode, old_bh, new_inode, new_bh, preserve); -if (ret) +if (ret) {mlog_errno (ret); + goto inode_unlock; + } } + + ret =ocfs2_complete_reflink (inode, old_bh, + new_inode, new_bh, preserve); +if (ret) +mlog_errno (ret); + inode_unlock:ocfs2_inode_unlock (new_inode,1 );brelse (new_bh);
Signature · 1 line
1.6.2.rc2.16.gf474c
PATCH 2/2 ocfs2: duplicate inline data properly during reflink.
In reply to Tao MaThe old reflink fails to handle inline-data and can cause kernel oops. So this patch fix it. It will try to copy the whole inline content to the new inode and set the corresponding feature flag.
--- fs/ocfs2/file.c | 3 +- fs/ocfs2/refcounttree.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletions(-)
fs/ocfs2/file.c +2 -1
@@ -1712,7 +1712,8 @@ int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos,struct super_block *sb = inode->i_sb;if (!ocfs2_refcount_tree (OCFS2_SB (inode->i_sb)) || - !(OCFS2_I (inode)->ip_dyn_features &OCFS2_HAS_REFCOUNT_FL )) + !(OCFS2_I (inode)->ip_dyn_features &OCFS2_HAS_REFCOUNT_FL ) || +OCFS2_I (inode)->ip_dyn_features &OCFS2_INLINE_DATA_FL )return 0 ; cpos = pos >>OCFS2_SB (sb)->s_clustersize_bits;
fs/ocfs2/refcounttree.c +55 -0
79 lines not on this page · raw message
Signature · 1 line
1.6.2.rc2.16.gf474c
cover ocfs2: Some patches for reflink. v3
In reply to Tao MaQuoted 1 line · Tao Ma
This patch set integrate the fix for the bug tristan found.
These both look good. You know, if an inode is inline and has
no xattrs, ie:
(oi->i_dyn_flags & (OCFS2_HAS_XATTR_FL | OCFS2_HAS_INLINE_DATA_FL)) ==
OCFS2_HAS_INLINE_DATA_FL
you can just skip the refcount tree entirely. Copy the inode. Reinit the security if !preserve. Call it a day.
But this is a later optimization.
Joel
Signature · 9 lines
Life's Little Instruction Book #450 "Don't be afraid to say, 'I need help.'" Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127
cover ocfs2: Some patches for reflink. v3
Quoted 5 lines · Joel Becker
Quoted 2 lines · Tao Ma
This patch set integrate the fix for the bug tristan found.
Quoted 9 lines
These both look good. You know, if an inode is inline and has
no xattrs, ie:(
oi->i_dyn_flags& (OCFS2_HAS_XATTR_FL|OCFS2_HAS_INLINE_DATA_FL)) ==
OCFS2_HAS_INLINE_DATA_FLyou can just skip the refcount tree entirely. Copy the inode. Reinit the security if !preserve. Call it a day.
yeah, that is also one of the reason I moved complete_reflink out of create_reflink_node and insert it into __ocfs2_reflink(patch 1). So if we detect the situation you mentioned above, we will just copy the inode and then go directly to ocfs2_complete_reflink, both create_reflink_node and ocfs2_reflink_xattrs will be skipped. That would be quite easy.
Quoted 2 lines
But this is a later optimization.
agree.
Regards,
Tao
cover ocfs2: Some patches for reflink. v3
In reply to Tao MaTao Ma Wrote:
Quoted 3 lines
Hi Joel,
This patch set integrate the fix for the bug tristan found.
Tested-by Tristan.
bug 1185 got fixed with this patch series.
Quoted 8 lines
Regards,
Tao_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel
cover ocfs2: Some patches for reflink. v3
Quoted 5 lines · tristan.ye
Tao Ma Wrote:
Quoted 2 lines
Hi Joel,
This patch set integrate the fix for the bug tristan found.Tested-by Tristan.
Tristan,
Can you put full Tested-by/Reviewed-by/etc lines in future
emails? That way I can cut and paste them as I take patches for the tree.
For example, I'm putting these patches in ocfs2-fixes with the
line:
Thanks!
Joel
Signature · 10 lines
"The one important thing i have learned over the years is the difference between taking one's work seriously and taking one's self seriously. The first is imperative and the second is disastrous." -Margot Fonteyn Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127
cover ocfs2: Some patches for reflink. v3
In reply to Tao MaQuoted 2 lines · Tao Ma
Hi Joel,
This patch set integrate the fix for the bug tristan found.
These patches are now part of the fixes branch of ocfs2.git.
Joel
Signature · 17 lines
None of our men are "experts." We have most unfortunately found it necessary to get rid of a man as soon as he thinks himself an expert -- because no one ever considers himself expert if he really knows his job. A man who knows a job sees so much more to be done than he has done, that he is always pressing forward and never gives up an instant of thought to how good and how efficient he is. Thinking always ahead, thinking always of trying to do more, brings a state of mind in which nothing is impossible. The moment one gets into the "expert" state of mind a great number of things become impossible. - From Henry Ford Sr., "My Life and Work" Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127