From: Chas Williams Date: Tue, 14 Nov 2000 03:28:15 +0000 (+0000) Subject: linux24-writepage-20001113 X-Git-Tag: BP-openafs-stable-1_0_x~12 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=36b6f3aea6c2a81eb0a866f97913b0ed3c84df88;p=packages%2Fo%2Fopenafs.git linux24-writepage-20001113 Linux 2.4 kernel writepage support --- diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index e5ce3dcb1..d1894e790 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1164,10 +1164,34 @@ int afs_linux_readpage(struct file *fp, struct page *pp) return -code; } -#ifdef NOTUSED -/* afs_linux_writepage - is this used anywhere? swap files via nfs? */ -int afs_linux_writepage(struct inode *ip, struct page *) { return -EINVAL }; +#if defined(AFS_LINUX24_ENV) +int afs_linux_writepage(struct file *file, struct page *page) +{ + struct dentry *dentry = file->f_dentry; + struct inode *inode = dentry->d_inode; + unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; + unsigned offset = PAGE_CACHE_SIZE; + long status; + + /* easy case */ + if (page->index < end_index) + goto do_it; + /* things got complicated... */ + offset = inode->i_size & (PAGE_CACHE_SIZE-1); + /* OK, are we completely out? */ + if (page->index >= end_index+1 || !offset) + return -EIO; +do_it: + status = afs_linux_updatepage(file, page, 0, offset, 1); + kunmap(page); + if (status == offset) + return 0; + else + return status; +} +#endif +#ifdef NOTUSED /* afs_linux_bmap - supports generic_readpage, but we roll our own. */ int afs_linux_bmap(struct inode *ip, int) { return -EINVAL; } @@ -1292,6 +1316,7 @@ struct inode_operations afs_file_iops = { }; struct address_space_operations afs_file_aops = { readpage: afs_linux_readpage, + writepage: afs_linux_writepage, commit_write: afs_linux_commit_write, prepare_write: afs_linux_prepare_write, };