diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-06-10 09:51:32 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-06-10 11:29:52 -0400 |
commit | c289811cc096c57ff35550ee8132793a4f9b5b59 (patch) | |
tree | 47599d47419911c8365e0350e286dece1d5e48dd /fs/btrfs/volumes.c | |
parent | 451d7585a8bb1b9bec0d676ce3dece1923164e55 (diff) |
Btrfs: autodetect SSD devices
During mount, btrfs will check the queue nonrot flag
for all the devices found in the FS. If they are all
non-rotating, SSD mode is enabled by default.
If the FS was mounted with -o nossd, the non-rotating
flag is ignored.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 27d5f37b845f..3f4a5932eac9 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -605,6 +605,9 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, | |||
605 | device->in_fs_metadata = 0; | 605 | device->in_fs_metadata = 0; |
606 | device->mode = flags; | 606 | device->mode = flags; |
607 | 607 | ||
608 | if (!blk_queue_nonrot(bdev_get_queue(bdev))) | ||
609 | fs_devices->rotating = 1; | ||
610 | |||
608 | fs_devices->open_devices++; | 611 | fs_devices->open_devices++; |
609 | if (device->writeable) { | 612 | if (device->writeable) { |
610 | fs_devices->rw_devices++; | 613 | fs_devices->rw_devices++; |
@@ -1473,6 +1476,9 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1473 | root->fs_info->fs_devices->rw_devices++; | 1476 | root->fs_info->fs_devices->rw_devices++; |
1474 | root->fs_info->fs_devices->total_rw_bytes += device->total_bytes; | 1477 | root->fs_info->fs_devices->total_rw_bytes += device->total_bytes; |
1475 | 1478 | ||
1479 | if (!blk_queue_nonrot(bdev_get_queue(bdev))) | ||
1480 | root->fs_info->fs_devices->rotating = 1; | ||
1481 | |||
1476 | total_bytes = btrfs_super_total_bytes(&root->fs_info->super_copy); | 1482 | total_bytes = btrfs_super_total_bytes(&root->fs_info->super_copy); |
1477 | btrfs_set_super_total_bytes(&root->fs_info->super_copy, | 1483 | btrfs_set_super_total_bytes(&root->fs_info->super_copy, |
1478 | total_bytes + device->total_bytes); | 1484 | total_bytes + device->total_bytes); |