2.6.21-rc7 new aops patchset
Subsystems (2)
http://www.kernel.org/pub/linux/kernel/people/npiggin/patches/new-aops/
2.6.21-rc7-new-aops*
New aops patchset against 2.6.21-rc7. I was going to rebase against -mm and submit the patchset, but I ended up doing quite a lot of new filesystem conversions and fixes so I stay with mainline so as to not introduce so much churn.
The plan is to next rebase against rc6-mm1 and submit all 47 patches to linux-fsdevel and Andrew Morton to be merged. OK? Should each fs conversion also go to the filesystem specific maintainer/list?
I have done some testing, but I would like testing and revuew abd acks from filesystem maintainers. Lots of filesystems I can't or don't know how to mount and test. Well that is a copout, but it is a hassle for me to do so many when presumably maintainers will have a test setup ready to go. And I have tried to minimise the load on maintainers by doing most conversions myself.
cc'ed reiserfs lists: could somebody volunteer to do the resierfs conversion? It's too complex for me to do a reasonable job, and reiserfs prepare_write also does weird things with generic_cont_expand which is hard to follow (this could be made much simpler by using the AOP_FLAG_CONT_EXPAND I added there -- can you also look at using that, or let me know why it doesn't work).
Changes:
- Cut perform_write batch AOP out of this series. It will be back, in a future discussion. Kept the iov_iter stuff because it's nice anyway.
- Added patch to inject short or zero length pagecache writes to better exercise filesystems. Another one to poision new and !uptodate buffers.
- Kept the old ocfs2 patch from Mark, so I don't have to suck up git-ocfs2.patch which keeps patch size down. I'll use Mark's new patch when rebasing to -mm.
- ext4 patch from Badari.
- Fixed ext3 data=journal (and the copied code in ext4).
- Converted cifs + fixed information leak.
- Converted udf seem to have fixed pagecache corruption(?) -- page was marked uptodate when it is not. Also, fixed the silly setup where prepare_write was doing a kmap to be used in commit_write: just do kmap_atomic in write_end.
- Fixed some earlier problems with my ext2 multi-page directory handling.
- Had a crack at converting all the others. reiserfs is the only one left unconverted!
- Tested (under UML, loopback, PAGE_SIZE=4096) with fsx-linux the following:
ext2 (bs=1024,4096)
ext3 (bs=1024,4096; data=writeback,ordered,journal)
minix (v2,3)
xfs (bs=1024,4096)
fuse (with ssh,passthough fs -- note fsx-linux fails as expected) jfs
reiserfs (bs=1024,4096) (unconverted)
vfat (bs=1024,4096)
tmpfs
rd (with ext2)
hostfs (it now survives much longer than with the old code!) nfs
Nick
Miklos Szeredi
maintainerNick,
Thanks for converting fuse, and testing. Here's a minor update to fs-fuse-aops.patch.
Miklos
----
Convert fuse to new aops.
[mszeredi]
- don't send zero length write requests
- it is not legal for the filesystem to return with zero written bytes
fs/fuse/file.c +33 -15
@@ -443,22 +443,25 @@ static size_t fuse_send_write(struct fusreturn outarg.size; } -static int fuse_prepare_write (struct file *file,struct page *page, -unsigned offset,unsigned to) -{ -/* No op */ +static int fuse_write_begin (struct file *file,struct address_space *mapping, +loff_t pos,unsigned len,unsigned flags, +struct page **pagep,void **fsdata) +{ +pgoff_t index = pos >>PAGE_CACHE_SHIFT ; + + *pagep =__grab_cache_page (mapping, index); +if (!*pagep) +return -ENOMEM ;return 0 ; } -static int fuse_commit_write (struct file *file,struct page *page, -unsigned offset,unsigned to) +static int fuse_buffered_write (struct file *file,struct inode *inode, +loff_t pos,unsigned count,struct page *page) {int err;size_t nres; -unsigned count = to - offset; -struct inode *inode = page->mapping->host;struct fuse_conn *fc =get_fuse_conn (inode); -loff_t pos =page_offset (page) + offset; +unsigned offset = pos & (PAGE_CACHE_SIZE -1 );struct fuse_req *req;if (is_bad_inode (inode))
@@ -474,20 +477,35 @@ static int fuse_commit_write(struct file nres =fuse_send_write (req, file, inode, pos, count); err = req->out.h.error;fuse_put_request (fc, req); -if (!err && nres != count) +if (!err && !nres) err = -EIO ;if (!err) { - pos += count; + pos += nres;spin_lock (&fc->lock);if (pos > inode->i_size)i_size_write (inode, pos);spin_unlock (&fc->lock); -if (offset ==0 && to ==PAGE_CACHE_SIZE ) +if (count ==PAGE_CACHE_SIZE )SetPageUptodate (page); }fuse_invalidate_attr (inode); -return err; +return err ? err : nres; +} + +static int fuse_write_end (struct file *file,struct address_space *mapping, +loff_t pos,unsigned len,unsigned copied, +struct page *page,void *fsdata) +{ +struct inode *inode = mapping->host; +int res =0 ; + +if (copied) + res =fuse_buffered_write (file, inode, pos, copied, page); + +unlock_page (page); +page_cache_release (page); +return res; }static void fuse_release_user_pages (struct fuse_req *req,int write)
@@ -817,8 +835,8 @@ static const struct file_operations fusestatic const struct address_space_operations fuse_file_aops = { .readpage = fuse_readpage, - .prepare_write = fuse_prepare_write, - .commit_write = fuse_commit_write, + .write_begin = fuse_write_begin, + .write_end = fuse_write_end, .readpages = fuse_readpages, .set_page_dirty = fuse_set_page_dirty, .bmap = fuse_bmap,
Nick Piggin
AppliedQuoted 10 lines · Miklos Szeredi
Nick,
Thanks for converting fuse, and testing. Here's a minor update to fs-fuse-aops.patch.
Miklos
----
Convert fuse to new aops.
Quoted 6 lines
[mszeredi]
- don't send zero length write requests
- it is not legal for the filesystem to return with zero written bytesSigned-off-by Nick Piggin <[email protected]>Signed-off-by Miklos Szeredi <[email protected]>
Thanks, applied.