Hi David, On 2018/7/31 15:38, Chao Yu wrote: > Hi David, > > Could you please help to check this patch as well? >
If you don't mind seeing more code, the patched code of super/inode.c can also be accessed at https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/tree/drivers/staging/erofs/super.c?h=erofs-dev https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/tree/drivers/staging/erofs/inode.c?h=erofs-dev It will be of great help...Thank you.. Thanks, Gao Xiang > Thanks, > > On 2018/7/30 17:18, Gao Xiang wrote: >> This patch updates .mount and .remount_sb after >> commit 286c6b145729 ("vfs: Require specification >> of size of mount data for internal mounts"). >> >> Signed-off-by: Gao Xiang <[email protected]> >> --- >> >> - Tested with images generated by mkfs.erofs: >> 1) mount and unmount operations >> 2) md5sum `find . -type f` >> >> drivers/staging/erofs/internal.h | 1 - >> drivers/staging/erofs/super.c | 61 >> +++++++++++----------------------------- >> 2 files changed, 16 insertions(+), 46 deletions(-) >> >> diff --git a/drivers/staging/erofs/internal.h >> b/drivers/staging/erofs/internal.h >> index 367b39f..9074a56 100644 >> --- a/drivers/staging/erofs/internal.h >> +++ b/drivers/staging/erofs/internal.h >> @@ -111,7 +111,6 @@ struct erofs_sb_info { >> >> u8 uuid[16]; /* 128-bit uuid for volume */ >> u8 volume_name[16]; /* volume name */ >> - char *dev_name; >> >> unsigned int mount_opt; >> unsigned int shrinker_run_no; >> diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c >> index ae1eb20..190a538 100644 >> --- a/drivers/staging/erofs/super.c >> +++ b/drivers/staging/erofs/super.c >> @@ -313,14 +313,18 @@ static struct inode *erofs_init_managed_cache(struct >> super_block *sb) >> >> #endif >> >> -static int erofs_read_super(struct super_block *sb, >> - const char *dev_name, void *data, int silent) >> +static int erofs_read_super(struct super_block *sb, void *data, >> + size_t data_size, int silent) >> { >> struct inode *inode; >> struct erofs_sb_info *sbi; >> + char b[BDEVNAME_SIZE]; >> int err = -EINVAL; >> >> - infoln("read_super, device -> %s", dev_name); >> + /* get the block device name */ >> + bdevname(sb->s_bdev, b); >> + >> + infoln("read_super, device -> %s", b); >> infoln("options -> %s", (char *)data); >> >> if (unlikely(!sb_set_blocksize(sb, EROFS_BLKSIZ))) { >> @@ -392,16 +396,6 @@ static int erofs_read_super(struct super_block *sb, >> goto err_makeroot; >> } >> >> - /* save the device name to sbi */ >> - sbi->dev_name = __getname(); >> - if (sbi->dev_name == NULL) { >> - err = -ENOMEM; >> - goto err_devname; >> - } >> - >> - snprintf(sbi->dev_name, PATH_MAX, "%s", dev_name); >> - sbi->dev_name[PATH_MAX - 1] = '\0'; >> - >> erofs_register_super(sb); >> >> /* >> @@ -411,15 +405,13 @@ static int erofs_read_super(struct super_block *sb, >> d_rehash(sb->s_root); >> >> if (!silent) >> - infoln("mounted on %s with opts: %s.", dev_name, >> - (char *)data); >> + infoln("mounted on %s with opts: %s.", b, (char *)data); >> return 0; >> /* >> * please add a label for each exit point and use >> * the following name convention, thus new features >> * can be integrated easily without renaming labels. >> */ >> -err_devname: >> dput(sb->s_root); >> err_makeroot: >> err_isdir: >> @@ -445,6 +437,7 @@ static int erofs_read_super(struct super_block *sb, >> static void erofs_put_super(struct super_block *sb) >> { >> struct erofs_sb_info *sbi = EROFS_SB(sb); >> + char b[BDEVNAME_SIZE]; >> >> /* for cases which are failed in "read_super" */ >> if (sbi == NULL) >> @@ -452,8 +445,7 @@ static void erofs_put_super(struct super_block *sb) >> >> WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC); >> >> - infoln("unmounted for %s", sbi->dev_name); >> - __putname(sbi->dev_name); >> + infoln("unmounted for %s", bdevname(sb->s_bdev, b)); >> >> #ifdef EROFS_FS_HAS_MANAGED_CACHE >> iput(sbi->managed_cache); >> @@ -472,33 +464,11 @@ static void erofs_put_super(struct super_block *sb) >> sb->s_fs_info = NULL; >> } >> >> - >> -struct erofs_mount_private { >> - const char *dev_name; >> - char *options; >> -}; >> - >> -/* support mount_bdev() with options */ >> -static int erofs_fill_super(struct super_block *sb, >> - void *_priv, int silent) >> -{ >> - struct erofs_mount_private *priv = _priv; >> - >> - return erofs_read_super(sb, priv->dev_name, >> - priv->options, silent); >> -} >> - >> -static struct dentry *erofs_mount( >> - struct file_system_type *fs_type, int flags, >> - const char *dev_name, void *data) >> +static struct dentry *erofs_mount(struct file_system_type *fs_type, int >> flags, >> + const char *dev_name, void *data, size_t data_size) >> { >> - struct erofs_mount_private priv = { >> - .dev_name = dev_name, >> - .options = data >> - }; >> - >> - return mount_bdev(fs_type, flags, dev_name, >> - &priv, erofs_fill_super); >> + return mount_bdev(fs_type, flags, dev_name, data, data_size, >> + erofs_read_super); >> } >> >> static void erofs_kill_sb(struct super_block *sb) >> @@ -623,7 +593,8 @@ static int erofs_show_options(struct seq_file *seq, >> struct dentry *root) >> return 0; >> } >> >> -static int erofs_remount(struct super_block *sb, int *flags, char *data) >> +static int erofs_remount(struct super_block *sb, int *flags, >> + char *data, size_t data_size) >> { >> BUG_ON(!sb_rdonly(sb)); >> >> >
