summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
commit33263fc5f9ac8e8cb2b22d06af3ce5ac1dd815e4 (patch)
tree2d1b86a40bef0958a68cf1a2eafbeb0667a70543 /fs/ext2
parent216f5f51aa02f8b113aa620ebc14a9631a217a00 (diff)
Merge with Linux 2.3.32.
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/acl.c1
-rw-r--r--fs/ext2/balloc.c1
-rw-r--r--fs/ext2/bitmap.c1
-rw-r--r--fs/ext2/dir.c3
-rw-r--r--fs/ext2/file.c3
-rw-r--r--fs/ext2/fsync.c1
-rw-r--r--fs/ext2/ialloc.c3
-rw-r--r--fs/ext2/inode.c8
-rw-r--r--fs/ext2/ioctl.c1
-rw-r--r--fs/ext2/namei.c59
-rw-r--r--fs/ext2/symlink.c100
-rw-r--r--fs/ext2/truncate.c1
12 files changed, 45 insertions, 137 deletions
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 5ec306fdf..26db0a623 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -7,7 +7,6 @@
* Universite Pierre et Marie Curie (Paris VI)
*/
-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/sched.h>
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index e0f7a655c..6c232ce79 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -11,7 +11,6 @@
* David S. Miller (davem@caip.rutgers.edu), 1995
*/
-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/locks.h>
#include <linux/quotaops.h>
diff --git a/fs/ext2/bitmap.c b/fs/ext2/bitmap.c
index ddd0ac12c..c0ffb68cd 100644
--- a/fs/ext2/bitmap.c
+++ b/fs/ext2/bitmap.c
@@ -7,7 +7,6 @@
* Universite Pierre et Marie Curie (Paris VI)
*/
-#include <linux/module.h>
#include <linux/fs.h>
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index e1f45105e..2cc69ee5b 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -18,7 +18,6 @@
* David S. Miller (davem@caip.rutgers.edu), 1995
*/
-#include <linux/module.h>
#include <linux/fs.h>
@@ -67,10 +66,8 @@ struct inode_operations ext2_dir_inode_operations = {
NULL, /* get_block */
NULL, /* readpage */
NULL, /* writepage */
- NULL, /* flushpage */
NULL, /* truncate */
ext2_permission, /* permission */
- NULL, /* smap */
NULL /* revalidate */
};
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 987b55f94..5ebba9da1 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -18,7 +18,6 @@
* (jj@sunsite.ms.mff.cuni.cz)
*/
-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/sched.h>
@@ -177,9 +176,7 @@ struct inode_operations ext2_file_inode_operations = {
ext2_get_block, /* get_block */
block_read_full_page, /* readpage */
block_write_full_page, /* writepage */
- block_flushpage, /* flushpage */
ext2_truncate, /* truncate */
ext2_permission, /* permission */
- NULL, /* smap */
NULL, /* revalidate */
};
diff --git a/fs/ext2/fsync.c b/fs/ext2/fsync.c
index cd12a68bd..f4e02c2e8 100644
--- a/fs/ext2/fsync.c
+++ b/fs/ext2/fsync.c
@@ -22,7 +22,6 @@
* we can depend on generic_block_fdatasync() to sync the data blocks.
*/
-#include <linux/module.h>
#include <linux/fs.h>
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index d6953e4cb..d519f6001 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -12,7 +12,6 @@
* David S. Miller (davem@caip.rutgers.edu), 1995
*/
-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/locks.h>
#include <linux/quotaops.h>
@@ -474,7 +473,7 @@ repeat:
if (inode->u.ext2_i.i_flags & EXT2_SYNC_FL)
inode->i_flags |= MS_SYNCHRONOUS;
insert_inode_hash(inode);
- inode->i_generation++;
+ inode->i_generation = event++;
mark_inode_dirty(inode);
unlock_super (sb);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index a980df858..b4f952d07 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -20,7 +20,6 @@
* (jj@sunsite.ms.mff.cuni.cz)
*/
-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/locks.h>
#include <linux/smp_lock.h>
@@ -43,7 +42,8 @@ void ext2_put_inode (struct inode * inode)
*/
void ext2_delete_inode (struct inode * inode)
{
- if (inode->i_ino == EXT2_ACL_IDX_INO ||
+ if (is_bad_inode(inode) ||
+ inode->i_ino == EXT2_ACL_IDX_INO ||
inode->i_ino == EXT2_ACL_DATA_INO)
return;
inode->u.ext2_i.i_dtime = CURRENT_TIME;
@@ -713,7 +713,9 @@ void ext2_read_inode (struct inode * inode)
else if (S_ISDIR(inode->i_mode))
inode->i_op = &ext2_dir_inode_operations;
else if (S_ISLNK(inode->i_mode))
- inode->i_op = &ext2_symlink_inode_operations;
+ inode->i_op = inode->i_blocks
+ ?&ext2_symlink_inode_operations
+ :&ext2_fast_symlink_inode_operations;
else
init_special_inode(inode, inode->i_mode,
le32_to_cpu(raw_inode->i_block[0]));
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index a582fd545..0b456820a 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -7,7 +7,6 @@
* Universite Pierre et Marie Curie (Paris VI)
*/
-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <asm/uaccess.h>
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 8bc7532de..87f39796a 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -18,7 +18,6 @@
* for B-tree directories by Theodore Ts'o (tytso@mit.edu), 1998
*/
-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/locks.h>
#include <linux/quotaops.h>
@@ -678,48 +677,32 @@ end_unlink:
int ext2_symlink (struct inode * dir, struct dentry *dentry, const char * symname)
{
- struct ext2_dir_entry_2 * de;
struct inode * inode;
- struct buffer_head * bh = NULL, * name_block = NULL;
- char * link;
- int i, l, err = -EIO;
- char c;
+ struct ext2_dir_entry_2 * de;
+ struct buffer_head * bh = NULL;
+ int l, err;
- if (!(inode = ext2_new_inode (dir, S_IFLNK, &err))) {
- return err;
- }
- inode->i_mode = S_IFLNK | S_IRWXUGO;
- inode->i_op = &ext2_symlink_inode_operations;
- for (l = 0; l < inode->i_sb->s_blocksize - 1 &&
- symname [l]; l++)
- ;
- if (l >= sizeof (inode->u.ext2_i.i_data)) {
-
- ext2_debug ("l=%d, normal symlink\n", l);
-
- name_block = ext2_bread (inode, 0, 1, &err);
- if (!name_block) {
- inode->i_nlink--;
- mark_inode_dirty(inode);
- iput (inode);
- return err;
- }
- link = name_block->b_data;
- } else {
- link = (char *) inode->u.ext2_i.i_data;
+ err = -ENAMETOOLONG;
+ l = strlen(symname)+1;
+ if (l > dir->i_sb->s_blocksize)
+ goto out;
- ext2_debug ("l=%d, fast symlink\n", l);
+ err = -EIO;
+ if (!(inode = ext2_new_inode (dir, S_IFLNK, &err)))
+ goto out;
+ inode->i_mode = S_IFLNK | S_IRWXUGO;
+
+ if (l > sizeof (inode->u.ext2_i.i_data)) {
+ inode->i_op = &ext2_symlink_inode_operations;
+ err = block_symlink(inode, symname, l);
+ if (err)
+ goto out_no_entry;
+ } else {
+ inode->i_op = &ext2_fast_symlink_inode_operations;
+ memcpy((char*)&inode->u.ext2_i.i_data,symname,l);
+ inode->i_size = l-1;
}
- i = 0;
- while (i < inode->i_sb->s_blocksize - 1 && (c = *(symname++)))
- link[i++] = c;
- link[i] = 0;
- if (name_block) {
- mark_buffer_dirty(name_block, 1);
- brelse (name_block);
- }
- inode->i_size = i;
mark_inode_dirty(inode);
bh = ext2_add_entry (dir, dentry->d_name.name, dentry->d_name.len, &de, &err);
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c
index bf880e68a..18fbbb368 100644
--- a/fs/ext2/symlink.c
+++ b/fs/ext2/symlink.c
@@ -15,93 +15,29 @@
* ext2 symlink handling code
*/
-#include <linux/module.h>
#include <linux/fs.h>
-#include <asm/uaccess.h>
+#include <linux/ext2_fs.h>
-
-
-static int ext2_readlink (struct dentry *, char *, int);
-static struct dentry *ext2_follow_link(struct dentry *, struct dentry *, unsigned int);
-
-/*
- * symlinks can't do much...
- */
-struct inode_operations ext2_symlink_inode_operations = {
- NULL, /* no file-operations */
- NULL, /* create */
- NULL, /* lookup */
- NULL, /* link */
- NULL, /* unlink */
- NULL, /* symlink */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* mknod */
- NULL, /* rename */
- ext2_readlink, /* readlink */
- ext2_follow_link, /* follow_link */
- NULL, /* get_block */
- NULL, /* readpage */
- NULL, /* writepage */
- NULL, /* flushpage */
- NULL, /* truncate */
- NULL, /* permission */
- NULL, /* smap */
- NULL /* revalidate */
-};
-
-static struct dentry * ext2_follow_link(struct dentry * dentry,
- struct dentry *base,
- unsigned int follow)
+static int ext2_readlink(struct dentry *dentry, char *buffer, int buflen)
{
- struct inode *inode = dentry->d_inode;
- struct buffer_head * bh = NULL;
- int error;
- char * link;
-
- link = (char *) inode->u.ext2_i.i_data;
- if (inode->i_blocks) {
- if (!(bh = ext2_bread (inode, 0, 0, &error))) {
- dput(base);
- return ERR_PTR(-EIO);
- }
- link = bh->b_data;
- }
- UPDATE_ATIME(inode);
- base = lookup_dentry(link, base, follow);
- if (bh)
- brelse(bh);
- return base;
+ char *s = (char *)dentry->d_inode->u.ext2_i.i_data;
+ return vfs_readlink(dentry, buffer, buflen, s);
}
-static int ext2_readlink (struct dentry * dentry, char * buffer, int buflen)
+static struct dentry *ext2_follow_link(struct dentry *dentry, struct dentry *base, unsigned flags)
{
- struct inode *inode = dentry->d_inode;
- struct buffer_head * bh = NULL;
- char * link;
- int i;
-
- if (buflen > inode->i_sb->s_blocksize - 1)
- buflen = inode->i_sb->s_blocksize - 1;
+ char *s = (char *)dentry->d_inode->u.ext2_i.i_data;
+ return vfs_follow_link(dentry, base, flags, s);
+}
- link = (char *) inode->u.ext2_i.i_data;
- if (inode->i_blocks) {
- int err;
- bh = ext2_bread (inode, 0, 0, &err);
- if (!bh) {
- if(err < 0) /* indicate type of error */
- return err;
- return 0;
- }
- link = bh->b_data;
- }
+struct inode_operations ext2_fast_symlink_inode_operations = {
+ readlink: ext2_readlink,
+ follow_link: ext2_follow_link,
+};
- i = 0;
- while (i < buflen && link[i])
- i++;
- if (copy_to_user(buffer, link, i))
- i = -EFAULT;
- if (bh)
- brelse (bh);
- return i;
-}
+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,
+};
diff --git a/fs/ext2/truncate.c b/fs/ext2/truncate.c
index 653936278..ba8397196 100644
--- a/fs/ext2/truncate.c
+++ b/fs/ext2/truncate.c
@@ -18,7 +18,6 @@
* General cleanup and race fixes, wsh, 1998
*/
-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/locks.h>