summaryrefslogtreecommitdiffstats
path: root/fs/minix/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/minix/inode.c')
-rw-r--r--fs/minix/inode.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index cbd735ef1..898f56f19 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -24,10 +24,8 @@
#include <asm/uaccess.h>
#include <asm/bitops.h>
-void minix_put_inode(struct inode *inode)
+static void minix_delete_inode(struct inode *inode)
{
- if (inode->i_nlink)
- return;
inode->i_size = 0;
minix_truncate(inode);
minix_free_inode(inode);
@@ -77,9 +75,10 @@ void minix_put_super(struct super_block *sb)
static struct super_operations minix_sops = {
minix_read_inode,
- NULL,
minix_write_inode,
- minix_put_inode,
+ NULL, /* put_inode */
+ minix_delete_inode,
+ NULL, /* notify_change */
minix_put_super,
minix_write_super,
minix_statfs,
@@ -125,15 +124,13 @@ int minix_remount (struct super_block * sb, int * flags, char * data)
* it really _is_ a minix filesystem, and to check the size
* of the directory entry.
*/
-static const char * minix_checkroot(struct super_block *s)
+static const char * minix_checkroot(struct super_block *s, struct inode *dir)
{
- struct inode * dir;
struct buffer_head *bh;
struct minix_dir_entry *de;
const char * errmsg;
int dirsize;
- dir = s->s_mounted;
if (!S_ISDIR(dir->i_mode))
return "root directory is not a directory";
@@ -172,7 +169,8 @@ struct super_block *minix_read_super(struct super_block *s,void *data,
int i, block;
kdev_t dev = s->s_dev;
const char * errmsg;
-
+ struct inode *root_inode;
+
if (32 != sizeof (struct minix_inode))
panic("bad V1 i-node size");
if (64 != sizeof(struct minix2_inode))
@@ -272,8 +270,9 @@ struct super_block *minix_read_super(struct super_block *s,void *data,
/* set up enough so that it can read an inode */
s->s_dev = dev;
s->s_op = &minix_sops;
- s->s_mounted = iget(s,MINIX_ROOT_INO);
- if (!s->s_mounted) {
+ root_inode = iget(s,MINIX_ROOT_INO);
+ s->s_root = d_alloc_root(root_inode, NULL);
+ if (!s->s_root) {
s->s_dev = 0;
brelse(bh);
if (!silent)
@@ -282,11 +281,11 @@ struct super_block *minix_read_super(struct super_block *s,void *data,
return NULL;
}
- errmsg = minix_checkroot(s);
+ errmsg = minix_checkroot(s, root_inode);
if (errmsg) {
if (!silent)
printk("MINIX-fs: %s\n", errmsg);
- iput (s->s_mounted);
+ d_delete(s->s_root); /* XXX Is this enough? */
s->s_dev = 0;
brelse (bh);
MOD_DEC_USE_COUNT;
@@ -307,7 +306,7 @@ struct super_block *minix_read_super(struct super_block *s,void *data,
return s;
}
-void minix_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
+int minix_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
{
struct statfs tmp;
@@ -319,7 +318,7 @@ void minix_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
tmp.f_files = sb->u.minix_sb.s_ninodes;
tmp.f_ffree = minix_count_free_inodes(sb);
tmp.f_namelen = sb->u.minix_sb.s_namelen;
- copy_to_user(buf, &tmp, bufsiz);
+ return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
}
/*
@@ -472,7 +471,7 @@ repeat:
}
*p = tmp;
inode->i_ctime = CURRENT_TIME;
- inode->i_dirt = 1;
+ mark_inode_dirty(inode);
return result;
}
@@ -585,7 +584,7 @@ repeat:
}
*p = tmp;
inode->i_ctime = CURRENT_TIME;
- inode->i_dirt = 1;
+ mark_inode_dirty(inode);
return result;
}
@@ -833,14 +832,12 @@ static struct buffer_head * V1_minix_update_inode(struct inode * inode)
printk("Bad inode number on dev %s"
": %d is out of range\n",
kdevname(inode->i_dev), ino);
- inode->i_dirt = 0;
return 0;
}
block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks + inode->i_sb->u.minix_sb.s_zmap_blocks +
(ino-1)/MINIX_INODES_PER_BLOCK;
if (!(bh=bread(inode->i_dev, block, BLOCK_SIZE))) {
printk("unable to read i-node block\n");
- inode->i_dirt = 0;
return 0;
}
raw_inode = ((struct minix_inode *)bh->b_data) +
@@ -855,7 +852,6 @@ static struct buffer_head * V1_minix_update_inode(struct inode * inode)
raw_inode->i_zone[0] = kdev_t_to_nr(inode->i_rdev);
else for (block = 0; block < 9; block++)
raw_inode->i_zone[block] = inode->u.minix_i.u.i1_data[block];
- inode->i_dirt=0;
mark_buffer_dirty(bh, 1);
return bh;
}
@@ -874,14 +870,12 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
printk("Bad inode number on dev %s"
": %d is out of range\n",
kdevname(inode->i_dev), ino);
- inode->i_dirt = 0;
return 0;
}
block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks + inode->i_sb->u.minix_sb.s_zmap_blocks +
(ino-1)/MINIX2_INODES_PER_BLOCK;
if (!(bh=bread(inode->i_dev, block, BLOCK_SIZE))) {
printk("unable to read i-node block\n");
- inode->i_dirt = 0;
return 0;
}
raw_inode = ((struct minix2_inode *)bh->b_data) +
@@ -898,7 +892,6 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
raw_inode->i_zone[0] = kdev_t_to_nr(inode->i_rdev);
else for (block = 0; block < 10; block++)
raw_inode->i_zone[block] = inode->u.minix_i.u.i2_data[block];
- inode->i_dirt=0;
mark_buffer_dirty(bh, 1);
return bh;
}