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;
        }
out:
        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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to