[Ocfs2-tools-devel] [PATCH 14/44] ocfs2: Integrate CoW in file write.
Tao Ma
tao.ma at oracle.com
Mon Dec 28 01:00:59 PST 2009
Call ocfs2_refcount_cow first to CoW refcounted clusters
in ocfs2_file_block_write.
Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
libocfs2/fileio.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/libocfs2/fileio.c b/libocfs2/fileio.c
index c4664ec..78ef5f5 100644
--- a/libocfs2/fileio.c
+++ b/libocfs2/fileio.c
@@ -33,6 +33,7 @@
#include <inttypes.h>
#include "ocfs2/ocfs2.h"
+#include "refcount.h"
struct read_whole_context {
char *buf;
@@ -325,6 +326,14 @@ static errcode_t ocfs2_file_block_write(ocfs2_cached_inode *ci,
if (v_blkno + wanted_blocks > num_blocks)
wanted_blocks = (uint32_t) (num_blocks - v_blkno);
+ cluster_begin = ocfs2_blocks_to_clusters(fs, v_blkno);
+ cluster_end = ocfs2_blocks_to_clusters(fs,
+ v_blkno + wanted_blocks - 1);
+ n_clusters = cluster_end - cluster_begin + 1;
+ ret = ocfs2_refcount_cow(ci, cluster_begin, n_clusters, UINT_MAX);
+ if (ret)
+ return ret;
+
while(wanted_blocks) {
ret = ocfs2_extent_map_get_blocks(ci, v_blkno, 1,
&p_blkno, &contig_blocks,
--
1.5.5
More information about the Ocfs2-tools-devel
mailing list