aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-07-26 08:03:58 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-10-29 04:17:16 -0400
commit8bcbbf0009dd467afd6bed1fedfcb1d2463f55a7 (patch)
tree0913df26841e57371f44133aa95272981a78ed52
parentf7442b3be65bfcabbb5d6e896e65d69e8b261583 (diff)
convert gfs2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/gfs2/ops_fstype.c51
1 files changed, 22 insertions, 29 deletions
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index cade1acbcea9..3eb1393f7b81 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1250,12 +1250,11 @@ static int test_gfs2_super(struct super_block *s, void *ptr)
1250} 1250}
1251 1251
1252/** 1252/**
1253 * gfs2_get_sb - Get the GFS2 superblock 1253 * gfs2_mount - Get the GFS2 superblock
1254 * @fs_type: The GFS2 filesystem type 1254 * @fs_type: The GFS2 filesystem type
1255 * @flags: Mount flags 1255 * @flags: Mount flags
1256 * @dev_name: The name of the device 1256 * @dev_name: The name of the device
1257 * @data: The mount arguments 1257 * @data: The mount arguments
1258 * @mnt: The vfsmnt for this mount
1259 * 1258 *
1260 * Q. Why not use get_sb_bdev() ? 1259 * Q. Why not use get_sb_bdev() ?
1261 * A. We need to select one of two root directories to mount, independent 1260 * A. We need to select one of two root directories to mount, independent
@@ -1264,8 +1263,8 @@ static int test_gfs2_super(struct super_block *s, void *ptr)
1264 * Returns: 0 or -ve on error 1263 * Returns: 0 or -ve on error
1265 */ 1264 */
1266 1265
1267static int gfs2_get_sb(struct file_system_type *fs_type, int flags, 1266static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
1268 const char *dev_name, void *data, struct vfsmount *mnt) 1267 const char *dev_name, void *data)
1269{ 1268{
1270 struct block_device *bdev; 1269 struct block_device *bdev;
1271 struct super_block *s; 1270 struct super_block *s;
@@ -1279,7 +1278,7 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
1279 1278
1280 bdev = open_bdev_exclusive(dev_name, mode, fs_type); 1279 bdev = open_bdev_exclusive(dev_name, mode, fs_type);
1281 if (IS_ERR(bdev)) 1280 if (IS_ERR(bdev))
1282 return PTR_ERR(bdev); 1281 return ERR_CAST(bdev);
1283 1282
1284 /* 1283 /*
1285 * once the super is inserted into the list by sget, s_umount 1284 * once the super is inserted into the list by sget, s_umount
@@ -1298,6 +1297,9 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
1298 if (IS_ERR(s)) 1297 if (IS_ERR(s))
1299 goto error_bdev; 1298 goto error_bdev;
1300 1299
1300 if (s->s_root)
1301 close_bdev_exclusive(bdev, mode);
1302
1301 memset(&args, 0, sizeof(args)); 1303 memset(&args, 0, sizeof(args));
1302 args.ar_quota = GFS2_QUOTA_DEFAULT; 1304 args.ar_quota = GFS2_QUOTA_DEFAULT;
1303 args.ar_data = GFS2_DATA_DEFAULT; 1305 args.ar_data = GFS2_DATA_DEFAULT;
@@ -1309,17 +1311,13 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
1309 error = gfs2_mount_args(&args, data); 1311 error = gfs2_mount_args(&args, data);
1310 if (error) { 1312 if (error) {
1311 printk(KERN_WARNING "GFS2: can't parse mount arguments\n"); 1313 printk(KERN_WARNING "GFS2: can't parse mount arguments\n");
1312 if (s->s_root) 1314 goto error_super;
1313 goto error_super;
1314 deactivate_locked_super(s);
1315 return error;
1316 } 1315 }
1317 1316
1318 if (s->s_root) { 1317 if (s->s_root) {
1319 error = -EBUSY; 1318 error = -EBUSY;
1320 if ((flags ^ s->s_flags) & MS_RDONLY) 1319 if ((flags ^ s->s_flags) & MS_RDONLY)
1321 goto error_super; 1320 goto error_super;
1322 close_bdev_exclusive(bdev, mode);
1323 } else { 1321 } else {
1324 char b[BDEVNAME_SIZE]; 1322 char b[BDEVNAME_SIZE];
1325 1323
@@ -1328,27 +1326,24 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
1328 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); 1326 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
1329 sb_set_blocksize(s, block_size(bdev)); 1327 sb_set_blocksize(s, block_size(bdev));
1330 error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0); 1328 error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0);
1331 if (error) { 1329 if (error)
1332 deactivate_locked_super(s); 1330 goto error_super;
1333 return error;
1334 }
1335 s->s_flags |= MS_ACTIVE; 1331 s->s_flags |= MS_ACTIVE;
1336 bdev->bd_super = s; 1332 bdev->bd_super = s;
1337 } 1333 }
1338 1334
1339 sdp = s->s_fs_info; 1335 sdp = s->s_fs_info;
1340 mnt->mnt_sb = s;
1341 if (args.ar_meta) 1336 if (args.ar_meta)
1342 mnt->mnt_root = dget(sdp->sd_master_dir); 1337 return dget(sdp->sd_master_dir);
1343 else 1338 else
1344 mnt->mnt_root = dget(sdp->sd_root_dir); 1339 return dget(sdp->sd_root_dir);
1345 return 0;
1346 1340
1347error_super: 1341error_super:
1348 deactivate_locked_super(s); 1342 deactivate_locked_super(s);
1343 return ERR_PTR(error);
1349error_bdev: 1344error_bdev:
1350 close_bdev_exclusive(bdev, mode); 1345 close_bdev_exclusive(bdev, mode);
1351 return error; 1346 return ERR_PTR(error);
1352} 1347}
1353 1348
1354static int set_meta_super(struct super_block *s, void *ptr) 1349static int set_meta_super(struct super_block *s, void *ptr)
@@ -1356,8 +1351,8 @@ static int set_meta_super(struct super_block *s, void *ptr)
1356 return -EINVAL; 1351 return -EINVAL;
1357} 1352}
1358 1353
1359static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, 1354static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
1360 const char *dev_name, void *data, struct vfsmount *mnt) 1355 int flags, const char *dev_name, void *data)
1361{ 1356{
1362 struct super_block *s; 1357 struct super_block *s;
1363 struct gfs2_sbd *sdp; 1358 struct gfs2_sbd *sdp;
@@ -1368,23 +1363,21 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
1368 if (error) { 1363 if (error) {
1369 printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n", 1364 printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
1370 dev_name, error); 1365 dev_name, error);
1371 return error; 1366 return ERR_PTR(error);
1372 } 1367 }
1373 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, 1368 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super,
1374 path.dentry->d_inode->i_sb->s_bdev); 1369 path.dentry->d_inode->i_sb->s_bdev);
1375 path_put(&path); 1370 path_put(&path);
1376 if (IS_ERR(s)) { 1371 if (IS_ERR(s)) {
1377 printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n"); 1372 printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
1378 return PTR_ERR(s); 1373 return ERR_CAST(s);
1379 } 1374 }
1380 if ((flags ^ s->s_flags) & MS_RDONLY) { 1375 if ((flags ^ s->s_flags) & MS_RDONLY) {
1381 deactivate_locked_super(s); 1376 deactivate_locked_super(s);
1382 return -EBUSY; 1377 return ERR_PTR(-EBUSY);
1383 } 1378 }
1384 sdp = s->s_fs_info; 1379 sdp = s->s_fs_info;
1385 mnt->mnt_sb = s; 1380 return dget(sdp->sd_master_dir);
1386 mnt->mnt_root = dget(sdp->sd_master_dir);
1387 return 0;
1388} 1381}
1389 1382
1390static void gfs2_kill_sb(struct super_block *sb) 1383static void gfs2_kill_sb(struct super_block *sb)
@@ -1410,7 +1403,7 @@ static void gfs2_kill_sb(struct super_block *sb)
1410struct file_system_type gfs2_fs_type = { 1403struct file_system_type gfs2_fs_type = {
1411 .name = "gfs2", 1404 .name = "gfs2",
1412 .fs_flags = FS_REQUIRES_DEV, 1405 .fs_flags = FS_REQUIRES_DEV,
1413 .get_sb = gfs2_get_sb, 1406 .mount = gfs2_mount,
1414 .kill_sb = gfs2_kill_sb, 1407 .kill_sb = gfs2_kill_sb,
1415 .owner = THIS_MODULE, 1408 .owner = THIS_MODULE,
1416}; 1409};
@@ -1418,7 +1411,7 @@ struct file_system_type gfs2_fs_type = {
1418struct file_system_type gfs2meta_fs_type = { 1411struct file_system_type gfs2meta_fs_type = {
1419 .name = "gfs2meta", 1412 .name = "gfs2meta",
1420 .fs_flags = FS_REQUIRES_DEV, 1413 .fs_flags = FS_REQUIRES_DEV,
1421 .get_sb = gfs2_get_sb_meta, 1414 .mount = gfs2_mount_meta,
1422 .owner = THIS_MODULE, 1415 .owner = THIS_MODULE,
1423}; 1416};
1424 1417