diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 20 | ||||
-rw-r--r-- | mm/filemap_xip.c | 22 | ||||
-rw-r--r-- | mm/shmem.c | 42 |
3 files changed, 17 insertions, 67 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index d1d9814f99dd..c6ebd9f912ab 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1245,26 +1245,6 @@ int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long o | |||
1245 | return written; | 1245 | return written; |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | ssize_t generic_file_sendfile(struct file *in_file, loff_t *ppos, | ||
1249 | size_t count, read_actor_t actor, void *target) | ||
1250 | { | ||
1251 | read_descriptor_t desc; | ||
1252 | |||
1253 | if (!count) | ||
1254 | return 0; | ||
1255 | |||
1256 | desc.written = 0; | ||
1257 | desc.count = count; | ||
1258 | desc.arg.data = target; | ||
1259 | desc.error = 0; | ||
1260 | |||
1261 | do_generic_file_read(in_file, ppos, &desc, actor); | ||
1262 | if (desc.written) | ||
1263 | return desc.written; | ||
1264 | return desc.error; | ||
1265 | } | ||
1266 | EXPORT_SYMBOL(generic_file_sendfile); | ||
1267 | |||
1268 | static ssize_t | 1248 | static ssize_t |
1269 | do_readahead(struct address_space *mapping, struct file *filp, | 1249 | do_readahead(struct address_space *mapping, struct file *filp, |
1270 | unsigned long index, unsigned long nr) | 1250 | unsigned long index, unsigned long nr) |
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c index fa360e566d88..65ffc321f0c0 100644 --- a/mm/filemap_xip.c +++ b/mm/filemap_xip.c | |||
@@ -159,28 +159,6 @@ xip_file_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos) | |||
159 | } | 159 | } |
160 | EXPORT_SYMBOL_GPL(xip_file_read); | 160 | EXPORT_SYMBOL_GPL(xip_file_read); |
161 | 161 | ||
162 | ssize_t | ||
163 | xip_file_sendfile(struct file *in_file, loff_t *ppos, | ||
164 | size_t count, read_actor_t actor, void *target) | ||
165 | { | ||
166 | read_descriptor_t desc; | ||
167 | |||
168 | if (!count) | ||
169 | return 0; | ||
170 | |||
171 | desc.written = 0; | ||
172 | desc.count = count; | ||
173 | desc.arg.data = target; | ||
174 | desc.error = 0; | ||
175 | |||
176 | do_xip_mapping_read(in_file->f_mapping, &in_file->f_ra, in_file, | ||
177 | ppos, &desc, actor); | ||
178 | if (desc.written) | ||
179 | return desc.written; | ||
180 | return desc.error; | ||
181 | } | ||
182 | EXPORT_SYMBOL_GPL(xip_file_sendfile); | ||
183 | |||
184 | /* | 162 | /* |
185 | * __xip_unmap is invoked from xip_unmap and | 163 | * __xip_unmap is invoked from xip_unmap and |
186 | * xip_write | 164 | * xip_write |
diff --git a/mm/shmem.c b/mm/shmem.c index b6aae2b33393..0493e4d0bcaa 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1100,9 +1100,9 @@ static int shmem_getpage(struct inode *inode, unsigned long idx, | |||
1100 | * Normally, filepage is NULL on entry, and either found | 1100 | * Normally, filepage is NULL on entry, and either found |
1101 | * uptodate immediately, or allocated and zeroed, or read | 1101 | * uptodate immediately, or allocated and zeroed, or read |
1102 | * in under swappage, which is then assigned to filepage. | 1102 | * in under swappage, which is then assigned to filepage. |
1103 | * But shmem_prepare_write passes in a locked filepage, | 1103 | * But shmem_readpage and shmem_prepare_write pass in a locked |
1104 | * which may be found not uptodate by other callers too, | 1104 | * filepage, which may be found not uptodate by other callers |
1105 | * and may need to be copied from the swappage read in. | 1105 | * too, and may need to be copied from the swappage read in. |
1106 | */ | 1106 | */ |
1107 | repeat: | 1107 | repeat: |
1108 | if (!filepage) | 1108 | if (!filepage) |
@@ -1485,9 +1485,18 @@ static const struct inode_operations shmem_symlink_inode_operations; | |||
1485 | static const struct inode_operations shmem_symlink_inline_operations; | 1485 | static const struct inode_operations shmem_symlink_inline_operations; |
1486 | 1486 | ||
1487 | /* | 1487 | /* |
1488 | * Normally tmpfs makes no use of shmem_prepare_write, but it | 1488 | * Normally tmpfs avoids the use of shmem_readpage and shmem_prepare_write; |
1489 | * lets a tmpfs file be used read-write below the loop driver. | 1489 | * but providing them allows a tmpfs file to be used for splice, sendfile, and |
1490 | * below the loop driver, in the generic fashion that many filesystems support. | ||
1490 | */ | 1491 | */ |
1492 | static int shmem_readpage(struct file *file, struct page *page) | ||
1493 | { | ||
1494 | struct inode *inode = page->mapping->host; | ||
1495 | int error = shmem_getpage(inode, page->index, &page, SGP_CACHE, NULL); | ||
1496 | unlock_page(page); | ||
1497 | return error; | ||
1498 | } | ||
1499 | |||
1491 | static int | 1500 | static int |
1492 | shmem_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to) | 1501 | shmem_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to) |
1493 | { | 1502 | { |
@@ -1711,25 +1720,6 @@ static ssize_t shmem_file_read(struct file *filp, char __user *buf, size_t count | |||
1711 | return desc.error; | 1720 | return desc.error; |
1712 | } | 1721 | } |
1713 | 1722 | ||
1714 | static ssize_t shmem_file_sendfile(struct file *in_file, loff_t *ppos, | ||
1715 | size_t count, read_actor_t actor, void *target) | ||
1716 | { | ||
1717 | read_descriptor_t desc; | ||
1718 | |||
1719 | if (!count) | ||
1720 | return 0; | ||
1721 | |||
1722 | desc.written = 0; | ||
1723 | desc.count = count; | ||
1724 | desc.arg.data = target; | ||
1725 | desc.error = 0; | ||
1726 | |||
1727 | do_shmem_file_read(in_file, ppos, &desc, actor); | ||
1728 | if (desc.written) | ||
1729 | return desc.written; | ||
1730 | return desc.error; | ||
1731 | } | ||
1732 | |||
1733 | static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf) | 1723 | static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf) |
1734 | { | 1724 | { |
1735 | struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb); | 1725 | struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb); |
@@ -2386,6 +2376,7 @@ static const struct address_space_operations shmem_aops = { | |||
2386 | .writepage = shmem_writepage, | 2376 | .writepage = shmem_writepage, |
2387 | .set_page_dirty = __set_page_dirty_no_writeback, | 2377 | .set_page_dirty = __set_page_dirty_no_writeback, |
2388 | #ifdef CONFIG_TMPFS | 2378 | #ifdef CONFIG_TMPFS |
2379 | .readpage = shmem_readpage, | ||
2389 | .prepare_write = shmem_prepare_write, | 2380 | .prepare_write = shmem_prepare_write, |
2390 | .commit_write = simple_commit_write, | 2381 | .commit_write = simple_commit_write, |
2391 | #endif | 2382 | #endif |
@@ -2399,7 +2390,8 @@ static const struct file_operations shmem_file_operations = { | |||
2399 | .read = shmem_file_read, | 2390 | .read = shmem_file_read, |
2400 | .write = shmem_file_write, | 2391 | .write = shmem_file_write, |
2401 | .fsync = simple_sync_file, | 2392 | .fsync = simple_sync_file, |
2402 | .sendfile = shmem_file_sendfile, | 2393 | .splice_read = generic_file_splice_read, |
2394 | .splice_write = generic_file_splice_write, | ||
2403 | #endif | 2395 | #endif |
2404 | }; | 2396 | }; |
2405 | 2397 | ||