[lkml]   [2007]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[RFC] fs/super.c: Why alloc_super use a static variable default_op?
Why alloc_super use a static variable default_op?
the static struct super_operations default_op is just all zeros, and
just referenced as the initial value of a new allocated super_block,
what does it for?

the filesystem dependent code such as ext2_fill_super would fill this
field eventually,
and after carefully checked, it seems no one filesystem would need a
all zero default_op,

as the command output in the kernel source tree:
$ grep -RInw s_op fs/
You could check all the use of s_op.

* alloc_super - create new superblock
* @type: filesystem type superblock should belong to
* Allocates and initializes a new &struct super_block. alloc_super()
* returns a pointer new superblock or %NULL if allocation had failed.
static struct super_block *alloc_super(struct file_system_type *type)
struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER);

static struct super_operations default_op;

if (s) {
s->s_op = &default_op;
s->s_time_gran = 1000000000;
return s;

Denis Cheng
Linux Application Developer

"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-07-25 05:51    [W:0.037 / U:9.180 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site