diff options
Diffstat (limited to 'fs/smbfs/file.c')
-rw-r--r-- | fs/smbfs/file.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index a62de1256..1360ca994 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c @@ -169,17 +169,25 @@ printk("smb_writepage_sync: short write, wsize=%d, result=%d\n", wsize, result); static int smb_writepage(struct dentry *dentry, struct page *page) { - int result; - -#ifdef SMBFS_PARANOIA - if (!PageLocked(page)) - printk("smb_writepage: page not already locked!\n"); -#endif + struct inode *inode = dentry->d_inode; + unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; + unsigned offset = PAGE_CACHE_SIZE; + int err; + + /* 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: get_page(page); - result = smb_writepage_sync(dentry, page, 0, PAGE_SIZE); + err = smb_writepage_sync(dentry, page, 0, offset); SetPageUptodate(page); put_page(page); - return result; + return err; } static int @@ -376,7 +384,7 @@ printk("smb_file_permission: mode=%x, mask=%x\n", mode, mask); return error; } -static struct file_operations smb_file_operations = +struct file_operations smb_file_operations = { read: smb_file_read, write: smb_file_write, @@ -389,19 +397,7 @@ static struct file_operations smb_file_operations = struct inode_operations smb_file_inode_operations = { - &smb_file_operations, /* default file operations */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - NULL, /* truncate */ - smb_file_permission, /* permission */ - smb_revalidate_inode, /* revalidate */ + permission: smb_file_permission, + revalidate: smb_revalidate_inode, + setattr: smb_notify_change, }; |