Skip to content

Commit

Permalink
[PATCH] xip: reduce code duplication
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Carsten Otte authored and Linus Torvalds committed Jun 24, 2005
1 parent 6d79125 commit eb6fe0c
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 205 deletions.
8 changes: 2 additions & 6 deletions fs/ext2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,13 @@ struct file_operations ext2_file_operations = {
#ifdef CONFIG_EXT2_FS_XIP
struct file_operations ext2_xip_file_operations = {
.llseek = generic_file_llseek,
.read = do_sync_read,
.write = do_sync_write,
.aio_read = xip_file_aio_read,
.aio_write = xip_file_aio_write,
.read = xip_file_read,
.write = xip_file_write,
.ioctl = ext2_ioctl,
.mmap = xip_file_mmap,
.open = generic_file_open,
.release = ext2_release_file,
.fsync = ext2_sync_file,
.readv = xip_file_readv,
.writev = xip_file_writev,
.sendfile = xip_file_sendfile,
};
#endif
Expand Down
12 changes: 4 additions & 8 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1500,18 +1500,14 @@ extern int generic_file_open(struct inode * inode, struct file * filp);
extern int nonseekable_open(struct inode * inode, struct file * filp);

#ifdef CONFIG_FS_XIP
extern ssize_t xip_file_aio_read(struct kiocb *iocb, char __user *buf,
size_t count, loff_t pos);
extern ssize_t xip_file_readv(struct file *filp, const struct iovec *iov,
unsigned long nr_segs, loff_t *ppos);
extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len,
loff_t *ppos);
extern ssize_t xip_file_sendfile(struct file *in_file, loff_t *ppos,
size_t count, read_actor_t actor,
void *target);
extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma);
extern ssize_t xip_file_aio_write(struct kiocb *iocb, const char __user *buf,
size_t count, loff_t pos);
extern ssize_t xip_file_writev(struct file *file, const struct iovec *iov,
unsigned long nr_segs, loff_t *ppos);
extern ssize_t xip_file_write(struct file *filp, const char __user *buf,
size_t len, loff_t *ppos);
extern int xip_truncate_page(struct address_space *mapping, loff_t from);
#else
static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
Expand Down
2 changes: 1 addition & 1 deletion mm/filemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/config.h>
#include <asm/uaccess.h>

extern size_t
size_t
__filemap_copy_from_user_iovec(char *vaddr,
const struct iovec *iov,
size_t base,
Expand Down
Loading

0 comments on commit eb6fe0c

Please sign in to comment.