[Ocfs2-tools-devel] [PATCH v2] o2image: back-up xattr tree for regular file
Joseph Qi
jiangqi903 at gmail.com
Sun Jun 4 20:57:12 PDT 2017
On 17/6/2 19:38, piaojun wrote:
> when traversing regular file's inode with 'OCFS2_HAS_XATTR_FL' but no
> xattr btree in traverse_inode(), we will get into traverse_extents()
> rather than traverse_xb(). so xattr btree is not back-up actually.
> we need distinguish this situation, and back-up xattr btree.
Still confused.
Since no xattr tree, why should we back-up it?
And why moving up will run into traverse_xb? The condition doesn't
change.
Thanks,
Joseph
>
> Signed-off-by: Jun Piao <piaojun at huawei.com>
> ---
> o2image/o2image.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/o2image/o2image.c b/o2image/o2image.c
> index ee62acf..c56bbcf 100644
> --- a/o2image/o2image.c
> +++ b/o2image/o2image.c
> @@ -256,9 +256,16 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
> *
> * NOTE: we do need to handle its xattr btree if exists.
> */
> - if (!S_ISDIR(di->i_mode) && !(di->i_flags & OCFS2_SYSTEM_FL) &&
> - !(di->i_dyn_features & OCFS2_HAS_XATTR_FL))
> + if (!S_ISDIR(di->i_mode) && !(di->i_flags & OCFS2_SYSTEM_FL)) {
> + if ((di->i_dyn_features & OCFS2_HAS_XATTR_FL) && di->i_xattr_loc) {
> + /* traverse xattr btree to map bucket leaves */
> + ret = traverse_xb(ofs, di->i_xattr_loc);
> + if (ret)
> + com_err(program_name, ret, "while traversing xattr tree"
> + " %"PRIu64"", inode);
> + }
> goto out;
> + }
>
> /* Read and traverse group descriptors */
> if (di->i_flags & OCFS2_SYSTEM_FL)
> @@ -291,9 +298,6 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
> ret = traverse_chains(ofs, &(di->id2.i_chain), dump_type);
> else if (di->i_flags & OCFS2_DEALLOC_FL)
> ret = mark_dealloc_bits(ofs, &(di->id2.i_dealloc));
> - else if ((di->i_dyn_features & OCFS2_HAS_XATTR_FL) && di->i_xattr_loc)
> - /* Do need to traverse xattr btree to map bucket leaves */
> - ret = traverse_xb(ofs, di->i_xattr_loc);
> else {
> /*
> * Don't check superblock flag for the dir indexing
> @@ -318,11 +322,9 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
> }
>
> out_error:
> - if (ret) {
> + if (ret)
> com_err(program_name, ret, "while scanning inode %"PRIu64"",
> inode);
> - goto out;
> - }
> out:
> if (buf)
> ocfs2_free(&buf);
>
More information about the Ocfs2-tools-devel
mailing list