diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-02-23 00:40:54 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-02-23 00:40:54 +0000 |
commit | 529c593ece216e4aaffd36bd940cb94f1fa63129 (patch) | |
tree | 78f1c0b805f5656aa7b0417a043c5346f700a2cf /fs/ext2 | |
parent | 0bd079751d25808d1972baee5c4eaa1db2227257 (diff) |
Merge with 2.3.43. I did ignore all modifications to the qlogicisp.c
driver due to the Origin A64 hacks.
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/dir.c | 24 | ||||
-rw-r--r-- | fs/ext2/file.c | 81 | ||||
-rw-r--r-- | fs/ext2/fsync.c | 5 | ||||
-rw-r--r-- | fs/ext2/inode.c | 44 | ||||
-rw-r--r-- | fs/ext2/namei.c | 4 | ||||
-rw-r--r-- | fs/ext2/symlink.c | 10 |
6 files changed, 58 insertions, 110 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index c97292620..1d45d3514 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c @@ -31,18 +31,10 @@ static ssize_t ext2_dir_read (struct file * filp, char * buf, static int ext2_readdir(struct file *, void *, filldir_t); static struct file_operations ext2_dir_operations = { - NULL, /* lseek - default */ - ext2_dir_read, /* read */ - NULL, /* write - bad */ - ext2_readdir, /* readdir */ - NULL, /* poll - default */ - ext2_ioctl, /* ioctl */ - NULL, /* mmap */ - NULL, /* no special open code */ - NULL, /* flush */ - NULL, /* no special release code */ - ext2_sync_file, /* fsync */ - NULL, /* fasync */ + read: ext2_dir_read, + readdir: ext2_readdir, + ioctl: ext2_ioctl, + fsync: ext2_sync_file, }; /* @@ -59,14 +51,6 @@ struct inode_operations ext2_dir_inode_operations = { ext2_rmdir, /* rmdir */ ext2_mknod, /* mknod */ ext2_rename, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* truncate */ - NULL, /* permission */ - NULL /* revalidate */ }; int ext2_check_dir_entry (const char * function, struct inode * dir, diff --git a/fs/ext2/file.c b/fs/ext2/file.c index df010f223..5c4639175 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -21,13 +21,6 @@ #include <linux/fs.h> #include <linux/sched.h> - - -#define NBUF 32 - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - static loff_t ext2_file_lseek(struct file *, loff_t, int); static int ext2_open_file (struct inode *, struct file *); @@ -73,40 +66,6 @@ static loff_t ext2_file_lseek( return offset; } -static inline void remove_suid(struct inode *inode) -{ - unsigned int mode; - - /* set S_IGID if S_IXGRP is set, and always set S_ISUID */ - mode = (inode->i_mode & S_IXGRP)*(S_ISGID/S_IXGRP) | S_ISUID; - - /* was any of the uid bits set? */ - mode &= inode->i_mode; - if (mode && !capable(CAP_FSETID)) { - inode->i_mode &= ~mode; - mark_inode_dirty(inode); - } -} - -/* - * Write to a file (through the page cache). - */ -static ssize_t -ext2_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) -{ - ssize_t retval; - - retval = generic_file_write(file, buf, count, - ppos, block_write_partial_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; -} - /* * Called when an inode is released. Note that this is different * from ext2_file_open: open gets called at every open, but release @@ -137,37 +96,17 @@ static int ext2_open_file (struct inode * inode, struct file * filp) * the ext2 filesystem. */ static struct file_operations ext2_file_operations = { - ext2_file_lseek, /* lseek */ - generic_file_read, /* read */ - ext2_file_write, /* write */ - NULL, /* readdir - bad */ - NULL, /* poll - default */ - ext2_ioctl, /* ioctl */ - generic_file_mmap, /* mmap */ - ext2_open_file, - NULL, /* flush */ - ext2_release_file, /* release */ - ext2_sync_file, /* fsync */ - NULL, /* fasync */ + llseek: ext2_file_lseek, + read: generic_file_read, + write: generic_file_write, + ioctl: ext2_ioctl, + mmap: generic_file_mmap, + open: ext2_open_file, + release: ext2_release_file, + fsync: ext2_sync_file, }; struct inode_operations ext2_file_inode_operations = { - &ext2_file_operations,/* default file operations */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - ext2_get_block, /* get_block */ - block_read_full_page, /* readpage */ - block_write_full_page, /* writepage */ - ext2_truncate, /* truncate */ - NULL, /* permission */ - NULL, /* revalidate */ + &ext2_file_operations, + truncate: ext2_truncate, }; diff --git a/fs/ext2/fsync.c b/fs/ext2/fsync.c index c29fef5ea..52ffd6138 100644 --- a/fs/ext2/fsync.c +++ b/fs/ext2/fsync.c @@ -24,8 +24,7 @@ #include <linux/fs.h> #include <linux/locks.h> - - +#include <linux/smp_lock.h> #define blocksize (EXT2_BLOCK_SIZE(inode->i_sb)) @@ -130,6 +129,7 @@ int ext2_sync_file(struct file * file, struct dentry *dentry) int wait, err = 0; struct inode *inode = dentry->d_inode; + lock_kernel(); if (S_ISLNK(inode->i_mode) && !(inode->i_blocks)) /* * Don't sync fast links! @@ -152,5 +152,6 @@ int ext2_sync_file(struct file * file, struct dentry *dentry) } skip: err |= ext2_sync_inode (inode); + unlock_kernel(); return err ? -EIO : 0; } diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index e92e4080a..ab7ac0a96 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -408,7 +408,7 @@ out: return result; } -int ext2_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) +static int ext2_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) { int ret, err, new; struct buffer_head *bh; @@ -610,6 +610,30 @@ struct buffer_head * ext2_bread (struct inode * inode, int block, return NULL; } +static int ext2_writepage(struct dentry *dentry, struct page *page) +{ + return block_write_full_page(page,ext2_get_block); +} +static int ext2_readpage(struct dentry *dentry, struct page *page) +{ + return block_read_full_page(page,ext2_get_block); +} +static int ext2_prepare_write(struct page *page, unsigned from, unsigned to) +{ + return block_prepare_write(page,from,to,ext2_get_block); +} +static int ext2_bmap(struct address_space *mapping, long block) +{ + return generic_block_bmap(mapping,block,ext2_get_block); +} +struct address_space_operations ext2_aops = { + readpage: ext2_readpage, + writepage: ext2_writepage, + prepare_write: ext2_prepare_write, + commit_write: generic_commit_write, + bmap: ext2_bmap +}; + void ext2_read_inode (struct inode * inode) { struct buffer_head * bh; @@ -719,15 +743,19 @@ void ext2_read_inode (struct inode * inode) if (inode->i_ino == EXT2_ACL_IDX_INO || inode->i_ino == EXT2_ACL_DATA_INO) /* Nothing to do */ ; - else if (S_ISREG(inode->i_mode)) + else if (S_ISREG(inode->i_mode)) { inode->i_op = &ext2_file_inode_operations; - else if (S_ISDIR(inode->i_mode)) + inode->i_mapping->a_ops = &ext2_aops; + } else if (S_ISDIR(inode->i_mode)) inode->i_op = &ext2_dir_inode_operations; - else if (S_ISLNK(inode->i_mode)) - inode->i_op = inode->i_blocks - ?&ext2_symlink_inode_operations - :&ext2_fast_symlink_inode_operations; - else + else if (S_ISLNK(inode->i_mode)) { + if (!inode->i_blocks) + inode->i_op = &ext2_fast_symlink_inode_operations; + else { + inode->i_op = &page_symlink_inode_operations; + inode->i_mapping->a_ops = &ext2_aops; + } + } else init_special_inode(inode, inode->i_mode, le32_to_cpu(raw_inode->i_block[0])); brelse (bh); diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index 08136962a..c2e5630ca 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c @@ -384,6 +384,7 @@ int ext2_create (struct inode * dir, struct dentry * dentry, int mode) return err; inode->i_op = &ext2_file_inode_operations; + inode->i_mapping->a_ops = &ext2_aops; inode->i_mode = mode; mark_inode_dirty(inode); bh = ext2_add_entry (dir, dentry->d_name.name, dentry->d_name.len, &de, &err); @@ -696,7 +697,8 @@ int ext2_symlink (struct inode * dir, struct dentry *dentry, const char * symnam inode->i_mode = S_IFLNK | S_IRWXUGO; if (l > sizeof (inode->u.ext2_i.i_data)) { - inode->i_op = &ext2_symlink_inode_operations; + inode->i_op = &page_symlink_inode_operations; + inode->i_mapping->a_ops = &ext2_aops; err = block_symlink(inode, symname, l); if (err) goto out_no_entry; diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c index 18fbbb368..d56ef4c62 100644 --- a/fs/ext2/symlink.c +++ b/fs/ext2/symlink.c @@ -1,6 +1,8 @@ /* * linux/fs/ext2/symlink.c * + * Only fast symlinks left here - the rest is done by generic code. AV, 1999 + * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal @@ -16,7 +18,6 @@ */ #include <linux/fs.h> -#include <linux/ext2_fs.h> static int ext2_readlink(struct dentry *dentry, char *buffer, int buflen) { @@ -34,10 +35,3 @@ struct inode_operations ext2_fast_symlink_inode_operations = { readlink: ext2_readlink, follow_link: ext2_follow_link, }; - -struct inode_operations ext2_symlink_inode_operations = { - readlink: page_readlink, - follow_link: page_follow_link, - get_block: ext2_get_block, - readpage: block_read_full_page, -}; |