lkml.org 
[lkml]   [2010]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH -V7 6/9] ext4: Add get_fsid callback
Date
On Sat, 15 May 2010 01:32:35 +0800, Coly Li <coly.li@suse.de> wrote:
>
>
> On 05/12/2010 11:50 PM, Aneesh Kumar K.V Wrote:
> > Acked-by: Serge Hallyn <serue@us.ibm.com>
> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> > ---
> > fs/ext4/super.c | 15 +++++++++++++++
> > 1 files changed, 15 insertions(+), 0 deletions(-)
> >
> > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> > index e14d22c..fc7d464 100644
> > --- a/fs/ext4/super.c
> > +++ b/fs/ext4/super.c
> > @@ -1049,6 +1049,19 @@ static int bdev_try_to_free_page(struct super_block *sb, struct page *page,
> > return try_to_free_buffers(page);
> > }
> >
> > +static int ext4_get_fsid(struct super_block *sb, struct uuid *fsid)
> > +{
> > + struct ext4_sb_info *sbi = EXT4_SB(sb);
> > + struct ext4_super_block *es = sbi->s_es;
> > +
> > + memcpy(fsid->uuid, es->s_uuid, sizeof(fsid->uuid));
> > + /*
> > + * We may want to make sure we return error if the s_uuid is not
> > + * exactly unique
> > + */
> > + return 0;
> > +}
> > +
> > #ifdef CONFIG_QUOTA
> > #define QTYPE2NAME(t) ((t) == USRQUOTA ? "user" : "group")
> > #define QTYPE2MOPT(on, t) ((t) == USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
> > @@ -1109,6 +1122,7 @@ static const struct super_operations ext4_sops = {
> > .quota_write = ext4_quota_write,
> > #endif
> > .bdev_try_to_free_page = bdev_try_to_free_page,
> > + .get_fsid = ext4_get_fsid,
> > };
> >
> > static const struct super_operations ext4_nojournal_sops = {
> > @@ -1128,6 +1142,7 @@ static const struct super_operations ext4_nojournal_sops = {
> > .quota_write = ext4_quota_write,
> > #endif
> > .bdev_try_to_free_page = bdev_try_to_free_page,
> > + .get_fsid = ext4_get_fsid,
> > };
> >
>
> Hi Aneesh,
>
> Just wondering why not call sb->s_op->statfs() to get the fsid in do_sys_name_to_handle() ?
> The overhead is a little bit more code to get fsid from struct kstatfs, but we can gain,
> 1) avoid to have one more callback in struct super_operations.
> 2) more file system can be supported (since most of file systems have statfs() call back)
>

sb->s_op->statfs returns fsid of type __kernel_fsid_t which is just
64bits.

-aneesh


\
 
 \ /
  Last update: 2010-05-14 20:25    [W:0.075 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site