lkml.org 
[lkml]   [2000]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch-2.4.0-test10-pre3] kill_super() cleanup.
Hi Linus and Alexander,

The fs/super.c:kill_super() function can be simplified to return 'void'
and also caching sb->s_op and sb->s_type makes the code more readable.

Regards,
Tigran


--- linux/fs/super.c Mon Sep 25 21:13:53 2000
+++ work/fs/super.c Sun Oct 15 21:18:56 2000
@@ -884,24 +884,27 @@
return sb;
}

-static struct block_device *kill_super(struct super_block *sb, int umount_root)
+static void kill_super(struct super_block *sb, int umount_root)
{
struct block_device *bdev;
kdev_t dev;
struct dentry *root = sb->s_root;
+ struct file_system_type *fs = sb->s_type;
+ struct super_operations *sop = sb->s_op;
+
sb->s_root = NULL;
/* Need to clean after the sucker */
- if (sb->s_type->fs_flags & FS_LITTER)
+ if (fs->fs_flags & FS_LITTER)
d_genocide(root);
- if (sb->s_type->fs_flags & (FS_SINGLE|FS_LITTER))
+ if (fs->fs_flags & (FS_SINGLE|FS_LITTER))
shrink_dcache_parent(root);
dput(root);
lock_super(sb);
- if (sb->s_op) {
- if (sb->s_op->write_super && sb->s_dirt)
- sb->s_op->write_super(sb);
- if (sb->s_op->put_super)
- sb->s_op->put_super(sb);
+ if (sop) {
+ if (sop->write_super && sb->s_dirt)
+ sop->write_super(sb);
+ if (sop->put_super)
+ sop->put_super(sb);
}

/* Forget any remaining inodes */
@@ -914,7 +917,7 @@
sb->s_dev = 0; /* Free the superblock */
bdev = sb->s_bdev;
sb->s_bdev = NULL;
- put_filesystem(sb->s_type);
+ put_filesystem(fs);
sb->s_type = NULL;
unlock_super(sb);
if (umount_root) {
@@ -928,7 +931,6 @@
bdput(bdev);
} else
put_unnamed_dev(dev);
- return bdev;
}

/*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.028 / U:30.900 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site