aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/file.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-10-16 04:25:20 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:42:57 -0400
commitbe021ee41a8b65d181fe22799de6be62adf72efb (patch)
treed02e79ac30c6b03ea361bc425a566a402a8db0c0 /fs/udf/file.c
parent82b9d1d0da8046088b0f505f92a97d12d9804613 (diff)
udf: convert to new aops
Convert udf to new aops. Also seem to have fixed pagecache corruption in udf_adinicb_commit_write -- page was marked uptodate when it is not. Also, fixed the silly setup where prepare_write was doing a kmap to be used in commit_write: just do kmap_atomic in write_end. Use libfs helpers to make this easier. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: <bfennema@falcon.csc.calpoly.edu> Cc: Jan Kara <jack@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r--fs/udf/file.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 5d7a4ea27753..7c7a1b39d56c 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -76,36 +76,29 @@ static int udf_adinicb_writepage(struct page *page, struct writeback_control *wb
76 return 0; 76 return 0;
77} 77}
78 78
79static int udf_adinicb_prepare_write(struct file *file, struct page *page, 79static int udf_adinicb_write_end(struct file *file,
80 unsigned offset, unsigned to) 80 struct address_space *mapping,
81 loff_t pos, unsigned len, unsigned copied,
82 struct page *page, void *fsdata)
81{ 83{
82 kmap(page); 84 struct inode *inode = mapping->host;
83 return 0; 85 unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
84} 86 char *kaddr;
85
86static int udf_adinicb_commit_write(struct file *file, struct page *page,
87 unsigned offset, unsigned to)
88{
89 struct inode *inode = page->mapping->host;
90 char *kaddr = page_address(page);
91 87
88 kaddr = kmap_atomic(page, KM_USER0);
92 memcpy(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode) + offset, 89 memcpy(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode) + offset,
93 kaddr + offset, to - offset); 90 kaddr + offset, copied);
94 mark_inode_dirty(inode); 91 kunmap_atomic(kaddr, KM_USER0);
95 SetPageUptodate(page); 92
96 kunmap(page); 93 return simple_write_end(file, mapping, pos, len, copied, page, fsdata);
97 /* only one page here */
98 if (to > inode->i_size)
99 inode->i_size = to;
100 return 0;
101} 94}
102 95
103const struct address_space_operations udf_adinicb_aops = { 96const struct address_space_operations udf_adinicb_aops = {
104 .readpage = udf_adinicb_readpage, 97 .readpage = udf_adinicb_readpage,
105 .writepage = udf_adinicb_writepage, 98 .writepage = udf_adinicb_writepage,
106 .sync_page = block_sync_page, 99 .sync_page = block_sync_page,
107 .prepare_write = udf_adinicb_prepare_write, 100 .write_begin = simple_write_begin,
108 .commit_write = udf_adinicb_commit_write, 101 .write_end = udf_adinicb_write_end,
109}; 102};
110 103
111static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, 104static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,