diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/aops.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 460d440310f2..50cd8a209012 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -855,6 +855,7 @@ static int ocfs2_alloc_write_ctxt(struct ocfs2_write_ctxt **wcp, | |||
855 | struct ocfs2_super *osb, loff_t pos, | 855 | struct ocfs2_super *osb, loff_t pos, |
856 | unsigned len, struct buffer_head *di_bh) | 856 | unsigned len, struct buffer_head *di_bh) |
857 | { | 857 | { |
858 | u32 cend; | ||
858 | struct ocfs2_write_ctxt *wc; | 859 | struct ocfs2_write_ctxt *wc; |
859 | 860 | ||
860 | wc = kzalloc(sizeof(struct ocfs2_write_ctxt), GFP_NOFS); | 861 | wc = kzalloc(sizeof(struct ocfs2_write_ctxt), GFP_NOFS); |
@@ -862,7 +863,8 @@ static int ocfs2_alloc_write_ctxt(struct ocfs2_write_ctxt **wcp, | |||
862 | return -ENOMEM; | 863 | return -ENOMEM; |
863 | 864 | ||
864 | wc->w_cpos = pos >> osb->s_clustersize_bits; | 865 | wc->w_cpos = pos >> osb->s_clustersize_bits; |
865 | wc->w_clen = ocfs2_clusters_for_bytes(osb->sb, len); | 866 | cend = (pos + len - 1) >> osb->s_clustersize_bits; |
867 | wc->w_clen = cend - wc->w_cpos + 1; | ||
866 | get_bh(di_bh); | 868 | get_bh(di_bh); |
867 | wc->w_di_bh = di_bh; | 869 | wc->w_di_bh = di_bh; |
868 | 870 | ||