From: NeilBrown Date: Fri, 2 Jul 2010 23:44:25 +0000 (+1000) Subject: Remove lafs_write_super. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=065fabfbf2fc962aec2640b08c606aef773d3748;p=LaFS.git Remove lafs_write_super. We don't really want to do anything of lafs_write_super as we write the superblock when needed anyway. However lafs_sync_fs needs to do what lafs_write_super was doing, at least sometimes. lafs_sync_fs will now force a checkpoint exactly when s_dirt is set. So revise those setting a little - I think we only want this if there are dirty inodes to flush. but that needs to be thought about more when I fix write_inode. Signed-off-by: NeilBrown --- diff --git a/block.c b/block.c index 3304a95..7091a8c 100644 --- a/block.c +++ b/block.c @@ -490,8 +490,6 @@ void lafs_dirty_dblock(struct datablock *b) { LAFS_BUG(!test_bit(B_Valid, &b->b.flags), &b->b); - if (test_bit(B_Pinned, &b->b.flags)) - b->b.inode->i_sb->s_dirt = 1; /* * FIXME maybe check we aren't dirtying a dirty block * in the previous phase. @@ -636,6 +634,4 @@ lafs_dirty_iblock(struct indexblock *b) if (test_and_set_bit(B_UnincCredit, &b->b.flags)) /* race - we didn't need it after all */ lafs_space_return(fs_from_inode(b->b.inode), 1); - - b->b.inode->i_sb->s_dirt = 1; } diff --git a/inode.c b/inode.c index 17acaf7..f539487 100644 --- a/inode.c +++ b/inode.c @@ -879,6 +879,7 @@ void lafs_dirty_inode(struct inode *ino) * (e.g. in setattr) will do that. */ set_bit(I_Dirty, &LAFSI(ino)->iflags); + ino->i_sb->s_dirt = 1; } int lafs_write_inode(struct inode *ino, int wait) diff --git a/super.c b/super.c index efc2071..3fa87ae 100644 --- a/super.c +++ b/super.c @@ -975,19 +975,14 @@ void lafs_destroy_inode(struct inode *inode) } } -static void lafs_write_super(struct super_block *sb) -{ - struct fs *fs = sb->s_fs_info; - - lafs_checkpoint_start(fs); -} - static int lafs_sync_fs(struct super_block *sb, int wait) { struct fs *fs = sb->s_fs_info; if (!wait) - /* FIXME why do I need this here? */ - lafs_cluster_flush(fs, 0); + /* We only reach here if s_dirt was set, so it + * is reasonable to force a checkpoint. + */ + lafs_checkpoint_start(fs); else printk("FIXME I should wait for the checkpoint to finish\n"); return 0; @@ -1051,7 +1046,6 @@ static struct super_operations lafs_sops = { .clear_inode = lafs_clear_inode, /* forget internal state of this inode */ .delete_inode = lafs_delete_inode, /* remove this inode from filesystem */ .put_super = lafs_put_super, - .write_super = lafs_write_super, .sync_fs = lafs_sync_fs, /* write_super_lockfs ?? */ /* unlockfs ?? */