From d5f35a10bd88c5a49f6d5370d038d010c92d1d48 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Mon, 17 Sep 2007 09:06:29 -0700 Subject: [PATCH] --- yaml --- r: 65094 b: refs/heads/master c: db56246c6980e376b02d2da568d119da71f82fb9 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ocfs2/aops.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 92a55b6b74d3..7a8727176428 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 415cb800375cc4e89fb5a6a454e484bd4adbffb4 +refs/heads/master: db56246c6980e376b02d2da568d119da71f82fb9 diff --git a/trunk/fs/ocfs2/aops.c b/trunk/fs/ocfs2/aops.c index 50cd8a209012..fa43810e5970 100644 --- a/trunk/fs/ocfs2/aops.c +++ b/trunk/fs/ocfs2/aops.c @@ -1211,18 +1211,33 @@ static int ocfs2_write_cluster_by_desc(struct address_space *mapping, loff_t pos, unsigned len) { int ret, i; + loff_t cluster_off; + unsigned int local_len = len; struct ocfs2_write_cluster_desc *desc; + struct ocfs2_super *osb = OCFS2_SB(mapping->host->i_sb); for (i = 0; i < wc->w_clen; i++) { desc = &wc->w_desc[i]; + /* + * We have to make sure that the total write passed in + * doesn't extend past a single cluster. + */ + local_len = len; + cluster_off = pos & (osb->s_clustersize - 1); + if ((cluster_off + local_len) > osb->s_clustersize) + local_len = osb->s_clustersize - cluster_off; + ret = ocfs2_write_cluster(mapping, desc->c_phys, desc->c_unwritten, data_ac, meta_ac, - wc, desc->c_cpos, pos, len); + wc, desc->c_cpos, pos, local_len); if (ret) { mlog_errno(ret); goto out; } + + len -= local_len; + pos += local_len; } ret = 0;