Skip to contentSkip to conversation

afs: convert to new aops

PATCH New Nick Piggin 1 participant 1 message Sep 24, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 afs: convert to new aops

Hi everyone,

The plan is another push to convert everyone to use the new write_begin and write_end address space operations, because we're going to rip out the compat code in 2.6.28 (it's a *lot* of nasty code, more likey to be broken or become broken due to lack of testing).

Last time I sent the AFS patch out, actually David you raised a (valid) concern that it does a more RMW operations than it used to. This is not changed now. I don't have the in depth konwledge of AFS or even a test setup to attempt any more advanced design. Anyway, the patch has been out there for a year, and so have the new aops, so I think that is ample time. So at this point we can't justify carrying the compat cruft around in the vm/fs core just for AFS, IMO. So let's start with this basic patch, and you can implement any smarter algorithm on top of that. --

Convert afs to new aops.

Cannot assume writes will fully complete, so this conversion goes the easy way and always brings the page uptodate before the write.

---

fs/afs/file.c +2 -2
Index: linux-2.6/fs/afs/file.c
===================================================================
@@ -50,8 +50,8 @@ const struct address_space_operations af
 	.launder_page	= afs_launder_page,
 	.releasepage	= afs_releasepage,
 	.invalidatepage	= afs_invalidatepage,
-	.prepare_write	= afs_prepare_write,
-	.commit_write	= afs_commit_write,
+	.write_begin	= afs_write_begin,
+	.write_end	= afs_write_end,
 	.writepage	= afs_writepage,
 	.writepages	= afs_writepages,
 };
fs/afs/internal.h +6 -2
Index: linux-2.6/fs/afs/internal.h
===================================================================
@@ -728,8 +728,12 @@ extern int afs_volume_release_fileserver
  */
 extern int afs_set_page_dirty(struct page *);
 extern void afs_put_writeback(struct afs_writeback *);
-extern int afs_prepare_write(struct file *, struct page *, unsigned, unsigned);
-extern int afs_commit_write(struct file *, struct page *, unsigned, unsigned);
+extern int afs_write_begin(struct file *file, struct address_space *mapping,
+			loff_t pos, unsigned len, unsigned flags,
+			struct page **pagep, void **fsdata);
+extern int afs_write_end(struct file *file, struct address_space *mapping,
+			loff_t pos, unsigned len, unsigned copied,
+			struct page *page, void *fsdata);
 extern int afs_writepage(struct page *, struct writeback_control *);
 extern int afs_writepages(struct address_space *, struct writeback_control *);
 extern int afs_write_inode(struct inode *, int);
fs/afs/write.c +43 -88

204 lines not on this page · raw message