FS-Cache: Make kAFS use FS-Cache
The attached patch makes the kAFS filesystem in fs/afs/ use FS-Cache, and through it any attached caches. The kAFS filesystem will use caching automatically if it's available. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Steve Dickson <steved@redhat.com> Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Tested-by: Daire Byrne <Daire.Byrne@framestore.com>
This commit is contained in:
@@ -780,3 +780,24 @@ int afs_fsync(struct file *file, struct dentry *dentry, int datasync)
|
||||
_leave(" = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* notification that a previously read-only page is about to become writable
|
||||
* - if it returns an error, the caller will deliver a bus error signal
|
||||
*/
|
||||
int afs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
|
||||
{
|
||||
struct afs_vnode *vnode = AFS_FS_I(vma->vm_file->f_mapping->host);
|
||||
|
||||
_enter("{{%x:%u}},{%lx}",
|
||||
vnode->fid.vid, vnode->fid.vnode, page->index);
|
||||
|
||||
/* wait for the page to be written to the cache before we allow it to
|
||||
* be modified */
|
||||
#ifdef CONFIG_AFS_FSCACHE
|
||||
fscache_wait_on_page_write(vnode->cache, page);
|
||||
#endif
|
||||
|
||||
_leave(" = 0");
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user