forked from luck/tmp_suning_uos_patched
smbfs: convert to new aops
Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4899f9c852
commit
fb53b30948
|
@ -292,29 +292,45 @@ smb_file_splice_read(struct file *file, loff_t *ppos,
|
||||||
* If the writer ends up delaying the write, the writer needs to
|
* If the writer ends up delaying the write, the writer needs to
|
||||||
* increment the page use counts until he is done with the page.
|
* increment the page use counts until he is done with the page.
|
||||||
*/
|
*/
|
||||||
static int smb_prepare_write(struct file *file, struct page *page,
|
static int smb_write_begin(struct file *file, struct address_space *mapping,
|
||||||
unsigned offset, unsigned to)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smb_commit_write(struct file *file, struct page *page,
|
static int smb_write_end(struct file *file, struct address_space *mapping,
|
||||||
unsigned offset, unsigned to)
|
loff_t pos, unsigned len, unsigned copied,
|
||||||
|
struct page *page, void *fsdata)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
|
||||||
|
|
||||||
status = -EFAULT;
|
|
||||||
lock_kernel();
|
lock_kernel();
|
||||||
status = smb_updatepage(file, page, offset, to-offset);
|
status = smb_updatepage(file, page, offset, copied);
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
|
|
||||||
|
if (!status) {
|
||||||
|
if (!PageUptodate(page) && copied == PAGE_CACHE_SIZE)
|
||||||
|
SetPageUptodate(page);
|
||||||
|
status = copied;
|
||||||
|
}
|
||||||
|
|
||||||
|
unlock_page(page);
|
||||||
|
page_cache_release(page);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct address_space_operations smb_file_aops = {
|
const struct address_space_operations smb_file_aops = {
|
||||||
.readpage = smb_readpage,
|
.readpage = smb_readpage,
|
||||||
.writepage = smb_writepage,
|
.writepage = smb_writepage,
|
||||||
.prepare_write = smb_prepare_write,
|
.write_begin = smb_write_begin,
|
||||||
.commit_write = smb_commit_write
|
.write_end = smb_write_end,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user