tangled
alpha
login
or
join now
tjh.dev
/
kernel
1
fork
atom
Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1
fork
atom
overview
issues
pulls
pipelines
Merge branch 'fast_track' into for_next
Jan Kara
13 years ago
3f6bba82
76f59b3b
+29
-6
1 changed file
expand all
collapse all
unified
split
fs
udf
file.c
+29
-6
fs/udf/file.c
reviewed
···
39
39
#include "udf_i.h"
40
40
#include "udf_sb.h"
41
41
42
42
-
static int udf_adinicb_readpage(struct file *file, struct page *page)
42
42
+
static void __udf_adinicb_readpage(struct page *page)
43
43
{
44
44
struct inode *inode = page->mapping->host;
45
45
char *kaddr;
46
46
struct udf_inode_info *iinfo = UDF_I(inode);
47
47
48
48
-
BUG_ON(!PageLocked(page));
49
49
-
50
48
kaddr = kmap(page);
51
51
-
memset(kaddr, 0, PAGE_CACHE_SIZE);
52
49
memcpy(kaddr, iinfo->i_ext.i_data + iinfo->i_lenEAttr, inode->i_size);
50
50
+
memset(kaddr + inode->i_size, 0, PAGE_CACHE_SIZE - inode->i_size);
53
51
flush_dcache_page(page);
54
52
SetPageUptodate(page);
55
53
kunmap(page);
54
54
+
}
55
55
+
56
56
+
static int udf_adinicb_readpage(struct file *file, struct page *page)
57
57
+
{
58
58
+
BUG_ON(!PageLocked(page));
59
59
+
__udf_adinicb_readpage(page);
56
60
unlock_page(page);
57
61
58
62
return 0;
···
81
77
return 0;
82
78
}
83
79
80
80
+
static int udf_adinicb_write_begin(struct file *file,
81
81
+
struct address_space *mapping, loff_t pos,
82
82
+
unsigned len, unsigned flags, struct page **pagep,
83
83
+
void **fsdata)
84
84
+
{
85
85
+
struct page *page;
86
86
+
87
87
+
if (WARN_ON_ONCE(pos >= PAGE_CACHE_SIZE))
88
88
+
return -EIO;
89
89
+
page = grab_cache_page_write_begin(mapping, 0, flags);
90
90
+
if (!page)
91
91
+
return -ENOMEM;
92
92
+
*pagep = page;
93
93
+
94
94
+
if (!PageUptodate(page) && len != PAGE_CACHE_SIZE)
95
95
+
__udf_adinicb_readpage(page);
96
96
+
return 0;
97
97
+
}
98
98
+
84
99
static int udf_adinicb_write_end(struct file *file,
85
100
struct address_space *mapping,
86
101
loff_t pos, unsigned len, unsigned copied,
···
121
98
const struct address_space_operations udf_adinicb_aops = {
122
99
.readpage = udf_adinicb_readpage,
123
100
.writepage = udf_adinicb_writepage,
124
124
-
.write_begin = simple_write_begin,
125
125
-
.write_end = udf_adinicb_write_end,
101
101
+
.write_begin = udf_adinicb_write_begin,
102
102
+
.write_end = udf_adinicb_write_end,
126
103
};
127
104
128
105
static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,