[Tux3] Userland cleanups
OGAWA Hirofumi
hirofumi at mail.parknet.co.jp
Fri Jan 9 07:36:54 PST 2009
OGAWA Hirofumi <hirofumi at mail.parknet.co.jp> writes:
>> Well, this make simple sb/inode user, on stack sb/inode is setted up by
>> macros, so we can avoid strace thing by unsetup sb/inode.
>>
>> And, with this, we can share tux_new_volmap() in both of userland and
>> kernel.
>>
>> static-http://userweb.kernel.org/~hirofumi/tux3/
>>
>> Please review and pull if ok.
>
> I've added lockdep warning fix. With this, we can use lockdep without warning.
Just demonstration though for now. With this hack, volmap/tux_vol_apos
seem to work.
--
OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
diff -puN user/tux3.h~vol_bread user/tux3.h
--- tux3/user/tux3.h~vol_bread 2009-01-10 00:24:32.000000000 +0900
+++ tux3-hirofumi/user/tux3.h 2009-01-10 00:24:32.000000000 +0900
@@ -152,16 +152,6 @@ struct tux_iattr {
unsigned mode, uid, gid;
};
-static inline struct buffer_head *sb_getblk(struct sb *sb, block_t block)
-{
- return blockget(sb->volmap->map, block);
-}
-
-static inline struct buffer_head *sb_bread(struct sb *sb, block_t block)
-{
- return blockread(sb->volmap->map, block);
-}
-
#define rapid_new_inode(sb, ops, mode) ({ \
struct inode *__inode = &(struct inode){ \
.i_sb = sb, \
diff -puN user/kernel/btree.c~vol_bread user/kernel/btree.c
--- tux3/user/kernel/btree.c~vol_bread 2009-01-10 00:24:32.000000000 +0900
+++ tux3-hirofumi/user/kernel/btree.c 2009-01-10 00:24:32.000000000 +0900
@@ -43,7 +43,7 @@ static struct buffer_head *new_block(str
block_t block = (btree->ops->balloc)(btree->sb, 1);
if (block == -1)
return NULL;
- struct buffer_head *buffer = sb_getblk(vfs_sb(btree->sb), block);
+ struct buffer_head *buffer = vol_getblk(btree->sb, block);
if (!buffer)
return NULL;
memset(bufdata(buffer), 0, bufsize(buffer));
@@ -226,7 +226,7 @@ void free_cursor(struct cursor *cursor)
int probe(struct btree *btree, tuxkey_t key, struct cursor *cursor)
{
unsigned i, depth = btree->root.depth;
- struct buffer_head *buffer = sb_bread(vfs_sb(btree->sb), btree->root.block);
+ struct buffer_head *buffer = vol_bread(btree->sb, btree->root.block);
if (!buffer)
return -EIO;
struct bnode *node = bufdata(buffer);
@@ -238,7 +238,7 @@ int probe(struct btree *btree, tuxkey_t
break;
trace("probe level %i, %ti of %i", i, next - node->entries, bcount(node));
level_push(cursor, buffer, next);
- if (!(buffer = sb_bread(vfs_sb(btree->sb), from_be_u64((next - 1)->block))))
+ if (!(buffer = vol_bread(btree->sb, from_be_u64((next - 1)->block))))
goto eek;
node = (struct bnode *)bufdata(buffer);
}
@@ -262,7 +262,7 @@ int advance(struct btree *btree, struct
level--;
} while (level_finished(cursor, level));
while (1) {
- buffer = sb_bread(vfs_sb(btree->sb), from_be_u64(cursor->path[level].next->block));
+ buffer = vol_bread(btree->sb, from_be_u64(cursor->path[level].next->block));
if (!buffer)
goto eek;
cursor->path[level].next++;
@@ -481,7 +481,7 @@ keep_prev_node:
/* push back down to leaf level */
while (level < depth - 1) {
- struct buffer_head *buffer = sb_bread(vfs_sb(sb), from_be_u64(cursor->path[level++].next++->block));
+ struct buffer_head *buffer = vol_bread(sb, from_be_u64(cursor->path[level++].next++->block));
if (!buffer) {
ret = -EIO;
goto out;
@@ -491,7 +491,7 @@ keep_prev_node:
}
//dirty_buffer_count_check(sb);
/* go to next leaf */
- if (!(leafbuf = sb_bread(vfs_sb(sb), from_be_u64(cursor->path[level].next++->block)))) {
+ if (!(leafbuf = vol_bread(sb, from_be_u64(cursor->path[level].next++->block)))) {
ret = -EIO;
goto out;
}
diff -puN user/tux3graph.c~vol_bread user/tux3graph.c
--- tux3/user/tux3graph.c~vol_bread 2009-01-10 00:24:32.000000000 +0900
+++ tux3-hirofumi/user/tux3graph.c 2009-01-10 00:24:32.000000000 +0900
@@ -185,7 +185,7 @@ static int draw_advance(struct graph_inf
level--;
} while (level_finished(cursor, level));
while (1) {
- buffer = sb_bread(vfs_sb(btree->sb), from_be_u64(cursor->path[level].next->block));
+ buffer = vol_bread(btree->sb, from_be_u64(cursor->path[level].next->block));
if (!buffer)
goto eek;
cursor->path[level].next++;
diff -puN user/kernel/super.c~vol_bread user/kernel/super.c
--- tux3/user/kernel/super.c~vol_bread 2009-01-10 00:24:32.000000000 +0900
+++ tux3-hirofumi/user/kernel/super.c 2009-01-10 00:24:32.000000000 +0900
@@ -84,7 +84,7 @@ static void tux3_write_super(struct supe
struct buffer_head *bh;
BUG_ON(SB_LOC < sb->s_blocksize);
- bh = sb_bread(sb, SB_LOC >> sb->s_blocksize_bits);
+ bh = vol_bread(tux_sb(sb), SB_LOC >> sb->s_blocksize_bits);
if (!bh) {
printk(KERN_ERR "TUX3: unable to read superblock\n");
return;
@@ -196,6 +196,7 @@ static int tux3_fill_super(struct super_
sbi->volmap = tux_new_volmap(tux_sb(sb));
if (!sbi->volmap)
goto error;
+ insert_inode_hash(sbi->volmap);
// struct inode *vtable;
sbi->bitmap = tux3_iget(sb, TUX_BITMAP_INO);
diff -puN user/kernel/tux3.h~vol_bread user/kernel/tux3.h
--- tux3/user/kernel/tux3.h~vol_bread 2009-01-10 00:24:32.000000000 +0900
+++ tux3-hirofumi/user/kernel/tux3.h 2009-01-10 00:24:32.000000000 +0900
@@ -735,4 +735,14 @@ static inline void brelse_dirty(struct b
static inline void change_begin(struct sb *sb) { };
static inline void change_end(struct sb *sb) { };
+
+static inline struct buffer_head *vol_getblk(struct sb *sb, block_t block)
+{
+ return blockget(mapping(sb->volmap), block);
+}
+
+static inline struct buffer_head *vol_bread(struct sb *sb, block_t block)
+{
+ return blockread(mapping(sb->volmap), block);
+}
#endif
diff -puN user/kernel/inode.c~vol_bread user/kernel/inode.c
--- tux3/user/kernel/inode.c~vol_bread 2009-01-10 00:24:46.000000000 +0900
+++ tux3-hirofumi/user/kernel/inode.c 2009-01-10 00:24:58.000000000 +0900
@@ -337,6 +337,8 @@ void tux3_clear_inode(struct inode *inod
int tux3_write_inode(struct inode *inode, int do_sync)
{
+ if (tux_inode(inode)->inum == TUX_VOLMAP_INO)
+ return 0;
BUG_ON(tux_inode(inode)->inum == TUX_BITMAP_INO ||
tux_inode(inode)->inum == TUX_VOLMAP_INO ||
tux_inode(inode)->inum == TUX_VTABLE_INO ||
_
_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3
More information about the Tux3
mailing list