From b34c35ceba2fc2efb5543e4f070aada3100913fa Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:25:44 -0500 Subject: [PATCH] Import 2.3.9pre1 --- Makefile | 2 +- arch/i386/kernel/mca.c | 3 +- arch/i386/kernel/mtrr.c | 7 +- arch/ppc/kernel/ppc_htab.c | 7 +- arch/sparc64/kernel/binfmt_aout32.c | 11 +- arch/sparc64/kernel/sys_sparc32.c | 23 ++-- drivers/ap1000/ringbuf.c | 7 +- drivers/block/ll_rw_blk.c | 13 +-- drivers/char/ftape/lowlevel/ftape-proc.c | 5 +- drivers/char/serial.c | 9 +- drivers/pci/proc.c | 7 +- drivers/zorro/proc.c | 7 +- fs/adfs/dir.c | 6 +- fs/adfs/file.c | 8 +- fs/affs/dir.c | 3 +- fs/affs/file.c | 8 +- fs/affs/symlink.c | 6 +- fs/autofs/dir.c | 3 +- fs/autofs/root.c | 3 +- fs/autofs/symlink.c | 3 +- fs/buffer.c | 4 +- fs/coda/dir.c | 3 +- fs/coda/file.c | 6 +- fs/coda/pioctl.c | 4 +- fs/coda/symlink.c | 4 +- fs/devices.c | 7 +- fs/devpts/root.c | 3 +- fs/efs/dir.c | 6 +- fs/efs/file.c | 8 +- fs/efs/symlink.c | 6 +- fs/fat/file.c | 22 ++-- fs/hfs/dir_cap.c | 18 ++-- fs/hfs/dir_dbl.c | 6 +- fs/hfs/dir_nat.c | 6 +- fs/hfs/file.c | 5 +- fs/hfs/file_cap.c | 3 +- fs/hfs/file_hdr.c | 5 +- fs/hpfs/inode.c | 11 +- fs/isofs/dir.c | 7 +- fs/isofs/file.c | 4 +- fs/isofs/symlink.c | 7 +- fs/minix/dir.c | 7 +- fs/minix/file.c | 42 ++------ fs/minix/symlink.c | 7 +- fs/msdos/namei.c | 3 +- fs/ncpfs/dir.c | 3 +- fs/ncpfs/file.c | 9 +- fs/ncpfs/symlink.c | 6 +- fs/ntfs/fs.c | 11 +- fs/proc/openpromfs.c | 21 ++-- fs/qnx4/dir.c | 6 +- fs/qnx4/file.c | 6 +- fs/qnx4/symlinks.c | 7 +- fs/romfs/inode.c | 131 +++++++++++++---------- fs/smbfs/dir.c | 3 +- fs/smbfs/file.c | 3 +- fs/sysv/dir.c | 7 +- fs/sysv/file.c | 39 ++----- fs/sysv/symlink.c | 7 +- fs/ufs/dir.c | 4 +- fs/ufs/file.c | 45 +++----- fs/ufs/symlink.c | 6 +- fs/umsdos/dir.c | 5 +- fs/umsdos/file.c | 16 ++- fs/umsdos/symlink.c | 5 +- fs/vfat/namei.c | 7 +- 66 files changed, 386 insertions(+), 306 deletions(-) diff --git a/Makefile b/Makefile index 2c0238637eb6..2a8ea477cb16 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 3 -SUBLEVEL = 8 +SUBLEVEL = 9 EXTRAVERSION = ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) diff --git a/arch/i386/kernel/mca.c b/arch/i386/kernel/mca.c index ae1980a42b92..571075d26f34 100644 --- a/arch/i386/kernel/mca.c +++ b/arch/i386/kernel/mca.c @@ -142,9 +142,10 @@ static struct inode_operations proc_mca_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/arch/i386/kernel/mtrr.c b/arch/i386/kernel/mtrr.c index 0d6c177919c9..0399caa79e12 100644 --- a/arch/i386/kernel/mtrr.c +++ b/arch/i386/kernel/mtrr.c @@ -1459,11 +1459,14 @@ static struct inode_operations proc_mtrr_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static struct proc_dir_entry proc_root_mtrr = { diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c index 30123c07653c..eba3f185431d 100644 --- a/arch/ppc/kernel/ppc_htab.c +++ b/arch/ppc/kernel/ppc_htab.c @@ -74,11 +74,14 @@ struct inode_operations proc_ppc_htab_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; /* these will go into processor.h when I'm done debugging -- Cort */ diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c index e852ca8f8227..7d638c5da33a 100644 --- a/arch/sparc64/kernel/binfmt_aout32.c +++ b/arch/sparc64/kernel/binfmt_aout32.c @@ -55,8 +55,15 @@ static void set_brk(unsigned long start, unsigned long end) * These are the only things you should do on a core-file: use only these * macros to write out all the necessary info. */ -#define DUMP_WRITE(addr,nr) \ -while (file->f_op->write(file,(char *)(addr),(nr),&file->f_pos) != (nr)) goto close_coredump + +static int dump_write(struct file *file, const void *addr, int nr) +{ + return file->f_op->write(file, addr, nr, &file->f_pos) == nr; +} + +#define DUMP_WRITE(addr, nr) \ + if (!dump_write(file, (void *)(addr), (nr))) \ + goto close_coredump; #define DUMP_SEEK(offset) \ if (file->f_op->llseek) { \ diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index 79ce3db45b63..a4d6c7116bde 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c @@ -855,17 +855,15 @@ asmlinkage long sys32_readv(int fd, struct iovec32 *vector, u32 count) long ret = -EBADF; lock_kernel(); + file = fget(fd); if(!file) goto bad_file; - if(!(file->f_mode & 1)) - goto out; - - ret = do_readv_writev32(VERIFY_WRITE, file, - vector, count); -out: + if (file->f_op && file->f_op->read && (file->f_mode & FMODE_READ)) + ret = do_readv_writev32(VERIFY_WRITE, file, vector, count); fput(file); + bad_file: unlock_kernel(); return ret; @@ -877,19 +875,14 @@ asmlinkage long sys32_writev(int fd, struct iovec32 *vector, u32 count) int ret = -EBADF; lock_kernel(); + file = fget(fd); if(!file) goto bad_file; - - if(!(file->f_mode & 2)) - goto out; - - down(&file->f_dentry->d_inode->i_sem); - ret = do_readv_writev32(VERIFY_READ, file, - vector, count); - up(&file->f_dentry->d_inode->i_sem); -out: + if (file->f_op && file->f_op->write && (file->f_mode & FMODE_WRITE)) + ret = do_readv_writev32(VERIFY_READ, file, vector, count); fput(file); + bad_file: unlock_kernel(); return ret; diff --git a/drivers/ap1000/ringbuf.c b/drivers/ap1000/ringbuf.c index ebce30e83ead..0efffa1de164 100644 --- a/drivers/ap1000/ringbuf.c +++ b/drivers/ap1000/ringbuf.c @@ -318,9 +318,12 @@ struct inode_operations proc_ringbuf_inode_operations = { NULL, /* mknod */ NULL, /* rename */ NULL, /* readlink */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 021d7a052d5a..8485d4d4cc6b 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -322,8 +322,6 @@ void add_request(struct blk_dev_struct * dev, struct request * req) spin_lock_irqsave(&io_request_lock,flags); current_request = get_queue(req->rq_dev); - if (req->bh) - mark_buffer_clean(req->bh); if (!(tmp = *current_request)) { *current_request = req; if (dev->current_request != &dev->plug) @@ -425,9 +423,13 @@ void make_request(int major,int rw, struct buffer_head * bh) rw_ahead = 1; rw = WRITE; /* drop into WRITE */ case WRITE: - if (!buffer_dirty(bh)) /* Hmmph! Nothing to write */ - goto end_io; - /* We don't allow the write-requests to fill up the + if (!test_and_clear_bit(BH_Dirty, &bh->b_state)) + goto end_io; /* Hmmph! Nothing to write */ + lock_kernel(); + refile_buffer(bh); + unlock_kernel(); + /* + * We don't allow the write-requests to fill up the * queue completely: we want some room for reads, * as they take precedence. The last third of the * requests are only for reads. @@ -528,7 +530,6 @@ void make_request(int major,int rw, struct buffer_head * bh) } else continue; - mark_buffer_clean(bh); spin_unlock_irqrestore(&io_request_lock,flags); return; diff --git a/drivers/char/ftape/lowlevel/ftape-proc.c b/drivers/char/ftape/lowlevel/ftape-proc.c index ee21d92d405a..80ec703511c7 100644 --- a/drivers/char/ftape/lowlevel/ftape-proc.c +++ b/drivers/char/ftape/lowlevel/ftape-proc.c @@ -112,11 +112,14 @@ static struct inode_operations ftape_proc_inode_operations = NULL, /* mknod */ NULL, /* rename */ NULL, /* readlink */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ + NULL, /* smap */ + NULL, /* revalidate */ }; /* diff --git a/drivers/char/serial.c b/drivers/char/serial.c index 7a3d4b5bcb88..487c0cb3933b 100644 --- a/drivers/char/serial.c +++ b/drivers/char/serial.c @@ -103,7 +103,8 @@ #define RS_STROBE_TIME (10*HZ) #define RS_ISR_PASS_LIMIT 256 -#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) +#define IRQ_T(state) \ + ((state->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) #define SERIAL_INLINE @@ -1003,7 +1004,7 @@ static int startup(struct async_struct * info) } else handler = rs_interrupt_single; - retval = request_irq(state->irq, handler, IRQ_T(info), + retval = request_irq(state->irq, handler, IRQ_T(state), "serial", NULL); if (retval) { if (capable(CAP_SYS_ADMIN)) { @@ -1168,7 +1169,7 @@ static void shutdown(struct async_struct * info) if (IRQ_ports[state->irq]) { free_irq(state->irq, NULL); retval = request_irq(state->irq, rs_interrupt_single, - IRQ_T(info), "serial", NULL); + IRQ_T(state), "serial", NULL); if (retval) printk("serial shutdown: request_irq: error %d" @@ -2017,7 +2018,7 @@ static int set_multiport_struct(struct async_struct * info, else handler = rs_interrupt; - retval = request_irq(state->irq, handler, IRQ_T(info), + retval = request_irq(state->irq, handler, IRQ_T(state), "serial", NULL); if (retval) { printk("Couldn't reallocate serial interrupt " diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index d1a78fe53feb..75b637786524 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c @@ -222,11 +222,14 @@ static struct inode_operations proc_bus_pci_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; int diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index b208392a9ce4..e7e151405513 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c @@ -89,11 +89,14 @@ static struct inode_operations proc_bus_zorro_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; int diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index 738bb40b896a..25a0eb4b4ddc 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c @@ -51,12 +51,14 @@ struct inode_operations adfs_dir_inode_operations = { NULL, /* rename */ NULL, /* read link */ NULL, /* follow link */ + NULL, /* bmap */ NULL, /* read page */ NULL, /* write page */ - NULL, /* bmap */ + NULL, /* flush page */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; unsigned int adfs_val (unsigned char *p, int len) diff --git a/fs/adfs/file.c b/fs/adfs/file.c index a886c68cee48..3963de876c15 100644 --- a/fs/adfs/file.c +++ b/fs/adfs/file.c @@ -61,10 +61,12 @@ struct inode_operations adfs_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - NULL, /* writepage */ adfs_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/fs/affs/dir.c b/fs/affs/dir.c index ee08ff451990..206cc1ec8572 100644 --- a/fs/affs/dir.c +++ b/fs/affs/dir.c @@ -57,9 +57,10 @@ struct inode_operations affs_dir_inode_operations = { affs_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permissions */ NULL, /* smap */ diff --git a/fs/affs/file.c b/fs/affs/file.c index bb1ce69c85d4..8dbb341a0103 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -74,9 +74,10 @@ struct inode_operations affs_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - NULL, /* writepage */ affs_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ affs_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ @@ -114,9 +115,10 @@ struct inode_operations affs_file_inode_operations_ofs = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ affs_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c index c3da66d4094b..9ab825b7f242 100644 --- a/fs/affs/symlink.c +++ b/fs/affs/symlink.c @@ -35,12 +35,14 @@ struct inode_operations affs_symlink_inode_operations = { NULL, /* rename */ affs_readlink, /* readlink */ affs_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; static int diff --git a/fs/autofs/dir.c b/fs/autofs/dir.c index f6ccf8419977..1ab083390913 100644 --- a/fs/autofs/dir.c +++ b/fs/autofs/dir.c @@ -73,9 +73,10 @@ struct inode_operations autofs_dir_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 011e3286f956..ab574e0fabad 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -54,9 +54,10 @@ struct inode_operations autofs_root_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/autofs/symlink.c b/fs/autofs/symlink.c index 0e46db365480..545b0f5f797e 100644 --- a/fs/autofs/symlink.c +++ b/fs/autofs/symlink.c @@ -49,9 +49,10 @@ struct inode_operations autofs_symlink_inode_operations = { NULL, /* rename */ autofs_readlink, /* readlink */ autofs_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/buffer.c b/fs/buffer.c index 9ffb8556a28c..dec22a3560e1 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1539,9 +1539,11 @@ int block_write_partial_page (struct file *file, struct page *page, unsigned lon * lots of dirty pages. */ if (!test_and_set_bit(BH_Dirty, &bh->b_state)) { - __atomic_mark_buffer_dirty(bh, bdf_prm.b_un.age_buffer); + lock_kernel(); + __mark_dirty(bh, 0); if (too_many_dirty_buffers) balance_dirty(bh->b_dev); + unlock_kernel(); } skip: diff --git a/fs/coda/dir.c b/fs/coda/dir.c index b3c0195a3bea..a535eabd7c8e 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -77,9 +77,10 @@ struct inode_operations coda_dir_inode_operations = coda_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ coda_permission, /* permission */ NULL, /* smap */ diff --git a/fs/coda/file.c b/fs/coda/file.c index cbc81542f531..000d441ae605 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c @@ -47,13 +47,13 @@ struct inode_operations coda_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ coda_readpage, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ coda_permission, /* permission */ NULL, /* smap */ - NULL, /* update page */ coda_revalidate_inode /* revalidate */ }; @@ -101,7 +101,7 @@ static int coda_readpage(struct file * coda_file, struct page * page) CDEBUG(D_INODE, "coda ino: %ld, cached ino %ld, page offset: %lx\n", coda_inode->i_ino, cii->c_ovp->i_ino, page->offset); - generic_readpage(&cont_file, page); + block_read_full_page(&cont_file, page); EXIT; return 0; } diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index 4a98361aa71c..ac0e704fb76b 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c @@ -46,13 +46,13 @@ struct inode_operations coda_ioctl_inode_operations = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ coda_ioctl_permission, /* permission */ NULL, /* smap */ - NULL, /* update page */ NULL /* revalidate */ }; diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c index b42555811e49..9d2f1e55ebf9 100644 --- a/fs/coda/symlink.c +++ b/fs/coda/symlink.c @@ -42,13 +42,13 @@ struct inode_operations coda_symlink_inode_operations = { NULL, /* rename */ coda_readlink, /* readlink */ coda_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ - NULL, /* update page */ NULL /* revalidate */ }; diff --git a/fs/devices.c b/fs/devices.c index 934fe290fd4a..fce05e09fdfd 100644 --- a/fs/devices.c +++ b/fs/devices.c @@ -333,11 +333,14 @@ struct inode_operations chrdev_inode_operations = { NULL, /* mknod */ NULL, /* rename */ NULL, /* readlink */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; /* diff --git a/fs/devpts/root.c b/fs/devpts/root.c index c1c1a600005b..cddac24c9010 100644 --- a/fs/devpts/root.c +++ b/fs/devpts/root.c @@ -51,9 +51,10 @@ struct inode_operations devpts_root_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/efs/dir.c b/fs/efs/dir.c index ea484dab4790..84a141b67bea 100644 --- a/fs/efs/dir.c +++ b/fs/efs/dir.c @@ -38,12 +38,14 @@ struct inode_operations efs_dir_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + efs_bmap, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - efs_bmap, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) { diff --git a/fs/efs/file.c b/fs/efs/file.c index d97a420c5539..8aa91f29c525 100644 --- a/fs/efs/file.c +++ b/fs/efs/file.c @@ -38,12 +38,14 @@ struct inode_operations efs_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - NULL, /* writepage */ efs_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; int efs_bmap(struct inode *inode, efs_block_t block) { diff --git a/fs/efs/symlink.c b/fs/efs/symlink.c index 705599eb0566..ac54f60344a0 100644 --- a/fs/efs/symlink.c +++ b/fs/efs/symlink.c @@ -26,12 +26,14 @@ struct inode_operations efs_symlink_inode_operations = { NULL, /* rename */ efs_readlink, /* readlink */ efs_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; static char *efs_linktarget(struct inode *in, int *len) { diff --git a/fs/fat/file.c b/fs/fat/file.c index 7c95181819f6..94ea36adfa4e 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c @@ -57,12 +57,14 @@ struct inode_operations fat_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - NULL, /* writepage */ fat_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ fat_truncate, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; /* #Specification: msdos / special devices / mmap @@ -107,12 +109,14 @@ struct inode_operations fat_file_inode_operations_1024 = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - NULL, /* writepage */ NULL, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ fat_truncate, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; static struct file_operations fat_file_operations_readpage = { @@ -142,12 +146,14 @@ struct inode_operations fat_file_inode_operations_readpage = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ fat_readpage, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ fat_truncate, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; #define MSDOS_PREFETCH 32 diff --git a/fs/hfs/dir_cap.c b/fs/hfs/dir_cap.c index 189b0107e154..a60b057cae98 100644 --- a/fs/hfs/dir_cap.c +++ b/fs/hfs/dir_cap.c @@ -87,12 +87,14 @@ struct inode_operations hfs_cap_ndir_inode_operations = { hfs_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; struct inode_operations hfs_cap_fdir_inode_operations = { @@ -108,12 +110,14 @@ struct inode_operations hfs_cap_fdir_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; struct inode_operations hfs_cap_rdir_inode_operations = { @@ -129,12 +133,14 @@ struct inode_operations hfs_cap_rdir_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; /*================ File-local functions ================*/ diff --git a/fs/hfs/dir_dbl.c b/fs/hfs/dir_dbl.c index 17e53798a763..20c418c1a937 100644 --- a/fs/hfs/dir_dbl.c +++ b/fs/hfs/dir_dbl.c @@ -86,12 +86,14 @@ struct inode_operations hfs_dbl_dir_inode_operations = { dbl_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/fs/hfs/dir_nat.c b/fs/hfs/dir_nat.c index 21d4ca9afdee..94292cd5d63b 100644 --- a/fs/hfs/dir_nat.c +++ b/fs/hfs/dir_nat.c @@ -93,9 +93,10 @@ struct inode_operations hfs_nat_ndir_inode_operations = { hfs_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ @@ -115,9 +116,10 @@ struct inode_operations hfs_nat_hdir_inode_operations = { nat_hdr_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/hfs/file.c b/fs/hfs/file.c index d3796e275a73..0ef1bd34c6b0 100644 --- a/fs/hfs/file.c +++ b/fs/hfs/file.c @@ -63,9 +63,10 @@ struct inode_operations hfs_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - NULL, /* writepage */ hfs_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ hfs_file_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/hfs/file_cap.c b/fs/hfs/file_cap.c index 789073d196d7..040369fd586b 100644 --- a/fs/hfs/file_cap.c +++ b/fs/hfs/file_cap.c @@ -77,9 +77,10 @@ struct inode_operations hfs_cap_info_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap - none */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap - none */ + NULL, /* flushpage */ cap_info_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/hfs/file_hdr.c b/fs/hfs/file_hdr.c index d112b34981b0..e262136bb671 100644 --- a/fs/hfs/file_hdr.c +++ b/fs/hfs/file_hdr.c @@ -78,10 +78,11 @@ struct inode_operations hfs_hdr_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - NULL, /* readpage */ - NULL, /* writepage */ NULL, /* bmap - XXX: not available since header part has no disk block */ + NULL, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ hdr_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 17984d667e3d..111b416d9204 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c @@ -41,10 +41,11 @@ static const struct inode_operations hpfs_file_iops = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - NULL, /* writepage */ (int (*)(struct inode *, int)) &hpfs_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ &hpfs_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ @@ -84,9 +85,10 @@ static const struct inode_operations hpfs_dir_iops = hpfs_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ @@ -107,9 +109,10 @@ const struct inode_operations hpfs_symlink_iops = NULL, /* rename */ hpfs_readlink, /* readlink */ hpfs_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index 23ca159c75a2..6085fc6b3cce 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c @@ -57,11 +57,14 @@ struct inode_operations isofs_dir_inode_operations = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static int isofs_name_translate(char * old, int len, char * new) diff --git a/fs/isofs/file.c b/fs/isofs/file.c index ce85b367a765..d0bfa299ecaa 100644 --- a/fs/isofs/file.c +++ b/fs/isofs/file.c @@ -53,5 +53,7 @@ struct inode_operations isofs_file_inode_operations = { NULL, /* writepage */ NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/fs/isofs/symlink.c b/fs/isofs/symlink.c index 5de4a8748399..e5fc7fcbd896 100644 --- a/fs/isofs/symlink.c +++ b/fs/isofs/symlink.c @@ -38,11 +38,14 @@ struct inode_operations isofs_symlink_inode_operations = { NULL, /* rename */ isofs_readlink, /* readlink */ isofs_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static int isofs_readlink(struct dentry * dentry, char * buffer, int buflen) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 187925903b5a..532215faf942 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -52,11 +52,14 @@ struct inode_operations minix_dir_inode_operations = { minix_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static int minix_readdir(struct file * filp, diff --git a/fs/minix/file.c b/fs/minix/file.c index d6b7ecb17d9e..1f2758a20db1 100644 --- a/fs/minix/file.c +++ b/fs/minix/file.c @@ -29,39 +29,12 @@ static int minix_writepage(struct file *file, struct page *page) { - struct dentry *dentry = file->f_dentry; - struct inode *inode = dentry->d_inode; - unsigned long block; - int *p, nr[PAGE_SIZE/BLOCK_SIZE]; - int i, err, created; - struct buffer_head *bh; - - i = PAGE_SIZE / BLOCK_SIZE; - block = page->offset / BLOCK_SIZE; - p = nr; - bh = page->buffers; - do { - if (bh && bh->b_blocknr) - *p = bh->b_blocknr; - else - *p = minix_getblk_block(inode, block, 1, &err, &created); - if (!*p) - return -EIO; - i--; - block++; - p++; - if (bh) - bh = bh->b_this_page; - } while(i > 0); - - /* IO start */ - brw_page(WRITE, page, inode->i_dev, nr, BLOCK_SIZE, 1); - return 0; + return block_write_full_page(file, page, minix_getblk_block); } static long minix_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char *buf) { - return block_write_one_page(file, page, offset, bytes, buf, minix_getblk_block); + return block_write_partial_page(file, page, offset, bytes, buf, minix_getblk_block); } /* @@ -88,7 +61,10 @@ static struct file_operations minix_file_operations = { NULL, /* no special open is needed */ NULL, /* flush */ NULL, /* release */ - minix_sync_file /* fsync */ + minix_sync_file, /* fsync */ + NULL, /* fasync */ + NULL, /* check_media_change */ + NULL /* revalidate */ }; struct inode_operations minix_file_inode_operations = { @@ -104,12 +80,12 @@ struct inode_operations minix_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - minix_writepage, /* writepage */ minix_bmap, /* bmap */ + block_read_full_page, /* readpage */ + minix_writepage, /* writepage */ + block_flushpage, /* flushpage */ minix_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ NULL, /* revalidate */ - block_flushpage, /* flushpage */ }; diff --git a/fs/minix/symlink.c b/fs/minix/symlink.c index 4f3661105c54..a46ba219e436 100644 --- a/fs/minix/symlink.c +++ b/fs/minix/symlink.c @@ -33,11 +33,14 @@ struct inode_operations minix_symlink_inode_operations = { NULL, /* rename */ minix_readlink, /* readlink */ minix_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static struct dentry * minix_follow_link(struct dentry * dentry, diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c index 8175724d7b38..6000b0f6f4b5 100644 --- a/fs/msdos/namei.c +++ b/fs/msdos/namei.c @@ -627,9 +627,10 @@ struct inode_operations msdos_dir_inode_operations = { msdos_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 680f011a149e..d22487002af2 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c @@ -92,9 +92,10 @@ struct inode_operations ncp_dir_inode_operations = ncp_rename, /* rename */ NULL, /* readlink */ NULL, /* follow link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index bb61e2464b9a..916567597392 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c @@ -295,6 +295,13 @@ struct inode_operations ncp_file_inode_operations = NULL, /* mknod */ NULL, /* rename */ NULL, /* readlink */ + NULL, /* follow_link */ NULL, /* bmap */ - NULL /* truncate */ + NULL, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ + NULL, /* truncate */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c index a923c218c927..ec56f0e678e0 100644 --- a/fs/ncpfs/symlink.c +++ b/fs/ncpfs/symlink.c @@ -59,12 +59,14 @@ struct inode_operations ncp_symlink_inode_operations={ NULL, /* rename */ ncp_readlink, /* readlink */ ncp_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; /* ----- follow a symbolic link ------------------------------------------ */ diff --git a/fs/ntfs/fs.c b/fs/ntfs/fs.c index d9430c2cca36..0a63da2c110b 100644 --- a/fs/ntfs/fs.c +++ b/fs/ntfs/fs.c @@ -439,9 +439,10 @@ static struct inode_operations ntfs_inode_operations_nobmap = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ @@ -621,9 +622,10 @@ static struct inode_operations ntfs_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, - NULL, /* writepage */ ntfs_bmap, + block_read_full_page, + NULL, /* writepage */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ @@ -669,9 +671,10 @@ static struct inode_operations ntfs_dir_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/proc/openpromfs.c b/fs/proc/openpromfs.c index dcb007f11cad..ea81bd6f2f90 100644 --- a/fs/proc/openpromfs.c +++ b/fs/proc/openpromfs.c @@ -577,11 +577,14 @@ static struct inode_operations openpromfs_prop_inode_ops = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static struct file_operations openpromfs_nodenum_ops = { @@ -611,11 +614,14 @@ static struct inode_operations openpromfs_nodenum_inode_ops = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static struct file_operations openprom_alias_operations = { @@ -645,11 +651,14 @@ static struct inode_operations openprom_alias_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static int lookup_children(u16 n, const char * name, int len) diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c index 029fd9061b13..ddf8ff0360c7 100644 --- a/fs/qnx4/dir.c +++ b/fs/qnx4/dir.c @@ -114,10 +114,12 @@ struct inode_operations qnx4_dir_inode_operations = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/fs/qnx4/file.c b/fs/qnx4/file.c index ab923b7f0746..dafe212f1062 100644 --- a/fs/qnx4/file.c +++ b/fs/qnx4/file.c @@ -189,16 +189,18 @@ struct inode_operations qnx4_file_inode_operations = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + qnx4_bmap, /* bmap */ qnx4_readpage, /* readpage */ NULL, /* writepage */ - qnx4_bmap, /* bmap */ + NULL, /* flushpage */ #ifdef CONFIG_QNX4FS_RW qnx4_truncate, /* truncate */ #else NULL, #endif NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; static int qnx4_readpage(struct file *file, struct page *page) diff --git a/fs/qnx4/symlinks.c b/fs/qnx4/symlinks.c index 457258670987..7fedc276092d 100644 --- a/fs/qnx4/symlinks.c +++ b/fs/qnx4/symlinks.c @@ -43,11 +43,14 @@ struct inode_operations qnx4_symlink_inode_operations = NULL, /* rename */ qnx4_readlink, /* readlink */ qnx4_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static struct dentry *qnx4_follow_link(struct dentry *dentry, diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c index d35b0d130a01..abb55b762467 100644 --- a/fs/romfs/inode.c +++ b/fs/romfs/inode.c @@ -1,7 +1,7 @@ /* * ROMFS file system, Linux implementation * - * Copyright (C) 1997 Janos Farkas + * Copyright (C) 1997-1999 Janos Farkas * * Using parts of the minix filesystem * Copyright (C) 1991, 1992 Linus Torvalds @@ -57,6 +57,7 @@ #include #include #include +#include #include @@ -320,7 +321,7 @@ romfs_lookup(struct inode *dir, struct dentry *dentry) const char *name; /* got from dentry */ int len; - res = 0; /* instead of ENOENT */ + res = -EACCES; /* placeholder for "no data here" */ offset = dir->i_ino & ROMFH_MASK; if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0) goto out; @@ -335,8 +336,9 @@ romfs_lookup(struct inode *dir, struct dentry *dentry) len = dentry->d_name.len; for(;;) { - if (!offset || offset >= maxoff - || romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0) + if (!offset || offset >= maxoff) + goto out0; + if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0) goto out; /* try to match the first 16 bytes of name */ @@ -365,19 +367,28 @@ romfs_lookup(struct inode *dir, struct dentry *dentry) if ((ntohl(ri.next) & ROMFH_TYPE) == ROMFH_HRD) offset = ntohl(ri.spec) & ROMFH_MASK; - if ((inode = iget(dir->i_sb, offset))==NULL) { - res = -EACCES; - } else { - d_add(dentry, inode); - } + if ((inode = iget(dir->i_sb, offset))) + goto outi; -out: - return ERR_PTR(res); + /* + * it's a bit funky, _lookup needs to return an error code + * (negative) or a NULL, both as a dentry. ENOENT should not + * be returned, instead we need to create a negative dentry by + * d_add(dentry, NULL); and return 0 as no error. + * (Although as I see, it only matters on writable file + * systems). + */ + +out0: inode = NULL; +outi: res = 0; + d_add (dentry, inode); + +out: return ERR_PTR(res); } /* * Ok, we do readpage, to be able to execute programs. Unfortunately, - * we can't use bmap, since we have looser alignments. + * we can't use bmap, since we may have looser alignments. */ static int @@ -389,12 +400,13 @@ romfs_readpage(struct file * file, struct page * page) unsigned long offset, avail, readlen; int result = -EIO; - atomic_inc(&page->count); - set_bit(PG_locked, &page->flags); - + lock_kernel(); + get_page(page); buf = page_address(page); - clear_bit(PG_uptodate, &page->flags); - clear_bit(PG_error, &page->flags); + + /* hack? */ + page->owner = (int)current; + offset = page->offset; if (offset < inode->i_size) { avail = inode->i_size-offset; @@ -403,18 +415,19 @@ romfs_readpage(struct file * file, struct page * page) if (readlen < PAGE_SIZE) { memset((void *)(buf+readlen),0,PAGE_SIZE-readlen); } - set_bit(PG_uptodate, &page->flags); + SetPageUptodate(page); result = 0; } } if (result) { - set_bit(PG_error, &page->flags); memset((void *)buf, 0, PAGE_SIZE); + SetPageError(page); } - clear_bit(PG_locked, &page->flags); - wake_up(&page->wait); + UnlockPage(page); + free_page(buf); + unlock_kernel(); return result; } @@ -508,12 +521,14 @@ static struct inode_operations romfs_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap -- not really */ romfs_readpage, /* readpage */ NULL, /* writepage */ - NULL, /* bmap -- not really */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL /* revalidate */ }; static struct file_operations romfs_dir_operations = { @@ -550,12 +565,14 @@ static struct inode_operations romfs_dir_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL /* revalidate */ }; static struct inode_operations romfs_link_inode_operations = { @@ -571,18 +588,20 @@ static struct inode_operations romfs_link_inode_operations = { NULL, /* rename */ romfs_readlink, /* readlink */ romfs_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL /* revalidate */ }; static mode_t romfs_modemap[] = { - 0, S_IFDIR, S_IFREG, S_IFLNK+0777, - S_IFBLK, S_IFCHR, S_IFSOCK, S_IFIFO + 0, S_IFDIR+0644, S_IFREG+0644, S_IFLNK+0777, + S_IFBLK+0600, S_IFCHR+0600, S_IFSOCK+0644, S_IFIFO+0644 }; static struct inode_operations *romfs_inoops[] = @@ -591,10 +610,10 @@ static struct inode_operations *romfs_inoops[] = &romfs_dir_inode_operations, &romfs_file_inode_operations, &romfs_link_inode_operations, - &blkdev_inode_operations, /* standard handlers */ - &chrdev_inode_operations, - NULL, /* socket */ - NULL, /* fifo */ + NULL, /* device/fifo/socket nodes, */ + NULL, /* set by init_special_inode */ + NULL, + NULL, }; static void @@ -627,34 +646,30 @@ romfs_read_inode(struct inode *i) i->i_mtime = i->i_atime = i->i_ctime = 0; i->i_uid = i->i_gid = 0; - i->i_op = romfs_inoops[nextfh & ROMFH_TYPE]; - - /* Precalculate the data offset */ - ino = romfs_strnlen(i, ino+ROMFH_SIZE, ROMFS_MAXFN); - if (ino >= 0) - ino = ((ROMFH_SIZE+ino+1+ROMFH_PAD)&ROMFH_MASK); - else - ino = 0; - - i->u.romfs_i.i_metasize = ino; - i->u.romfs_i.i_dataoffset = ino+(i->i_ino&ROMFH_MASK); - - /* Compute permissions */ - ino = S_IRUGO|S_IWUSR; - ino |= romfs_modemap[nextfh & ROMFH_TYPE]; - if (nextfh & ROMFH_EXEC) { - ino |= S_IXUGO; - } - i->i_mode = ino; - - if (S_ISFIFO(ino)) - init_fifo(i); - else if (S_ISDIR(ino)) - i->i_size = i->u.romfs_i.i_metasize; - else if (S_ISBLK(ino) || S_ISCHR(ino)) { - i->i_mode &= ~(S_IRWXG|S_IRWXO); - ino = ntohl(ri.spec); - i->i_rdev = MKDEV(ino>>16,ino&0xffff); + /* Precalculate the data offset */ + ino = romfs_strnlen(i, ino+ROMFH_SIZE, ROMFS_MAXFN); + if (ino >= 0) + ino = ((ROMFH_SIZE+ino+1+ROMFH_PAD)&ROMFH_MASK); + else + ino = 0; + + i->u.romfs_i.i_metasize = ino; + i->u.romfs_i.i_dataoffset = ino+(i->i_ino&ROMFH_MASK); + + /* Compute permissions */ + ino = romfs_modemap[nextfh & ROMFH_TYPE]; + /* only "normal" files have ops */ + if ((i->i_op = romfs_inoops[nextfh & ROMFH_TYPE])) { + if (nextfh & ROMFH_EXEC) + ino |= S_IXUGO; + i->i_mode = ino; + if (S_ISDIR(ino)) + i->i_size = i->u.romfs_i.i_metasize; + } else { + /* depending on MBZ for sock/fifos */ + nextfh = ntohl(ri.spec); + nextfh = kdev_t_to_nr(MKDEV(nextfh>>16,nextfh&0xffff)); + init_special_inode(i, ino, nextfh); } } diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c index 870ebac74cf8..d945be585528 100644 --- a/fs/smbfs/dir.c +++ b/fs/smbfs/dir.c @@ -59,9 +59,10 @@ struct inode_operations smb_dir_inode_operations = smb_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index cfb2d82da9bd..802012a3b9b0 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c @@ -404,9 +404,10 @@ struct inode_operations smb_file_inode_operations = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ smb_readpage, /* readpage */ smb_writepage, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ smb_file_permission, /* permission */ NULL, /* smap */ diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index a28a7ba8e9ae..93920fe0f2ed 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c @@ -59,11 +59,14 @@ struct inode_operations sysv_dir_inode_operations = { sysv_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir) diff --git a/fs/sysv/file.c b/fs/sysv/file.c index 19443f2890c4..1c0ae0b6a4da 100644 --- a/fs/sysv/file.c +++ b/fs/sysv/file.c @@ -35,39 +35,12 @@ static int sysv_writepage (struct file * file, struct page * page) { - struct dentry *dentry = file->f_dentry; - struct inode *inode = dentry->d_inode; - unsigned long block; - int *p, nr[PAGE_SIZE/512]; - int i, err, created; - struct buffer_head *bh; - - i = PAGE_SIZE >> inode->i_sb->sv_block_size_bits; - block = page->offset >> inode->i_sb->sv_block_size_bits; - p = nr; - bh = page->buffers; - do { - if (bh && bh->b_blocknr) - *p = bh->b_blocknr; - else - *p = sysv_getblk_block (inode, block, 1, &err, &created); - if (!*p) - return -EIO; - i--; - block++; - p++; - if (bh) - bh = bh->b_this_page; - } while (i > 0); - - /* IO start */ - brw_page(WRITE, page, inode->i_dev, nr, inode->i_sb->sv_block_size, 1); - return 0; + return block_write_full_page(file, page, sysv_getblk_block); } static long sysv_write_one_page (struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf) { - return block_write_one_page(file, page, offset, bytes, buf, sysv_getblk_block); + return block_write_partial_page(file, page, offset, bytes, buf, sysv_getblk_block); } /* @@ -113,12 +86,12 @@ struct inode_operations sysv_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - sysv_writepage, /* writepage */ sysv_bmap, /* bmap */ + block_read_full_page, /* readpage */ + sysv_writepage, /* writepage */ + block_flushpage, /* flushpage */ sysv_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ - NULL, /* revalidate */ - block_flushpage, /* flushpage */ + NULL /* revalidate */ }; diff --git a/fs/sysv/symlink.c b/fs/sysv/symlink.c index 5ebaec7ccc2a..2e793aaa0155 100644 --- a/fs/sysv/symlink.c +++ b/fs/sysv/symlink.c @@ -39,11 +39,14 @@ struct inode_operations sysv_symlink_inode_operations = { NULL, /* rename */ sysv_readlink, /* readlink */ sysv_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; static struct dentry *sysv_follow_link(struct dentry * dentry, diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 6a79c4a5e96f..abf6765d79b2 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -209,10 +209,12 @@ struct inode_operations ufs_dir_inode_operations = { ufs_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ ufs_permission, /* permission */ NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/fs/ufs/file.c b/fs/ufs/file.c index 9e027cfc3734..0a1dd64ce2e6 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c @@ -89,38 +89,12 @@ static inline void remove_suid(struct inode *inode) static int ufs_writepage (struct file *file, struct page *page) { - struct dentry *dentry = file->f_dentry; - struct inode *inode = dentry->d_inode; - unsigned long block; - int *p, nr[PAGE_SIZE/512]; - int i, err, created; - struct buffer_head *bh; - - i = PAGE_SIZE >> inode->i_sb->s_blocksize_bits; - block = page->offset >> inode->i_sb->s_blocksize_bits; - p = nr; - bh = page->buffers; - do { - if (bh && bh->b_blocknr) - *p = bh->b_blocknr; - else - *p = ufs_getfrag_block(inode, block, 1, &err, &created); - if (!*p) - return -EIO; - i--; - block++; - p++; - if (bh) - bh = bh->b_this_page; - } while (i > 0); - - brw_page(WRITE, page, inode->i_dev, nr, inode->i_sb->s_blocksize, 1); - return 0; + return block_write_full_page(file, page, ufs_getfrag_block); } static long ufs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char *buf) { - return block_write_one_page(file, page, offset, bytes, buf, ufs_getfrag_block); + return block_write_partial_page(file, page, offset, bytes, buf, ufs_getfrag_block); } /* @@ -129,7 +103,14 @@ static long ufs_write_one_page(struct file *file, struct page *page, unsigned lo static ssize_t ufs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) { - return generic_file_write(file, buf, count, ppos, ufs_write_one_page); + ssize_t retval = generic_file_write(file, buf, count, ppos, ufs_write_one_page); + if (retval > 0) { + struct inode *inode = file->f_dentry->d_inode; + remove_suid(inode); + inode->i_ctime = inode->i_mtime = CURRENT_TIME; + mark_inode_dirty(inode); + } + return retval; } /* @@ -176,12 +157,12 @@ struct inode_operations ufs_file_inode_operations = { NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - ufs_writepage, /* writepage */ ufs_bmap, /* bmap */ + block_read_full_page, /* readpage */ + ufs_writepage, /* writepage */ + block_flushpage, /* flushpage */ ufs_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ NULL, /* revalidate */ - block_flushpage, /* flushpage */ }; diff --git a/fs/ufs/symlink.c b/fs/ufs/symlink.c index 39b54e05d552..cfebdf20d200 100644 --- a/fs/ufs/symlink.c +++ b/fs/ufs/symlink.c @@ -129,10 +129,12 @@ struct inode_operations ufs_symlink_inode_operations = { NULL, /* rename */ ufs_readlink, /* readlink */ ufs_follow_link, /* follow_link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/fs/umsdos/dir.c b/fs/umsdos/dir.c index 0f26103c47fc..51247073127a 100644 --- a/fs/umsdos/dir.c +++ b/fs/umsdos/dir.c @@ -832,9 +832,10 @@ struct inode_operations umsdos_dir_inode_operations = UMSDOS_rename, /* rename */ NULL, /* readlink */ NULL, /* followlink */ - generic_readpage, /* readpage */ - NULL, /* writepage */ fat_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/umsdos/file.c b/fs/umsdos/file.c index 339d828011f2..0d417facb3c7 100644 --- a/fs/umsdos/file.c +++ b/fs/umsdos/file.c @@ -99,12 +99,14 @@ struct inode_operations umsdos_file_inode_operations = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - generic_readpage, /* readpage */ - NULL, /* writepage */ fat_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ UMSDOS_truncate, /* truncate */ NULL, /* permission */ - fat_smap /* smap */ + fat_smap, /* smap */ + NULL /* revalidate */ }; /* For other with larger and unaligned file system */ @@ -137,12 +139,14 @@ struct inode_operations umsdos_file_inode_operations_no_bmap = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow link */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ UMSDOS_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL /* revalidate */ }; /* For other with larger and unaligned file system with readpage */ @@ -175,10 +179,12 @@ struct inode_operations umsdos_file_inode_operations_readpage = NULL, /* rename */ NULL, /* readlink */ NULL, /* follow link */ + NULL, /* bmap */ fat_readpage, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ UMSDOS_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL /* revalidate */ }; diff --git a/fs/umsdos/symlink.c b/fs/umsdos/symlink.c index 97ea2da411f7..0372eef2ae58 100644 --- a/fs/umsdos/symlink.c +++ b/fs/umsdos/symlink.c @@ -135,9 +135,10 @@ struct inode_operations umsdos_symlink_inode_operations = NULL, /* rename */ UMSDOS_readlink, /* readlink */ UMSDOS_followlink, /* followlink */ - generic_readpage, /* readpage */ - NULL, /* writepage */ fat_bmap, /* bmap */ + block_read_full_page, /* readpage */ + NULL, /* writepage */ + NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c index d372ead15536..5d5bcdd2d44c 100644 --- a/fs/vfat/namei.c +++ b/fs/vfat/namei.c @@ -1232,11 +1232,14 @@ struct inode_operations vfat_dir_inode_operations = { vfat_rename, /* rename */ NULL, /* readlink */ NULL, /* followlink */ + NULL, /* bmap */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* bmap */ + NULL, /* flushpage */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL /* revalidate */ }; struct super_block *vfat_read_super(struct super_block *sb,void *data, -- 2.39.5