mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "rae l" <crquan@gmail.com>
To: "Al Viro" <viro@ftp.linux.org.uk>
Cc: "Alexander Viro" <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@suse.de>
Subject: Re: [RFC] fs/super.c: Why alloc_super use a static variable default_op?
Date: Wed, 25 Jul 2007 12:29:17 +0800	[thread overview]
Message-ID: <91b13c310707242129u6aa09166j74ad42d31adc4ad7@mail.gmail.com> (raw)
In-Reply-To: <20070725041407.GA27237@ftp.linux.org.uk>

On 7/25/07, Al Viro <viro@ftp.linux.org.uk> wrote:
> On Wed, Jul 25, 2007 at 11:48:35AM +0800, rae l wrote:
> > 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?
>
> So that we would not have to care about ->s_op *ever* being NULL.
But is it valuable? Compared to a waste of sizeof(struct super_block)
bytes memory.

When some code want to refer fs_type->s_op, it almost always want to
refer some function pointer in s_op with fs_type->s_op->***, but all
pointers in default_op are all NULLs, what about this scenario?

and if you do grep s_op in the source code, you will found nowhere
will want to test s_op or dependent on s_op not NULL.

So my opinion is to remove default_ops, just keep new allocated s_op NULL.

>


-- 
Denis Cheng
Linux Application Developer

"One of my most productive days was throwing away 1000 lines of code."
 - Ken Thompson.

  reply	other threads:[~2007-07-25  4:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25  3:48 rae l
2007-07-25  4:14 ` Al Viro
2007-07-25  4:29   ` rae l [this message]
2007-07-25  4:37     ` Al Viro
2007-07-25  5:21       ` rae l
2007-07-25  6:39         ` Al Viro
2007-07-25  6:43           ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91b13c310707242129u6aa09166j74ad42d31adc4ad7@mail.gmail.com \
    --to=crquan@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®