[Ocfs2-tools-devel] [PATCH] Add extent flag as the parameter to
block iteration function.
Tao Ma
tao.ma at oracle.com
Mon Oct 8 23:01:38 PDT 2007
As we have added unwritten extent in ocfs2, block iteration function
needs to know whether the content in the block is good. So add a new
parameter in block iteration function.
As for the block writting, please don't use these block iteration
functions. Just use ocfs2_file_write since it knows everything about
unwritten extents. ;)
Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
extras/set_random_bits.c | 1 +
fsck.ocfs2/pass1.c | 2 ++
fswreck/symlink.c | 1 +
libocfs2/dir_iterate.c | 1 +
libocfs2/extents.c | 5 ++++-
libocfs2/fileio.c | 9 +++++++--
libocfs2/include/dir_iterate.h | 1 +
libocfs2/include/ocfs2.h | 2 ++
8 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/extras/set_random_bits.c b/extras/set_random_bits.c
index 6aeec98..23c1813 100644
--- a/extras/set_random_bits.c
+++ b/extras/set_random_bits.c
@@ -68,6 +68,7 @@ struct walk_block {
static int walk_blocks_func(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data)
{
struct walk_block *wb = priv_data;
diff --git a/fsck.ocfs2/pass1.c b/fsck.ocfs2/pass1.c
index 85ed239..c5bbf5b 100644
--- a/fsck.ocfs2/pass1.c
+++ b/fsck.ocfs2/pass1.c
@@ -683,6 +683,7 @@ static void check_link_data(struct verifying_blocks *vb)
static int verify_block(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data)
{
struct verifying_blocks *vb = priv_data;
@@ -721,6 +722,7 @@ static int verify_block(ocfs2_filesys *fs,
static int clear_block(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data)
{
struct verifying_blocks *vb = priv_data;
diff --git a/fswreck/symlink.c b/fswreck/symlink.c
index 390b8ec..e746374 100644
--- a/fswreck/symlink.c
+++ b/fswreck/symlink.c
@@ -37,6 +37,7 @@ extern char *progname;
static int fillup_block(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data)
{
errcode_t ret = 0;
diff --git a/libocfs2/dir_iterate.c b/libocfs2/dir_iterate.c
index 609cd97..a156ed0 100644
--- a/libocfs2/dir_iterate.c
+++ b/libocfs2/dir_iterate.c
@@ -145,6 +145,7 @@ extern errcode_t ocfs2_dir_iterate(ocfs2_filesys *fs,
int ocfs2_process_dir_block(ocfs2_filesys *fs,
uint64_t blocknr,
uint64_t blockcnt,
+ uint16_t ext_flags,
void *priv_data)
{
struct dir_context *ctx = (struct dir_context *) priv_data;
diff --git a/libocfs2/extents.c b/libocfs2/extents.c
index 8d176d1..50f3b6e 100644
--- a/libocfs2/extents.c
+++ b/libocfs2/extents.c
@@ -503,6 +503,7 @@ struct block_context {
int (*func)(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data);
int flags;
struct ocfs2_dinode *inode;
@@ -531,7 +532,7 @@ static int block_iterate_func(ocfs2_filesys *fs,
!(ctxt->flags & OCFS2_BLOCK_FLAG_APPEND))
break;
- iret = (*ctxt->func)(fs, blkno, bcount,
+ iret = (*ctxt->func)(fs, blkno, bcount, rec->e_flags,
ctxt->priv_data);
if (iret & OCFS2_BLOCK_ABORT)
break;
@@ -546,6 +547,7 @@ errcode_t ocfs2_block_iterate_inode(ocfs2_filesys *fs,
int (*func)(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data),
void *priv_data)
{
@@ -571,6 +573,7 @@ errcode_t ocfs2_block_iterate(ocfs2_filesys *fs,
int (*func)(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data),
void *priv_data)
{
diff --git a/libocfs2/fileio.c b/libocfs2/fileio.c
index 85730b2..d10d141 100644
--- a/libocfs2/fileio.c
+++ b/libocfs2/fileio.c
@@ -45,12 +45,17 @@ struct read_whole_context {
static int read_whole_func(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data)
{
struct read_whole_context *ctx = priv_data;
- ctx->errcode = io_read_block(fs->fs_io, blkno,
- 1, ctx->ptr);
+ if (ext_flags & OCFS2_EXT_UNWRITTEN) {
+ memset(ctx->ptr, 0, fs->fs_blocksize);
+ ctx->errcode = 0;
+ } else
+ ctx->errcode = io_read_block(fs->fs_io, blkno,
+ 1, ctx->ptr);
if (ctx->errcode)
return OCFS2_BLOCK_ABORT;
diff --git a/libocfs2/include/dir_iterate.h b/libocfs2/include/dir_iterate.h
index 5694386..9ec11a3 100644
--- a/libocfs2/include/dir_iterate.h
+++ b/libocfs2/include/dir_iterate.h
@@ -45,6 +45,7 @@ struct dir_context {
extern int ocfs2_process_dir_block(ocfs2_filesys *fs,
uint64_t blocknr,
uint64_t blockcnt,
+ uint16_t ext_flags,
void *priv_data);
#endif /* _DIR_ITERATE_H */
diff --git a/libocfs2/include/ocfs2.h b/libocfs2/include/ocfs2.h
index 120c8d9..4991ff3 100644
--- a/libocfs2/include/ocfs2.h
+++ b/libocfs2/include/ocfs2.h
@@ -350,6 +350,7 @@ errcode_t ocfs2_block_iterate(ocfs2_filesys *fs,
int (*func)(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data),
void *priv_data);
errcode_t ocfs2_block_iterate_inode(ocfs2_filesys *fs,
@@ -358,6 +359,7 @@ errcode_t ocfs2_block_iterate_inode(ocfs2_filesys *fs,
int (*func)(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data),
void *priv_data);
--
1.5.3.2.g4f337
More information about the Ocfs2-tools-devel
mailing list