Skip to contentSkip to conversation

gfs2: Convert gfs2 to fs_context

PATCH In review Andrew Price 3 participants 4 messages Mar 27, 2019 – Apr 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 gfs2: Convert gfs2 to fs_context

Convert gfs2 and gfs2meta to fs_context. Removes the duplicated vfs code from gfs2_mount and instead uses the new vfs_get_block_super() before switching the ->root to the appropriate dentry.

The mount option parsing has been converted to the new API and error reporting for invalid options has been made more precise at the same time.

All of the mount/remount code has been moved into ops_fstype.c

---

v3:
- Use errorf() etc.
- Check result.negated before result.int_32 for the quota option
- Combine gfs2 and gfs2meta changes into the same patch
- Use vfs_get_block_super(), drop the duplicated vfs mount code and the test/set functions.

 fs/gfs2/incore.h     |   8 +-
 fs/gfs2/ops_fstype.c | 495 ++++++++++++++++++++++++++++++++-----------
 fs/gfs2/super.c      | 335 +----------------------------
 fs/gfs2/super.h      |   3 +-
 4 files changed, 382 insertions(+), 459 deletions(-)
fs/gfs2/incore.h +4 -4
index cdf07b408f54..10febb298da5 100644
@@ -587,10 +587,10 @@ struct gfs2_args {
 	unsigned int ar_rgrplvb:1;		/* use lvbs for rgrp info */
 	unsigned int ar_loccookie:1;		/* use location based readdir
 						   cookies */
-	int ar_commit;				/* Commit interval */
-	int ar_statfs_quantum;			/* The fast statfs interval */
-	int ar_quota_quantum;			/* The quota interval */
-	int ar_statfs_percent;			/* The % change to force sync */
+	s32 ar_commit;				/* Commit interval */
+	s32 ar_statfs_quantum;			/* The fast statfs interval */
+	s32 ar_quota_quantum;			/* The quota interval */
+	s32 ar_statfs_percent;			/* The % change to force sync */
 };
 
 struct gfs2_tune {
fs/gfs2/ops_fstype.c +376 -119

573 lines not on this page · raw message

fs/gfs2/super.c +1 -334

359 lines not on this page · raw message

fs/gfs2/super.h +1 -2
index 73c97dccae21..b9dc2065dd72 100644
@@ -27,8 +27,6 @@ static inline unsigned int gfs2_jindex_size(struct gfs2_sbd *sdp)
 
 extern void gfs2_jindex_free(struct gfs2_sbd *sdp);
 
-extern int gfs2_mount_args(struct gfs2_args *args, char *data);
-
 extern struct gfs2_jdesc *gfs2_jdesc_find(struct gfs2_sbd *sdp, unsigned int jid);
 extern int gfs2_jdesc_check(struct gfs2_jdesc *jd);
 
@@ -36,6 +34,7 @@ extern int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, char *filename,
 				     struct gfs2_inode **ipp);
 
 extern int gfs2_make_fs_rw(struct gfs2_sbd *sdp);
+extern int gfs2_make_fs_ro(struct gfs2_sbd *sdp);
 extern void gfs2_online_uevent(struct gfs2_sbd *sdp);
 extern int gfs2_statfs_init(struct gfs2_sbd *sdp);
 extern void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free,
Signature · 1 line
2.20.1
#1 lore raw
Thank you for the patch! Yet something to improve:

Hi Andrew,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on gfs2/for-next]
[also build test ERROR on v5.1-rc2 next-20190327]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrew-Price/gfs2-Convert-gfs2-to-fs_context/20190328-005647
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next
config: i386-randconfig-x008-201912 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

fs/gfs2/ops_fstype.c: In function 'gfs2_get_tree':

>> fs/gfs2/ops_fstype.c:1217:10: error: implicit declaration of function 'vfs_get_block_super'; did you mean 'vfs_get_super'? [-Werror=implicit-function-declaration]
     error = vfs_get_block_super(fc, gfs2_fill_super);
             ^~~~~~~~~~~~~~~~~~~
             vfs_get_super
   fs/gfs2/ops_fstype.c: In function 'test_meta_super':
>> fs/gfs2/ops_fstype.c:1565:12: error: 'struct fs_context' has no member named 'bdev'
     return (fc->bdev == s->s_bdev);
               ^~
   fs/gfs2/ops_fstype.c: In function 'gfs2_meta_get_tree':
   fs/gfs2/ops_fstype.c:1585:4: error: 'struct fs_context' has no member named 'bdev'
     fc->bdev = path.dentry->d_sb->s_bdev;
       ^~
   fs/gfs2/ops_fstype.c: In function 'test_meta_super':
>> fs/gfs2/ops_fstype.c:1566:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^

cc1: some warnings being treated as errors

vim +1217 fs/gfs2/ops_fstype.c

1204
1205 /**
1206 * gfs2_get_tree - Get the GFS2 superblock and root directory
1207 * @fc: The filesystem context
1208 *
1209 * Returns: 0 or -errno on error
1210 */
1211 static int gfs2_get_tree(struct fs_context *fc)
1212 {
1213 struct gfs2_args *args = fc->fs_private;
1214 struct gfs2_sbd *sdp;
1215 int error;
1216

> 1217		error = vfs_get_block_super(fc, gfs2_fill_super);

1218 if (error)
1219 return error;
1220
1221 sdp = fc->root->d_sb->s_fs_info;
1222 dput(fc->root);
1223 if (args->ar_meta)
1224 fc->root = dget(sdp->sd_master_dir);
1225 else
1226 fc->root = dget(sdp->sd_root_dir);
1227 return 0;
1228 }
1229

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 30512 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20190328/793607fd/attachment.gz>

#2 lore raw
Quoted 10 lines · kbuild test robot

Hi Andrew,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on gfs2/for-next]
[also build test ERROR on v5.1-rc2 next-20190327]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrew-Price/gfs2-Convert-gfs2-to-fs_context/20190328-005647
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next

These failures are due to the wrong base. The patch was based on David Howells' mount-api-viro branch and not the gfs2 for-next one.

Andy

Quoted 60 lines

config: i386-randconfig-x008-201912 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce:

         # save the attached .config to linux build tree
         make ARCH=i386

All error/warnings (new ones prefixed by >>):

fs/gfs2/ops_fstype.c: In function 'gfs2_get_tree':

Quoted 1 line
Quoted 1 line

fs/gfs2/ops_fstype.c:1217:10: error: implicit declaration of function 'vfs_get_block_super'; did you mean 'vfs_get_super'? [-Werror=implicit-function-declaration]

      error = vfs_get_block_super(fc, gfs2_fill_super);
              ^~~~~~~~~~~~~~~~~~~
              vfs_get_super
    fs/gfs2/ops_fstype.c: In function 'test_meta_super':
Quoted 1 line
Quoted 1 line

fs/gfs2/ops_fstype.c:1565:12: error: 'struct fs_context' has no member named 'bdev'

      return (fc->bdev == s->s_bdev);
                ^~
    fs/gfs2/ops_fstype.c: In function 'gfs2_meta_get_tree':
    fs/gfs2/ops_fstype.c:1585:4: error: 'struct fs_context' has no member named 'bdev'
      fc->bdev = path.dentry->d_sb->s_bdev;
        ^~
    fs/gfs2/ops_fstype.c: In function 'test_meta_super':
Quoted 1 line
Quoted 1 line

fs/gfs2/ops_fstype.c:1566:1: warning: control reaches end of non-void function [-Wreturn-type]

     }
     ^
    cc1: some warnings being treated as errors

vim +1217 fs/gfs2/ops_fstype.c

   1204	
   1205	/**
   1206	 * gfs2_get_tree - Get the GFS2 superblock and root directory
   1207	 * @fc: The filesystem context
   1208	 *
   1209	 * Returns: 0 or -errno on error
   1210	 */
   1211	static int gfs2_get_tree(struct fs_context *fc)
   1212	{
   1213		struct gfs2_args *args = fc->fs_private;
   1214		struct gfs2_sbd *sdp;
   1215		int error;
   1216	
Quoted 1 line

1217 error = vfs_get_block_super(fc, gfs2_fill_super);

1218 if (error)

   1219			return error;
   1220	
   1221		sdp = fc->root->d_sb->s_fs_info;
   1222		dput(fc->root);
   1223		if (args->ar_meta)
   1224			fc->root = dget(sdp->sd_master_dir);
   1225		else
   1226			fc->root = dget(sdp->sd_root_dir);
   1227		return 0;
   1228	}
   1229	

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#3 lore raw
Quoted 5 lines · Andrew Price
Quoted 4 lines · kbuild test robot

Hi Andrew,

Thank you for the patch! Yet something to improve:

Quoted 8 lines
Quoted 6 lines

[auto build test ERROR on gfs2/for-next]
[also build test ERROR on v5.1-rc2 next-20190327]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Andrew-Price/gfs2-Convert-gfs2-to-fs_context/20190328-005647
base: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next

These failures are due to the wrong base. The patch was based on David Howells' mount-api-viro branch and not the gfs2 for-next one.

Thanks for clarification! 0day-CI introduced '--base' option to record base tree info in format-patch. could you kindly add it to help robot to base on the right tree? please see https://stackoverflow.com/a/37406982

Best Regards,
Rong Chen

Quoted 67 lines

Andy

Quoted 56 lines

config: i386-randconfig-x008-201912 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce:

         # save the attached .config to linux build tree
         make ARCH=i386

All error/warnings (new ones prefixed by >>):

    fs/gfs2/ops_fstype.c: In function 'gfs2_get_tree':

Quoted 1 line
Quoted 1 line

fs/gfs2/ops_fstype.c:1217:10: error: implicit declaration of function 'vfs_get_block_super'; did you mean 'vfs_get_super'? [-Werror=implicit-function-declaration]

      error = vfs_get_block_super(fc, gfs2_fill_super); ^~~~~~~~~~~~~~~~~~~
              vfs_get_super fs/gfs2/ops_fstype.c: In function 'test_meta_super':

Quoted 1 line
Quoted 1 line

fs/gfs2/ops_fstype.c:1565:12: error: 'struct fs_context' has no member named 'bdev'

      return (fc->bdev == s->s_bdev);
                ^~
    fs/gfs2/ops_fstype.c: In function 'gfs2_meta_get_tree':
    fs/gfs2/ops_fstype.c:1585:4: error: 'struct fs_context' has no member named 'bdev' fc->bdev = path.dentry->d_sb->s_bdev;
        ^~
    fs/gfs2/ops_fstype.c: In function 'test_meta_super':

Quoted 1 line
Quoted 1 line

fs/gfs2/ops_fstype.c:1566:1: warning: control reaches end of non-void function [-Wreturn-type]

     }
     ^
    cc1: some warnings being treated as errors

vim +1217 fs/gfs2/ops_fstype.c

   1204
   1205    /**
   1206     * gfs2_get_tree - Get the GFS2 superblock and root directory 1207     * @fc: The filesystem context
   1208     *
   1209     * Returns: 0 or -errno on error
   1210     */
   1211    static int gfs2_get_tree(struct fs_context *fc) 1212    {
   1213        struct gfs2_args *args = fc->fs_private;
   1214        struct gfs2_sbd *sdp;
   1215        int error;
   1216

Quoted 1 line

1217        error = vfs_get_block_super(fc, gfs2_fill_super);

   1218        if (error)
   1219            return error;
   1220
   1221        sdp = fc->root->d_sb->s_fs_info; 1222        dput(fc->root);
   1223        if (args->ar_meta)
   1224            fc->root = dget(sdp->sd_master_dir); 1225        else
   1226            fc->root = dget(sdp->sd_root_dir); 1227        return 0;
   1228    }
   1229

Quoted 4 lines

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
kbuild-all mailing list
[email protected]
https://lists.01.org/mailman/listinfo/kbuild-all