[Ocfs2-tools-devel] [PATCH 2/6] extent_map: Add a parameter for
ocfs2_extent_map_get_blocks.
Tao Ma
tao.ma at oracle.com
Mon Sep 24 02:19:53 PDT 2007
extent_map: Add a parameter for ocfs2_extent_map_get_blocks.
So the extent flags can be returned.
Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
fsck.ocfs2/journal.c | 6 +++---
fswreck/dir.c | 4 ++--
fswreck/symlink.c | 2 +-
libocfs2/dir_scan.c | 2 +-
libocfs2/expanddir.c | 2 +-
libocfs2/extent_map.c | 15 ++++++++++++---
libocfs2/fileio.c | 8 +++++---
libocfs2/include/ocfs2.h | 3 ++-
libocfs2/mkjournal.c | 2 +-
libocfs2/truncate.c | 2 +-
10 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/fsck.ocfs2/journal.c b/fsck.ocfs2/journal.c
index 20e6e71..b865926 100644
--- a/fsck.ocfs2/journal.c
+++ b/fsck.ocfs2/journal.c
@@ -242,7 +242,7 @@ static errcode_t lookup_journal_block(ocfs2_filesys *fs,
int was_set;
ret = ocfs2_extent_map_get_blocks(ji->ji_cinode, blkoff, 1, blkno,
- &contig);
+ &contig, NULL);
if (ret) {
com_err(whoami, ret, "while looking up logical block "
"%"PRIu64" in slot %d's journal", blkoff, ji->ji_slot);
@@ -566,7 +566,7 @@ errcode_t o2fsck_should_replay_journals(ocfs2_filesys *fs, int *should)
continue;
ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &blkno,
- &contig);
+ &contig, NULL);
if (ret) {
com_err(whoami, ret, "while looking up the journal "
"super block in slot %d's journal", i);
@@ -737,7 +737,7 @@ static errcode_t check_journal_super(ocfs2_filesys *fs,
if (ret)
goto out;
- ret = ocfs2_extent_map_get_blocks(ci, 0, 1, &blkno, &contig);
+ ret = ocfs2_extent_map_get_blocks(ci, 0, 1, &blkno, &contig, NULL);
if (ret)
goto out;
diff --git a/fswreck/dir.c b/fswreck/dir.c
index f96f66d..4371601 100644
--- a/fswreck/dir.c
+++ b/fswreck/dir.c
@@ -146,7 +146,7 @@ static void damage_dir_content(ocfs2_filesys *fs, uint64_t dir,
FSWRK_COM_FATAL(progname, ret);
/* get first blockno */
- ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &blkno, &contig);
+ ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &blkno, &contig, NULL);
if (ret)
FSWRK_COM_FATAL(progname, ret);
@@ -356,7 +356,7 @@ void mess_up_dir_parent_dup(ocfs2_filesys *fs, uint64_t blkno)
if (ret)
FSWRK_COM_FATAL(progname, ret);
- ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &extblk, &contig);
+ ret = ocfs2_extent_map_get_blocks(cinode, 0, 1, &extblk, &contig, NULL);
if (ret)
FSWRK_COM_FATAL(progname, ret);
diff --git a/fswreck/symlink.c b/fswreck/symlink.c
index a04881f..390b8ec 100644
--- a/fswreck/symlink.c
+++ b/fswreck/symlink.c
@@ -85,7 +85,7 @@ static void add_symlink(ocfs2_filesys *fs, uint64_t blkno)
/* get first block of the file */
ret = ocfs2_extent_map_get_blocks(cinode, 0, 1,
- &new_blk, &contig);
+ &new_blk, &contig, NULL);
if (ret)
FSWRK_COM_FATAL(progname, ret);
diff --git a/libocfs2/dir_scan.c b/libocfs2/dir_scan.c
index 2c4ce6b..bb31101 100644
--- a/libocfs2/dir_scan.c
+++ b/libocfs2/dir_scan.c
@@ -57,7 +57,7 @@ static errcode_t get_more_dir_blocks(ocfs2_dir_scan *scan)
ret = ocfs2_extent_map_get_blocks(scan->inode,
scan->blocks_read, 1,
- &blkno, &cblocks);
+ &blkno, &cblocks, NULL);
if (ret)
return ret;
diff --git a/libocfs2/expanddir.c b/libocfs2/expanddir.c
index abaf119..7ddab61 100644
--- a/libocfs2/expanddir.c
+++ b/libocfs2/expanddir.c
@@ -88,7 +88,7 @@ errcode_t ocfs2_expand_dir(ocfs2_filesys *fs,
/* get the next free block */
ret = ocfs2_extent_map_get_blocks(cinode, used_blks, 1,
- &new_blk, &contig);
+ &new_blk, &contig, NULL);
if (ret)
goto bail;
diff --git a/libocfs2/extent_map.c b/libocfs2/extent_map.c
index c5fc34c..ecb6f55 100644
--- a/libocfs2/extent_map.c
+++ b/libocfs2/extent_map.c
@@ -159,9 +159,11 @@ static int ocfs2_search_extent_list(struct ocfs2_extent_list *el,
static errcode_t ocfs2_get_clusters(ocfs2_cached_inode *cinode,
uint32_t v_cluster,
uint32_t *p_cluster,
- uint32_t *num_clusters)
+ uint32_t *num_clusters,
+ uint16_t *extent_flags)
{
int i;
+ uint16_t flags = 0;
errcode_t ret = 0;
ocfs2_filesys *fs = cinode->ci_fs;
struct ocfs2_dinode *di;
@@ -222,8 +224,13 @@ static errcode_t ocfs2_get_clusters(ocfs2_cached_inode *cinode,
if (num_clusters)
*num_clusters = ocfs2_rec_clusters(el->l_tree_depth,
rec) - coff;
+
+ flags = rec->e_flags;
}
+ if (extent_flags)
+ *extent_flags = flags;
+
out:
if (eb_buf)
ocfs2_free(&eb_buf);
@@ -232,7 +239,8 @@ out:
errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
uint64_t v_blkno, int count,
- uint64_t *p_blkno, uint64_t *ret_count)
+ uint64_t *p_blkno, uint64_t *ret_count,
+ uint16_t *extent_flags)
{
errcode_t ret;
int bpc;
@@ -243,7 +251,8 @@ errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
bpc = ocfs2_clusters_to_blocks(fs, 1);
cpos = ocfs2_blocks_to_clusters(fs, v_blkno);
- ret = ocfs2_get_clusters(cinode, cpos, &p_cluster, &num_clusters);
+ ret = ocfs2_get_clusters(cinode, cpos, &p_cluster,
+ &num_clusters, extent_flags);
if (ret)
goto out;
diff --git a/libocfs2/fileio.c b/libocfs2/fileio.c
index 9517e5c..7058e7c 100644
--- a/libocfs2/fileio.c
+++ b/libocfs2/fileio.c
@@ -155,7 +155,8 @@ errcode_t ocfs2_file_read(ocfs2_cached_inode *ci, void *buf, uint32_t count,
while(wanted_blocks) {
ret = ocfs2_extent_map_get_blocks(ci, v_blkno, 1,
- &p_blkno, &contig_blocks);
+ &p_blkno, &contig_blocks,
+ NULL);
if (ret)
return ret;
@@ -260,7 +261,8 @@ errcode_t ocfs2_file_write(ocfs2_cached_inode *ci, void *buf, uint32_t count,
while(wanted_blocks) {
ret = ocfs2_extent_map_get_blocks(ci, v_blkno, 1,
- &p_blkno, &contig_blocks);
+ &p_blkno, &contig_blocks,
+ NULL);
if (ret)
return ret;
@@ -340,7 +342,7 @@ errcode_t ocfs2_file_write(ocfs2_cached_inode *ci, void *buf, uint32_t count,
ocfs2_free_cached_inode(fs, ci);
ret = ocfs2_read_cached_inode(fs,ino, &ci);
ret = ocfs2_extent_map_get_blocks(ci, v_blkno, 1,
- &p_blkno, NULL);
+ &p_blkno, NULL, NULL);
/* now we shouldn't find a hole. */
if (!p_blkno || p_blkno != p_alloc + p_offset)
ret = OCFS2_ET_INTERNAL_FAILURE;
diff --git a/libocfs2/include/ocfs2.h b/libocfs2/include/ocfs2.h
index 694db4c..c4c9590 100644
--- a/libocfs2/include/ocfs2.h
+++ b/libocfs2/include/ocfs2.h
@@ -299,7 +299,8 @@ void ocfs2_swap_extent_list_to_cpu(struct ocfs2_extent_list *el);
errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
uint64_t v_blkno, int count,
uint64_t *p_blkno,
- uint64_t *ret_count);
+ uint64_t *ret_count,
+ uint16_t *extent_flags);
int ocfs2_find_leaf(ocfs2_filesys *fs, struct ocfs2_dinode *di,
uint32_t cpos, char **leaf_buf);
void ocfs2_swap_journal_superblock(journal_superblock_t *jsb);
diff --git a/libocfs2/mkjournal.c b/libocfs2/mkjournal.c
index c7da80c..ccc939d 100644
--- a/libocfs2/mkjournal.c
+++ b/libocfs2/mkjournal.c
@@ -239,7 +239,7 @@ static errcode_t ocfs2_format_journal(ocfs2_filesys *fs,
goto out;
/* re-use offset here for 1st journal block. */
- ret = ocfs2_extent_map_get_blocks(ci, 0, 1, &offset, NULL);
+ ret = ocfs2_extent_map_get_blocks(ci, 0, 1, &offset, NULL, NULL);
if (ret)
goto out;
diff --git a/libocfs2/truncate.c b/libocfs2/truncate.c
index 33d0c65..f1784e7 100644
--- a/libocfs2/truncate.c
+++ b/libocfs2/truncate.c
@@ -153,7 +153,7 @@ static errcode_t ocfs2_zero_tail_for_truncate(ocfs2_cached_inode *ci,
start_blk = new_size / fs->fs_blocksize;
ret = ocfs2_extent_map_get_blocks(ci, start_blk, 1,
- &p_blkno, &contig_blocks);
+ &p_blkno, &contig_blocks, NULL);
if (ret)
goto out;
--
1.5.3.2.g4f337
More information about the Ocfs2-tools-devel
mailing list