aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-12-02 06:36:09 -0500
committerChris Mason <chris.mason@oracle.com>2008-12-02 06:36:09 -0500
commit97288f2c71e46965a2010baea10548fcb5f3af73 (patch)
tree6f84cd33ee12eb8c51cccf931671da1b149c4ba6 /fs
parent6e430f94e508fee1aefd1dfec88da3c24ce64433 (diff)
Btrfs: corret fmode_t annotations
Make sure to propagate fmode_t properly and use the right constants for it. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/super.c14
-rw-r--r--fs/btrfs/volumes.c18
-rw-r--r--fs/btrfs/volumes.h4
3 files changed, 20 insertions, 16 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 93a21c77064a..09908f25fca9 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -242,7 +242,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
242 * All other options will be parsed on much later in the mount process and 242 * All other options will be parsed on much later in the mount process and
243 * only when we need to allocate a new super block. 243 * only when we need to allocate a new super block.
244 */ 244 */
245static int btrfs_parse_early_options(const char *options, int flags, 245static int btrfs_parse_early_options(const char *options, fmode_t flags,
246 void *holder, char **subvol_name, 246 void *holder, char **subvol_name,
247 struct btrfs_fs_devices **fs_devices) 247 struct btrfs_fs_devices **fs_devices)
248{ 248{
@@ -418,18 +418,22 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
418 struct super_block *s; 418 struct super_block *s;
419 struct dentry *root; 419 struct dentry *root;
420 struct btrfs_fs_devices *fs_devices = NULL; 420 struct btrfs_fs_devices *fs_devices = NULL;
421 fmode_t mode = FMODE_READ;
421 int error = 0; 422 int error = 0;
422 423
423 error = btrfs_parse_early_options(data, flags, fs_type, 424 if (!(flags & MS_RDONLY))
425 mode |= FMODE_WRITE;
426
427 error = btrfs_parse_early_options(data, mode, fs_type,
424 &subvol_name, &fs_devices); 428 &subvol_name, &fs_devices);
425 if (error) 429 if (error)
426 goto error; 430 goto error;
427 431
428 error = btrfs_scan_one_device(dev_name, flags, fs_type, &fs_devices); 432 error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices);
429 if (error) 433 if (error)
430 goto error_free_subvol_name; 434 goto error_free_subvol_name;
431 435
432 error = btrfs_open_devices(fs_devices, flags, fs_type); 436 error = btrfs_open_devices(fs_devices, mode, fs_type);
433 if (error) 437 if (error)
434 goto error_free_subvol_name; 438 goto error_free_subvol_name;
435 439
@@ -591,7 +595,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
591 len = strnlen(vol->name, BTRFS_PATH_NAME_MAX); 595 len = strnlen(vol->name, BTRFS_PATH_NAME_MAX);
592 switch (cmd) { 596 switch (cmd) {
593 case BTRFS_IOC_SCAN_DEV: 597 case BTRFS_IOC_SCAN_DEV:
594 ret = btrfs_scan_one_device(vol->name, MS_RDONLY, 598 ret = btrfs_scan_one_device(vol->name, FMODE_READ,
595 &btrfs_fs_type, &fs_devices); 599 &btrfs_fs_type, &fs_devices);
596 break; 600 break;
597 } 601 }
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 769f2c5d9e9e..6c523b3360f6 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -394,7 +394,7 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
394} 394}
395 395
396int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, 396int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
397 int flags, void *holder) 397 fmode_t flags, void *holder)
398{ 398{
399 struct block_device *bdev; 399 struct block_device *bdev;
400 struct list_head *head = &fs_devices->devices; 400 struct list_head *head = &fs_devices->devices;
@@ -469,7 +469,7 @@ int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
469error_brelse: 469error_brelse:
470 brelse(bh); 470 brelse(bh);
471error_close: 471error_close:
472 close_bdev_exclusive(bdev, MS_RDONLY); 472 close_bdev_exclusive(bdev, FMODE_READ);
473error: 473error:
474 continue; 474 continue;
475 } 475 }
@@ -488,7 +488,7 @@ out:
488} 488}
489 489
490int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, 490int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
491 int flags, void *holder) 491 fmode_t flags, void *holder)
492{ 492{
493 int ret; 493 int ret;
494 494
@@ -507,7 +507,7 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
507 return ret; 507 return ret;
508} 508}
509 509
510int btrfs_scan_one_device(const char *path, int flags, void *holder, 510int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
511 struct btrfs_fs_devices **fs_devices_ret) 511 struct btrfs_fs_devices **fs_devices_ret)
512{ 512{
513 struct btrfs_super_block *disk_super; 513 struct btrfs_super_block *disk_super;
@@ -1008,7 +1008,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
1008 goto out; 1008 goto out;
1009 } 1009 }
1010 } else { 1010 } else {
1011 bdev = open_bdev_exclusive(device_path, MS_RDONLY, 1011 bdev = open_bdev_exclusive(device_path, FMODE_READ,
1012 root->fs_info->bdev_holder); 1012 root->fs_info->bdev_holder);
1013 if (IS_ERR(bdev)) { 1013 if (IS_ERR(bdev)) {
1014 ret = PTR_ERR(bdev); 1014 ret = PTR_ERR(bdev);
@@ -1078,7 +1078,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
1078 BUG_ON(device->writeable); 1078 BUG_ON(device->writeable);
1079 brelse(bh); 1079 brelse(bh);
1080 if (bdev) 1080 if (bdev)
1081 close_bdev_exclusive(bdev, MS_RDONLY); 1081 close_bdev_exclusive(bdev, FMODE_READ);
1082 1082
1083 if (device->bdev) { 1083 if (device->bdev) {
1084 close_bdev_exclusive(device->bdev, device->mode); 1084 close_bdev_exclusive(device->bdev, device->mode);
@@ -1121,7 +1121,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
1121 } 1121 }
1122 if (bdev) { 1122 if (bdev) {
1123 /* one close for us */ 1123 /* one close for us */
1124 close_bdev_exclusive(bdev, MS_RDONLY); 1124 close_bdev_exclusive(bdev, FMODE_READ);
1125 } 1125 }
1126 kfree(device->name); 1126 kfree(device->name);
1127 kfree(device); 1127 kfree(device);
@@ -1132,7 +1132,7 @@ error_brelse:
1132 brelse(bh); 1132 brelse(bh);
1133error_close: 1133error_close:
1134 if (bdev) 1134 if (bdev)
1135 close_bdev_exclusive(bdev, MS_RDONLY); 1135 close_bdev_exclusive(bdev, FMODE_READ);
1136out: 1136out:
1137 mutex_unlock(&root->fs_info->volume_mutex); 1137 mutex_unlock(&root->fs_info->volume_mutex);
1138 mutex_unlock(&uuid_mutex); 1138 mutex_unlock(&uuid_mutex);
@@ -2913,7 +2913,7 @@ static int open_seed_devices(struct btrfs_root *root, u8 *fsid)
2913 goto out; 2913 goto out;
2914 } 2914 }
2915 2915
2916 ret = __btrfs_open_devices(fs_devices, MS_RDONLY, 2916 ret = __btrfs_open_devices(fs_devices, FMODE_READ,
2917 root->fs_info->bdev_holder); 2917 root->fs_info->bdev_holder);
2918 if (ret) 2918 if (ret)
2919 goto out; 2919 goto out;
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 9b41e4d3984d..fcbdcb3ae13e 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -135,8 +135,8 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
135 int mirror_num, int async_submit); 135 int mirror_num, int async_submit);
136int btrfs_read_super_device(struct btrfs_root *root, struct extent_buffer *buf); 136int btrfs_read_super_device(struct btrfs_root *root, struct extent_buffer *buf);
137int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, 137int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
138 int flags, void *holder); 138 fmode_t flags, void *holder);
139int btrfs_scan_one_device(const char *path, int flags, void *holder, 139int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
140 struct btrfs_fs_devices **fs_devices_ret); 140 struct btrfs_fs_devices **fs_devices_ret);
141int btrfs_close_devices(struct btrfs_fs_devices *fs_devices); 141int btrfs_close_devices(struct btrfs_fs_devices *fs_devices);
142int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices); 142int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices);