Skip to content

Commit eb6fe0c

Browse files
cotte-ibmLinus Torvalds
authored andcommitted
[PATCH] xip: reduce code duplication
This patch reworks filemap_xip.c with the goal to reduce code duplication from mm/filemap.c. It applies agains 2.6.12-rc6-mm1. Instead of implementing the aio functions, this one implements the synchronous read/write functions only. For readv and writev, the generic fallback is used. For aio, we rely on the application doing the fallback. Since our "synchronous" function does memcpy immediately anyway, there is no performance difference between using the fallbacks or implementing each operation. Signed-off-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 6d79125 commit eb6fe0c

4 files changed

Lines changed: 63 additions & 205 deletions

File tree

‎fs/ext2/file.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,13 @@ struct file_operations ext2_file_operations = {
5858
#ifdef CONFIG_EXT2_FS_XIP
5959
struct file_operations ext2_xip_file_operations = {
6060
.llseek = generic_file_llseek,
61-
.read = do_sync_read,
62-
.write = do_sync_write,
63-
.aio_read = xip_file_aio_read,
64-
.aio_write = xip_file_aio_write,
61+
.read = xip_file_read,
62+
.write = xip_file_write,
6563
.ioctl = ext2_ioctl,
6664
.mmap = xip_file_mmap,
6765
.open = generic_file_open,
6866
.release = ext2_release_file,
6967
.fsync = ext2_sync_file,
70-
.readv = xip_file_readv,
71-
.writev = xip_file_writev,
7268
.sendfile = xip_file_sendfile,
7369
};
7470
#endif

‎include/linux/fs.h‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,18 +1500,14 @@ extern int generic_file_open(struct inode * inode, struct file * filp);
15001500
extern int nonseekable_open(struct inode * inode, struct file * filp);
15011501

15021502
#ifdef CONFIG_FS_XIP
1503-
extern ssize_t xip_file_aio_read(struct kiocb *iocb, char __user *buf,
1504-
size_t count, loff_t pos);
1505-
extern ssize_t xip_file_readv(struct file *filp, const struct iovec *iov,
1506-
unsigned long nr_segs, loff_t *ppos);
1503+
extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len,
1504+
loff_t *ppos);
15071505
extern ssize_t xip_file_sendfile(struct file *in_file, loff_t *ppos,
15081506
size_t count, read_actor_t actor,
15091507
void *target);
15101508
extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma);
1511-
extern ssize_t xip_file_aio_write(struct kiocb *iocb, const char __user *buf,
1512-
size_t count, loff_t pos);
1513-
extern ssize_t xip_file_writev(struct file *file, const struct iovec *iov,
1514-
unsigned long nr_segs, loff_t *ppos);
1509+
extern ssize_t xip_file_write(struct file *filp, const char __user *buf,
1510+
size_t len, loff_t *ppos);
15151511
extern int xip_truncate_page(struct address_space *mapping, loff_t from);
15161512
#else
15171513
static inline int xip_truncate_page(struct address_space *mapping, loff_t from)

‎mm/filemap.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <linux/config.h>
1616
#include <asm/uaccess.h>
1717

18-
extern size_t
18+
size_t
1919
__filemap_copy_from_user_iovec(char *vaddr,
2020
const struct iovec *iov,
2121
size_t base,

0 commit comments

Comments
 (0)