[Ocfs2-tools-devel] [PATCH 14/44] ocfs2: Integrate CoW in file write.
Joel Becker
Joel.Becker at oracle.com
Sun Jan 10 02:28:47 PST 2010
On Mon, Dec 28, 2009 at 05:00:59PM +0800, Tao Ma wrote:
> 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;
I'd say check for feature(REFCOUNT) and dyn_flags&REFCOUNT
before calling ocfs2_refcount_cow(). Why do the NOOP work?
Joel
--
"Senator let's be sincere,
As much as you can."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-tools-devel
mailing list