summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMike Shaver <shaver@ingenia.com>1999-01-22 01:58:13 +0000
committerMike Shaver <shaver@ingenia.com>1999-01-22 01:58:13 +0000
commitec64862792a20b0114c4cf556f270a49dec5dc7b (patch)
tree3d81522461aa61a41cbf683934fcf5decd969ddf /fs
parent6bafd683c6bd78f19df9a42aea24037137f913ce (diff)
updated debugging code, still some really weird inode stuff
Diffstat (limited to 'fs')
-rw-r--r--fs/efs/Makefile2
-rw-r--r--fs/efs/file.c18
-rw-r--r--fs/efs/inode.c81
-rw-r--r--fs/efs/symlink.c5
4 files changed, 60 insertions, 46 deletions
diff --git a/fs/efs/Makefile b/fs/efs/Makefile
index a0532be3e..1a0435ed3 100644
--- a/fs/efs/Makefile
+++ b/fs/efs/Makefile
@@ -7,7 +7,7 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
-CFLAGS+=-g -DDEBUG_EFS
+EXTRA_CFLAGS +=-g -DDEBUG_EFS
O_TARGET := efs.o
O_OBJS := dir.o file.o inode.o namei.o \
diff --git a/fs/efs/file.c b/fs/efs/file.c
index 7ffaa6a16..e30ac301b 100644
--- a/fs/efs/file.c
+++ b/fs/efs/file.c
@@ -86,21 +86,21 @@ efs_getblk(struct inode *in, __u32 blk)
diskblk = CHECK(iter);
if (diskblk) {
ini->cur = iter;
- DB(("EFS: inode %d: found block %d as %d in ext %d\n",
+ DB(("EFS: inode %ld: found block %d as %d in ext %d\n",
in->i_ino, blk, diskblk, iter));
return diskblk;
}
}
- DB(("EFS: block %d not found in direct inode %d (size %d)\n",
- blk, in->i_ino, in->i_size));
+ DB(("EFS: block %d not found in direct inode %ld (size %ld)\n",
+ blk, in->i_ino, (long)in->i_size));
return 0;
} else {
int indirext = 0, total_extents_checked = 0;
/* indirect inode */
- DB(("EFS: inode %d is indirect (total %d, indir ", in->i_ino, total));
+ DB(("EFS: inode %ld is indirect (total %d, indir ", in->i_ino, total));
total = ini->extents[0].ex_ex.ex_offset;
DB(("%d)\n", total));
@@ -140,8 +140,8 @@ efs_getblk(struct inode *in, __u32 blk)
brelse(extbh);
}
}
- DB(("EFS: inode %d: didn't find block %d (indirect search, size %d)\n",
- in->i_ino, in->i_size));
+ DB(("EFS: inode %ld: didn't find block %d (indir search, size %ld)\n",
+ in->i_ino, blk, (long)in->i_size));
return 0;
}
}
@@ -151,12 +151,16 @@ int efs_bmap(struct inode *in, int block)
if (block < 0)
return 0;
+ if (!in->i_size) {
+ DB(("EFS: um, inode %ld has size 0. What up?\n", in->i_ino));
+ }
+
/*
* the kernel wants a full page (== 4K == 8 EFS blocks), so be sure that
* the block number isn't too large for that.
*/
if (block > ((in->i_size - 1) >> EFS_BLOCK_SIZE_BITS)) {
- DB(("EFS: wacky: block %d > max %d\n", block,
+ DB(("EFS: wacky: block %d > max %ld\n", block,
((in->i_size - 1) >> EFS_BLOCK_SIZE_BITS)));
return 0;
}
diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index 735d86d99..f00b06520 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -22,14 +22,7 @@
void
efs_put_super(struct super_block *sb)
{
- DB(("efs_put_super ... "));
- lock_super(sb);
- DB(("locked ... "));
- sb->s_dev = 0;
- unlock_super(sb);
- DB(("unlocked ... "));
MOD_DEC_USE_COUNT;
- DB(("MOD_DEC_USE_COUNT\n"));
}
static struct super_operations efs_sops = {
@@ -69,11 +62,11 @@ efs_read_super(struct super_block *s, void *data, int silent)
struct efs_disk_sb *efs_sb;
struct efs_sb_info *sbi;
kdev_t dev = s->s_dev;
- const char *errmsg;
+ const char *errmsg = "default error message";
struct inode *root;
__u32 magic;
- DB(("read_super\n"));
+ DB(("read_super on dev %s\n", kdevname(dev)));
MOD_INC_USE_COUNT;
lock_super(s);
@@ -116,21 +109,31 @@ efs_read_super(struct super_block *s, void *data, int silent)
case EFS_DIRTY:
errmsg = "Partition was not umounted properly, and is dirty";
break;
+ default:
+ errmsg = "unknown!\n";
+ break;
}
if (!silent)
- printk("EFS: ERROR: %s\n", errmsg);
+ printk("EFS: ERROR: cleanliness is %#04x: %s\n", efs_sb->s_dirty,
+ errmsg);
goto out_unlock;
}
-
+
s->s_blocksize = EFS_BLOCK_SIZE;
s->s_blocksize_bits = EFS_BLOCK_SIZE_BITS;
s->s_magic = EFS_SUPER_MAGIC;
s->s_op = &efs_sops;
+ DB(("getting root inode (%d)\n", EFS_ROOT_INODE));
root = iget(s, EFS_ROOT_INODE);
-
+
+ if (!root->i_size)
+ goto out_bad_root;
+ DB(("checking root inode\n"));
errmsg = efs_checkroot(s, root);
if (errmsg)
goto out_bad_root;
+
+ DB(("root inode OK\n"));
s->s_root = d_alloc_root(root, NULL);
if (!s->s_root)
@@ -148,9 +151,8 @@ efs_read_super(struct super_block *s, void *data, int silent)
/* error-handling exit paths */
out_bad_root:
- if (!silent)
- printk("EFS: ERROR: %s\n", errmsg);
- goto out_unlock;
+ if (!silent && errmsg)
+ printk("EFS: bad_root ERROR: %s\n", errmsg);
out_iput:
iput(root);
@@ -199,7 +201,7 @@ efs_read_inode(struct inode *in)
__u16 numext;
__u32 rdev;
- DB(("read_inode"));
+ DB(("read_inode\n"));
/*
* Calculate the disk block and offset for the inode.
@@ -224,7 +226,8 @@ efs_read_inode(struct inode *in)
/* find the offset */
offset = (ino % EFS_INODES_PER_BLOCK) << 7;
- DB(("EFS: looking for inode #%xl\n", ino));
+ DB(("EFS: looking for inode #%xl in blk %d offset %d\n",
+ ino, block, offset));
bh = bread(in->i_dev, block, EFS_BLOCK_SIZE);
@@ -244,12 +247,17 @@ efs_read_inode(struct inode *in)
in->i_uid = efs_swab16(di->di_uid);
in->i_gid = efs_swab16(di->di_gid);
in->i_mode = efs_swab16(di->di_mode);
+
+ DB(("INODE %ld: mt %ld ct %ld at %ld sz %ld nl %ld uid %ld gid %ld mode %lo\n",
+ in->i_ino,
+ in->i_mtime, in->i_ctime, in->i_atime, in->i_size, in->i_nlink,
+ in->i_uid, in->i_gid, in->i_mode));
rdev = efs_swab32(*(__u32 *) &di->di_u.di_dev);
numext = efs_swab16(di->di_numextents);
if (numext > EFS_MAX_EXTENTS) {
- DB(("EFS: inode #%lx is indirect (%d)\n", ino, numext));
+ DB(("EFS: inode %#0x is indirect (%d)\n", ino, numext));
/*
* OPT: copy the first 10 extents in here?
@@ -257,7 +265,8 @@ efs_read_inode(struct inode *in)
} else {
int i;
- DB(("EFS: inode %#lx is direct. Happy day!\n", in->i_ino));
+ DB(("EFS: inode %#lx is direct (%d). Happy day!\n", in->i_ino,
+ numext));
ini->extblk = block;
/* copy extents into inode_info */
@@ -269,37 +278,35 @@ efs_read_inode(struct inode *in)
ini->tot = numext;
ini->cur = 0;
brelse(bh);
-
- switch(in->i_mode & S_IFMT) {
- case S_IFDIR:
+
+ if (S_ISDIR(in->i_mode))
in->i_op = &efs_dir_inode_operations;
- break;
- case S_IFREG:
+ else if (S_ISREG(in->i_mode))
in->i_op = &efs_file_inode_operations;
- break;
- case S_IFLNK:
+ else if (S_ISLNK(in->i_mode))
in->i_op = &efs_symlink_inode_operations;
- break;
- case S_IFCHR:
+ else if (S_ISCHR(in->i_mode)) {
in->i_rdev = rdev;
in->i_op = &chrdev_inode_operations;
- break;
- case S_IFBLK:
+ } else if (S_ISBLK(in->i_mode)) {
in->i_rdev = rdev;
in->i_op = &blkdev_inode_operations;
- break;
- case S_IFIFO:
+ } else if (S_ISFIFO(in->i_mode))
init_fifo(in);
- break;
- default:
- printk("EFS: ERROR: unsupported inode mode %lo\n",
- (in->i_mode & S_IFMT));
+ else {
+ printk("EFS: ERROR: unsupported inode mode %#lo (dir is %#lo) =? %d\n",
+ (in->i_mode & S_IFMT), (long)S_IFDIR,
+ in->i_mode & S_IFMT == S_IFDIR);
goto error;
}
return;
error:
+ DB(("ERROR: INODE %ld: mt %ld ct %ld at %ld sz %ld nl %ld uid %ld "
+ "gid %ld mode %lo\n", in->i_ino,
+ in->i_mtime, in->i_ctime, in->i_atime, in->i_size, in->i_nlink,
+ in->i_uid, in->i_gid, in->i_mode));
in->i_mtime = in->i_atime = in->i_ctime = 0;
in->i_size = 0;
in->i_nlink = 1;
@@ -327,12 +334,14 @@ EXPORT_NO_SYMBOLS;
int
init_module(void)
{
+ DB(("loading EFS module\n"));
return init_efs_fs();
}
void
cleanup_module(void)
{
+ DB(("removing EFS module\n"));
unregister_filesystem(&efs_fs_type);
}
diff --git a/fs/efs/symlink.c b/fs/efs/symlink.c
index 95ab238a4..cd69ef5fc 100644
--- a/fs/efs/symlink.c
+++ b/fs/efs/symlink.c
@@ -11,7 +11,8 @@
#include <asm/uaccess.h>
static struct dentry *
-efs_follow_link(struct dentry *dentry, struct dentry *base)
+efs_follow_link(struct dentry *dentry, struct dentry *base,
+ unsigned int follow)
{
struct inode *in = dentry->d_inode;
struct buffer_head *bh;
@@ -22,7 +23,7 @@ efs_follow_link(struct dentry *dentry, struct dentry *base)
return ERR_PTR(-EIO);
}
UPDATE_ATIME(in);
- base = lookup_dentry(bh->b_data, base, 1);
+ base = lookup_dentry(bh->b_data, base, follow);
brelse(bh);
return base;
}