2.6.27.32-stable review
Greetings,
Patch 41/48 (ocfs2: Initialize the...) of this series causes a build failure:
fs/ocfs2/aops.c: In function ‘ocfs2_write_cluster’:fs/ocfs2/aops.c:1286: error: ‘should_zero’ undeclared (first use in this function) fs/ocfs2/aops.c:1286: error: (Each undeclared identifier is reported only once fs/ocfs2/aops.c:1286: error: for each function it appears in.)fs/ocfs2/aops.c: In function ‘ocfs2_write_cluster_by_desc’:fs/ocfs2/aops.c:1360: warning: passing argument 4 of ‘ocfs2_write_cluster’ makes pointer from integer without a cast fs/ocfs2/aops.c:1360: warning: passing argument 6 of ‘ocfs2_write_cluster’ from incompatible pointer type fs/ocfs2/aops.c:1360: warning: passing argument 7 of ‘ocfs2_write_cluster’ makes integer from pointer without a cast fs/ocfs2/aops.c:1360: error: too many arguments to function ‘ocfs2_write_cluster’
A line from the upstream patch is missing in this patch:
static int ocfs2_write_cluster(struct address_space *mapping,
u32 phys, unsigned int unwritten,
+ unsigned int should_zero,
struct ocfs2_alloc_context *data_ac, struct ocfs2_alloc_context *meta_ac, struct ocfs2_write_ctxt *wc, u32 cpos, loff_t user_pos, unsigned user_len)
Attached is the corrected patch with the above line placed back in.
Thanks
Jayson R. King
From: Sunil Mushran <[email protected]>
commit e7432675f8ca868a4af365759a8d4c3779a3d922 upstream.
In a non-sparse extend, we correctly allocate (and zero) the clusters between the old_i_size and pos, but we don't zero the portions of the cluster we're writing to outside of pos<->len.
It handles clustersize > pagesize and blocksize < pagesize.
[Cleaned up by Joel Becker.]
--- fs/ocfs2/aops.c | 66 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 19 deletions(-)
fs/ocfs2/aops.c +47 -19
@@ -908,18 +908,17 @@ struct ocfs2_write_cluster_desc {*/ unsigned c_new;unsigned c_unwritten; +unsigned c_needs_zero; }; -static inline int ocfs2_should_zero_cluster (struct ocfs2_write_cluster_desc *d) -{ -return d->c_new || d->c_unwritten; -} -struct ocfs2_write_ctxt {/* Logical cluster position / len of write */ u32 w_cpos;u32 w_clen; +/* First cluster allocated in a nonsparse extend */ +u32 w_first_new_cpos; +struct ocfs2_write_cluster_desc w_desc[OCFS2_MAX_CLUSTERS_PER_PAGE ];/*
@@ -997,6 +996,7 @@ static int ocfs2_alloc_write_ctxt(structreturn -ENOMEM ; wc->w_cpos = pos >> osb->s_clustersize_bits; + wc->w_first_new_cpos =UINT_MAX ; cend = (pos + len -1 ) >> osb->s_clustersize_bits; wc->w_clen = cend - wc->w_cpos +1 ;get_bh (di_bh);
@@ -1234,19 +1234,17 @@ out:*/ static int ocfs2_write_cluster (struct address_space *mapping,u32 phys,unsigned int unwritten, +unsigned int should_zero,struct ocfs2_alloc_context *data_ac,struct ocfs2_alloc_context *meta_ac,struct ocfs2_write_ctxt *wc,u32 cpos,loff_t user_pos,unsigned user_len) { -int ret, i, new, should_zero =0 ; +int ret, i, new;u64 v_blkno, p_blkno;struct inode *inode = mapping->host; new = phys ==0 ?1 :0 ; -if (new || unwritten) - should_zero =1 ; -if (new) {u32 tmp_pos;
@@ -1356,7 +1354,9 @@ static int ocfs2_write_cluster_by_desc(s local_len = osb->s_clustersize - cluster_off; ret =ocfs2_write_cluster (mapping, desc->c_phys, - desc->c_unwritten, data_ac, meta_ac, + desc->c_unwritten, + desc->c_needs_zero, + data_ac, meta_ac, wc, desc->c_cpos, pos, local_len);if (ret) {mlog_errno (ret);
@@ -1406,14 +1406,14 @@ static void ocfs2_set_target_boundaries(* newly allocated cluster. */ desc = &wc->w_desc[0 ]; -if (ocfs2_should_zero_cluster (desc)) +if (desc->c_needs_zero)ocfs2_figure_cluster_boundaries (osb, desc->c_cpos, &wc->w_target_from,NULL ); desc = &wc->w_desc[wc->w_clen -1 ]; -if (ocfs2_should_zero_cluster (desc)) +if (desc->c_needs_zero) ocfs2_figure_cluster_boundaries(osb, desc->c_cpos, NULL,
@@ -1481,13 +1481,28 @@ static int ocfs2_populate_write_desc(str phys++; } +/* +* If w_first_new_cpos is < UINT_MAX, we have a non-sparse +* file that got extended. w_first_new_cpos tells us +* where the newly allocated clusters are so we can +* zero them. +*/ +if (desc->c_cpos >= wc->w_first_new_cpos) { +BUG_ON (phys ==0 ); + desc->c_needs_zero =1 ; + } + desc->c_phys = phys;if (phys ==0 ) { desc->c_new =1 ; + desc->c_needs_zero =1 ; *clusters_to_alloc = *clusters_to_alloc +1 ; } -if (ext_flags &OCFS2_EXT_UNWRITTEN ) + +if (ext_flags &OCFS2_EXT_UNWRITTEN ) { desc->c_unwritten =1 ; + desc->c_needs_zero =1 ; + } num_clusters--; }
@@ -1644,10 +1659,13 @@ static int ocfs2_expand_nonsparse_inode(if (newsize <=i_size_read (inode))return 0 ; - ret =ocfs2_extend_no_holes (inode, newsize, newsize - len); + ret =ocfs2_extend_no_holes (inode, newsize, pos);if (ret)mlog_errno (ret); + wc->w_first_new_cpos = +ocfs2_clusters_for_bytes (inode->i_sb,i_size_read (inode)); +return ret; }
@@ -1656,7 +1674,7 @@ int ocfs2_write_begin_nolock(struct addr struct page **pagep, void **fsdata, struct buffer_head *di_bh, struct page *mmap_page) { - int ret, credits = OCFS2_INODE_UPDATE_CREDITS; + int ret, cluster_of_pages, credits = OCFS2_INODE_UPDATE_CREDITS;unsigned int clusters_to_alloc, extents_to_split;struct ocfs2_write_ctxt *wc;struct inode *inode = mapping->host;
@@ -1724,8 +1742,19 @@ int ocfs2_write_begin_nolock(struct addr } -ocfs2_set_target_boundaries (osb, wc, pos, len, - clusters_to_alloc + extents_to_split); +/* +* We have to zero sparse allocated clusters, unwritten extent clusters, +* and non-sparse clusters we just extended. For non-sparse writes, +* we know zeros will only be needed in the first and/or last cluster. +*/ +if (clusters_to_alloc || extents_to_split || + wc->w_desc[0 ].c_needs_zero || + wc->w_desc[wc->w_clen -1 ].c_needs_zero) + cluster_of_pages =1 ; +else + cluster_of_pages =0 ; + +ocfs2_set_target_boundaries (osb, wc, pos, len, cluster_of_pages); handle =ocfs2_start_trans (osb, credits);if (IS_ERR (handle)) {
@@ -1753,8 +1782,7 @@ int ocfs2_write_begin_nolock(struct addr* extent. */ ret =ocfs2_grab_pages_for_write (mapping, wc, wc->w_cpos, pos, - clusters_to_alloc + extents_to_split, - mmap_page); + cluster_of_pages, mmap_page);if (ret) {mlog_errno (ret); goto out_commit;
Quoted 33 lines · Jayson King
Greetings,
Patch 41/48 (ocfs2: Initialize the...) of this series causes a build failure:
fs/ocfs2/aops.c: In function ‘ocfs2_write_cluster’:fs/ocfs2/aops.c:1286: error: ‘should_zero’ undeclared (first use in this function)fs/ocfs2/aops.c:1286: error: (Each undeclared identifier is reported only oncefs/ocfs2/aops.c:1286: error: for each function it appears in.)fs/ocfs2/aops.c: In function ‘ocfs2_write_cluster_by_desc’:fs/ocfs2/aops.c:1360: warning: passing argument 4 of ‘ocfs2_write_cluster’ makes pointer from integer without a castfs/ocfs2/aops.c:1360: warning: passing argument 6 of ‘ocfs2_write_cluster’ from incompatible pointer typefs/ocfs2/aops.c:1360: warning: passing argument 7 of ‘ocfs2_write_cluster’ makes integer from pointer without a castfs/ocfs2/aops.c:1360: error: too many arguments to function ‘ocfs2_write_cluster’A line from the upstream patch is missing in this patch:
static int ocfs2_write_cluster(struct
address_space*mapping,
u32 phys, unsigned int unwritten,
+ unsigned intshould_zero,
structocfs2_alloc_context*data_ac, structocfs2_alloc_context*meta_ac, structocfs2_write_ctxt*wc, u32 cpos,loff_tuser_pos, unsigneduser_len)
Quoted 1 line
Attached is the corrected patch with the above line placed back in.
There was an add-on ocfs2 patch that should have now resolved this issue. If you still have this problem with the released kernel, please let me know.
thanks,
greg k-h
Quoted 11 lines · Jayson King
Quoted 10 lines
Greetings,
Patch 41/48 (ocfs2: Initialize the...) of this series causes a build failure:
fs/ocfs2/aops.c: In function `ocfs2_write_cluster':fs/ocfs2/aops.c:1286: error: `should_zero' undeclared (first use in this function)fs/ocfs2/aops.c:1286: error: (Each undeclared identifier is reported only oncefs/ocfs2/aops.c:1286: error: for each function it appears in.)fs/ocfs2/aops.c: In function `ocfs2_write_cluster_by_desc':
...
Quoted 12 lines
Quoted 12 lines
A line from the upstream patch is missing in this patch:
static int ocfs2_write_cluster(struct
address_space*mapping,
u32 phys, unsigned int unwritten,
+ unsigned intshould_zero,
structocfs2_alloc_context*data_ac, structocfs2_alloc_context*meta_ac, structocfs2_write_ctxt*wc, u32 cpos,loff_tuser_pos, unsigneduser_len)
Quoted 5 lines
Quoted 1 line
Attached is the corrected patch with the above line placed back in.
There was an add-on ocfs2 patch that should have now resolved this issue. If you still have this problem with the released kernel, please let me know.
Well, with just-released 2.6.27.32 exactly the same issue occurs. I used patch-2.6.27.32.bz2 on top of linux-2.6.26.tar.bz2, not the tarball (linux-2.6.27.32.tar.bz2).
fs/ocfs2/aops.c: In function 'ocfs2_write_cluster':fs/ocfs2/aops.c:1286: error: 'should_zero' undeclared (first use in this function) fs/ocfs2/aops.c:1286: error: (Each undeclared identifier is reported only once fs/ocfs2/aops.c:1286: error: for each function it appears in.)fs/ocfs2/aops.c: In function 'ocfs2_write_cluster_by_desc':fs/ocfs2/aops.c:1360: warning: passing argument 4 of 'ocfs2_write_cluster' makes pointer from integer without a cast fs/ocfs2/aops.c:1360: warning: passing argument 6 of 'ocfs2_write_cluster' from incompatible pointer type fs/ocfs2/aops.c:1360: warning: passing argument 7 of 'ocfs2_write_cluster' makes integer from pointer without a cast fs/ocfs2/aops.c:1360: error: too many arguments to function 'ocfs2_write_cluster'
Which add-on you're referring to? In the stable-queue/releases/2.6.27.32/ I only see two patches related to ocfs:
ocfs2-initialize-the-cluster-we-re-writing-to-in-a-non-sparse-extend.patch ocfs2-ocfs2_write_begin_nolock-should-handle-len-0.patch
Neither of which looks like an addon, and only one (the first) has references to this "should_zero" variable.
Thanks!
/mjt
Quoted 44 lines · Michael Tokarev
Quoted 11 lines · Jayson King
Quoted 10 lines
Greetings,
Patch 41/48 (ocfs2: Initialize the...) of this series causes a build failure:
fs/ocfs2/aops.c: In function `ocfs2_write_cluster':fs/ocfs2/aops.c:1286: error: `should_zero' undeclared (first use in this function)fs/ocfs2/aops.c:1286: error: (Each undeclared identifier is reported only oncefs/ocfs2/aops.c:1286: error: for each function it appears in.)fs/ocfs2/aops.c: In function `ocfs2_write_cluster_by_desc':...
Quoted 12 lines
Quoted 12 lines
A line from the upstream patch is missing in this patch:
static int ocfs2_write_cluster(struct
address_space*mapping,
u32 phys, unsigned int unwritten,
+ unsigned intshould_zero,
structocfs2_alloc_context*data_ac, structocfs2_alloc_context*meta_ac, structocfs2_write_ctxt*wc, u32 cpos,loff_tuser_pos, unsigneduser_len)Quoted 5 lines
Quoted 1 line
Attached is the corrected patch with the above line placed back in.
There was an add-on ocfs2 patch that should have now resolved this issue. If you still have this problem with the released kernel, please let me know.
Well, with just-released 2.6.27.32 exactly the same issue occurs. I used patch-2.6.27.32.bz2 on top of linux-2.6.26.tar.bz2, not the tarball (linux-2.6.27.32.tar.bz2).
fs/ocfs2/aops.c: In function 'ocfs2_write_cluster':fs/ocfs2/aops.c:1286: error: 'should_zero' undeclared (first use in this function)fs/ocfs2/aops.c:1286: error: (Each undeclared identifier is reported only oncefs/ocfs2/aops.c:1286: error: for each function it appears in.)fs/ocfs2/aops.c: In function 'ocfs2_write_cluster_by_desc':fs/ocfs2/aops.c:1360: warning: passing argument 4 of 'ocfs2_write_cluster' makes pointer from integer without a castfs/ocfs2/aops.c:1360: warning: passing argument 6 of 'ocfs2_write_cluster' from incompatible pointer typefs/ocfs2/aops.c:1360: warning: passing argument 7 of 'ocfs2_write_cluster' makes integer from pointer without a castfs/ocfs2/aops.c:1360: error: too many arguments to function 'ocfs2_write_cluster'
Quoted 6 lines
Which add-on you're referring to? In the stable-queue/releases/2.6.27.32/ I only see two patches related to ocfs:
ocfs2-initialize-the-cluster-we-re-writing-to-in-a-non-sparse-extend.patch ocfs2-ocfs2_write_begin_nolock-should-handle-len-0.patch
Neither of which looks like an addon, and only one (the first) has references to this "should_zero" variable.
I thought the second one would solve the problem.
What happened here, I took the upstream patch, was it incorrect? If so, was there a patch, also upstream, that fixed this problem?
totally confused,
greg k-h
Quoted 11 lines · Greg KH
Quoted 10 lines · Michael Tokarev
Quoted 10 lines · Jayson King
Quoted 9 lines
A line from the upstream patch is missing in this patch:
static int ocfs2_write_cluster(struct
address_space*mapping,
u32 phys, unsigned int unwritten,
+ unsigned intshould_zero,
structocfs2_alloc_context*data_ac, structocfs2_alloc_context*meta_ac, structocfs2_write_ctxt*wc, u32 cpos,loff_tuser_pos, unsigneduser_len)
<snip>
Quoted 9 lines
Quoted 4 lines
ocfs2-initialize-the-cluster-we-re-writing-to-in-a-non-sparse-extend.patch ocfs2-ocfs2_write_begin_nolock-should-handle-len-0.patch
Neither of which looks like an addon, and only one (the first) has references to this "should_zero" variable.I thought the second one would solve the problem.
What happened here, I took the upstream patch, was it incorrect? If so, was there a patch, also upstream, that fixed this problem?
The upstream first patch ise7432675f8ca868a4af365759a8d4c3779a3d922. It has this line. The second patch fixes a bug in the first patch, but the bug is not around this line, it's totally separate.
Ok, I'm confused. In linux-2.6-stable.git, the 2.6.30.y branch
has this for the diff:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=blobdiff;f=fs/ocfs2/aops.c;h=122fb7978f60f7dde54ac0567f578159900f163b;hp=b2c52b3a1484f1c57c4b098bf9706fe21c186ac0;hb=9baf278cca4043a1312f3a40bf17b979b6238ebc;hpb=8c668814e3e2be7d633447bf6e78237d4cedabb7
It has the correct line.
But in 2.6.27.y branch, referencing the same upstream commit,
there is this diff:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=blobdiff;f=fs/ocfs2/aops.c;h=50bb561860dfb5ee024e7a992bb4d72bc71f0372;hp=a53da1466277abd843b0117f89df9850423ba92b;hb=8338941200d9188e3c866dd16cc2848754947895;hpb=7e8287379470a7c18153be389c9516e31ae141f3
It is missing the line. I think the cherry-pick for 2.6.27.y got broken.
Joel
Signature · 9 lines
"If you are ever in doubt as to whether or not to kiss a pretty girl,
give her the benefit of the doubt"
-Thomas Carlyle
Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127Quoted 30 lines · Joel Becker
Quoted 11 lines · Greg KH
Quoted 10 lines · Michael Tokarev
Quoted 10 lines · Jayson King
Quoted 9 lines
A line from the upstream patch is missing in this patch:
static int ocfs2_write_cluster(struct
address_space*mapping,
u32 phys, unsigned int unwritten,
+ unsigned intshould_zero,
structocfs2_alloc_context*data_ac, structocfs2_alloc_context*meta_ac, structocfs2_write_ctxt*wc, u32 cpos,loff_tuser_pos, unsigneduser_len)<snip>
Quoted 9 lines
Quoted 4 lines
ocfs2-initialize-the-cluster-we-re-writing-to-in-a-non-sparse-extend.patch ocfs2-ocfs2_write_begin_nolock-should-handle-len-0.patch
Neither of which looks like an addon, and only one (the first) has references to this "should_zero" variable.I thought the second one would solve the problem.
What happened here, I took the upstream patch, was it incorrect? If so, was there a patch, also upstream, that fixed this problem?
The upstream first patch is
e7432675f8ca868a4af365759a8d4c3779a3d922. It has this line. The second patch fixes a bug in the first patch, but the bug is not around this line, it's totally separate.Ok, I'm confused. In linux-2.6-stable.git, the 2.6.30.y branch
Quoted 8 lines
has this for the diff:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=blobdiff;f=fs/ocfs2/aops.c;h=122fb7978f60f7dde54ac0567f578159900f163b;hp=b2c52b3a1484f1c57c4b098bf9706fe21c186ac0;hb=9baf278cca4043a1312f3a40bf17b979b6238ebc;hpb=8c668814e3e2be7d633447bf6e78237d4cedabb7
It has the correct line.
But in 2.6.27.y branch, referencing the same upstream commit,
there is this diff:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=blobdiff;f=fs/ocfs2/aops.c;h=50bb561860dfb5ee024e7a992bb4d72bc71f0372;hp=a53da1466277abd843b0117f89df9850423ba92b;hb=8338941200d9188e3c866dd16cc2848754947895;hpb=7e8287379470a7c18153be389c9516e31ae141f3
It is missing the line. I think the cherry-pick for 2.6.27.y got broken.
Very wierd. I used the same patch to pick from :(
I'll go fix this up and do a new release for the .27 tree. Thanks for working it out for me.
greg k-h
Quoted 6 lines · On Wed, 9 Sep 2009 11:36:40 -0700 Greg KH <[email protected]> wrote:
Very wierd. I used the same patch to pick from :(
I'll go fix this up and do a new release for the .27 tree. Thanks for working it out for me.
I diagnosed this and sent the fix to you on Saturday:
Quoted 6 lines · Chuck Ebbert
Quoted 3 lines · On Wed, 9 Sep 2009 11:36:40 -0700 Greg KH <[email protected]> wrote:
Very wierd. I used the same patch to pick from :(
Quoted 7 lines
Quoted 3 lines
I'll go fix this up and do a new release for the .27 tree. Thanks for working it out for me.
I diagnosed this and sent the fix to you on Saturday:
Doh, you did, my apologies...