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/disk-io.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/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e572cf478a5d..f4dfbb7ab496 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1850,6 +1850,14 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1850 | if (IS_ERR(fs_info->transaction_kthread)) | 1850 | if (IS_ERR(fs_info->transaction_kthread)) |
1851 | goto fail_cleaner; | 1851 | goto fail_cleaner; |
1852 | 1852 | ||
1853 | if (!btrfs_test_opt(tree_root, SSD) && | ||
1854 | !btrfs_test_opt(tree_root, NOSSD) && | ||
1855 | !fs_info->fs_devices->rotating) { | ||
1856 | printk(KERN_INFO "Btrfs detected SSD devices, enabling SSD " | ||
1857 | "mode\n"); | ||
1858 | btrfs_set_opt(fs_info->mount_opt, SSD); | ||
1859 | } | ||
1860 | |||
1853 | if (btrfs_super_log_root(disk_super) != 0) { | 1861 | if (btrfs_super_log_root(disk_super) != 0) { |
1854 | u64 bytenr = btrfs_super_log_root(disk_super); | 1862 | u64 bytenr = btrfs_super_log_root(disk_super); |
1855 | 1863 | ||
@@ -1893,6 +1901,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1893 | fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location); | 1901 | fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location); |
1894 | if (!fs_info->fs_root) | 1902 | if (!fs_info->fs_root) |
1895 | goto fail_trans_kthread; | 1903 | goto fail_trans_kthread; |
1904 | |||
1896 | return tree_root; | 1905 | return tree_root; |
1897 | 1906 | ||
1898 | fail_trans_kthread: | 1907 | fail_trans_kthread: |