[Ocfs2-tools-devel] [PATCH] tunefs.ocfs2: Enable inline support for sparse/unsparse.
Tao Ma
tao.ma at oracle.com
Tue Jul 28 19:18:32 PDT 2009
Currently tunefs.ocfs2 will bug out when we do sparse related
things(sparse/nosparse/list-sparse) if there is some inline files.
So add support for it.
This patch also add the support for unwritten extents.
Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
tunefs.ocfs2/feature_sparse_files.c | 6 ++++++
tunefs.ocfs2/feature_unwritten_extents.c | 3 +++
tunefs.ocfs2/op_list_sparse_files.c | 3 +++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/tunefs.ocfs2/feature_sparse_files.c b/tunefs.ocfs2/feature_sparse_files.c
index ddb966f..4af3e0a 100644
--- a/tunefs.ocfs2/feature_sparse_files.c
+++ b/tunefs.ocfs2/feature_sparse_files.c
@@ -83,6 +83,9 @@ static errcode_t truncate_to_i_size(ocfs2_filesys *fs,
if (di->i_flags & OCFS2_SYSTEM_FL)
goto out;
+ if (di->i_dyn_features & OCFS2_INLINE_DATA_FL)
+ goto out;
+
ret = ocfs2_read_cached_inode(fs, di->i_blkno, &ci);
if (ret)
goto out;
@@ -289,6 +292,9 @@ static errcode_t hole_iterate(ocfs2_filesys *fs, struct ocfs2_dinode *di,
if (di->i_flags & OCFS2_SYSTEM_FL)
goto bail;
+ if (di->i_dyn_features & OCFS2_INLINE_DATA_FL)
+ goto bail;
+
ret = ocfs2_malloc0(sizeof(struct sparse_file), &file);
if (ret)
goto bail;
diff --git a/tunefs.ocfs2/feature_unwritten_extents.c b/tunefs.ocfs2/feature_unwritten_extents.c
index ea096c5..c6b6a4b 100644
--- a/tunefs.ocfs2/feature_unwritten_extents.c
+++ b/tunefs.ocfs2/feature_unwritten_extents.c
@@ -95,6 +95,9 @@ static errcode_t unwritten_iterate(ocfs2_filesys *fs,
if (di->i_flags & OCFS2_SYSTEM_FL)
goto bail;
+ if (di->i_dyn_features & OCFS2_INLINE_DATA_FL)
+ goto bail;
+
clusters = (di->i_size + fs->fs_clustersize -1 ) /
fs->fs_clustersize;
diff --git a/tunefs.ocfs2/op_list_sparse_files.c b/tunefs.ocfs2/op_list_sparse_files.c
index 817f269..2f81d36 100644
--- a/tunefs.ocfs2/op_list_sparse_files.c
+++ b/tunefs.ocfs2/op_list_sparse_files.c
@@ -256,6 +256,9 @@ static errcode_t list_sparse_file(ocfs2_filesys *fs,
ctxt->file_hole_len = 0;
+ if (di->i_dyn_features & OCFS2_INLINE_DATA_FL)
+ return 0;
+
if (di->i_links_count > 1) {
file = multi_link_file_lookup(ctxt, di->i_blkno);
--
1.6.2.rc2.16.gf474c
More information about the Ocfs2-tools-devel
mailing list