|
@@ -855,6 +855,7 @@ static int ocfs2_alloc_write_ctxt(struct ocfs2_write_ctxt **wcp,
|
|
|
struct ocfs2_super *osb, loff_t pos,
|
|
|
unsigned len, struct buffer_head *di_bh)
|
|
|
{
|
|
|
+ u32 cend;
|
|
|
struct ocfs2_write_ctxt *wc;
|
|
|
|
|
|
wc = kzalloc(sizeof(struct ocfs2_write_ctxt), GFP_NOFS);
|
|
@@ -862,7 +863,8 @@ static int ocfs2_alloc_write_ctxt(struct ocfs2_write_ctxt **wcp,
|
|
|
return -ENOMEM;
|
|
|
|
|
|
wc->w_cpos = pos >> osb->s_clustersize_bits;
|
|
|
- wc->w_clen = ocfs2_clusters_for_bytes(osb->sb, len);
|
|
|
+ cend = (pos + len - 1) >> osb->s_clustersize_bits;
|
|
|
+ wc->w_clen = cend - wc->w_cpos + 1;
|
|
|
get_bh(di_bh);
|
|
|
wc->w_di_bh = di_bh;
|
|
|
|