diff options
author | Adrian Hunter <ext-adrian.hunter@nokia.com> | 2008-09-04 09:26:00 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-09-30 04:12:56 -0400 |
commit | 2953e73f1ce4b3284b409aefb9d46bbde6515c37 (patch) | |
tree | 56126c6a589bd0450eb288db6a93946e50e5bc29 /fs/ubifs/super.c | |
parent | 4793e7c5e1c88382ead18db5ca072bac54467318 (diff) |
UBIFS: add no_chk_data_crc mount option
UBIFS read performance can be improved by skipping the CRC
check when data nodes are read. This option can be used if
the underlying media is considered to be highly reliable.
Note that CRCs are always checked for metadata.
Read speed on Arm platform with OneNAND goes from 19 MiB/s
to 27 MiB/s with data CRC checking disabled.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r-- | fs/ubifs/super.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index b1c57e8ee855..cf078b5cc88c 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -406,6 +406,11 @@ static int ubifs_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
406 | else if (c->mount_opts.bulk_read == 1) | 406 | else if (c->mount_opts.bulk_read == 1) |
407 | seq_printf(s, ",no_bulk_read"); | 407 | seq_printf(s, ",no_bulk_read"); |
408 | 408 | ||
409 | if (c->mount_opts.chk_data_crc == 2) | ||
410 | seq_printf(s, ",chk_data_crc"); | ||
411 | else if (c->mount_opts.chk_data_crc == 1) | ||
412 | seq_printf(s, ",no_chk_data_crc"); | ||
413 | |||
409 | return 0; | 414 | return 0; |
410 | } | 415 | } |
411 | 416 | ||
@@ -859,6 +864,8 @@ static int check_volume_empty(struct ubifs_info *c) | |||
859 | * Opt_norm_unmount: run a journal commit before un-mounting | 864 | * Opt_norm_unmount: run a journal commit before un-mounting |
860 | * Opt_bulk_read: enable bulk-reads | 865 | * Opt_bulk_read: enable bulk-reads |
861 | * Opt_no_bulk_read: disable bulk-reads | 866 | * Opt_no_bulk_read: disable bulk-reads |
867 | * Opt_chk_data_crc: check CRCs when reading data nodes | ||
868 | * Opt_no_chk_data_crc: do not check CRCs when reading data nodes | ||
862 | * Opt_err: just end of array marker | 869 | * Opt_err: just end of array marker |
863 | */ | 870 | */ |
864 | enum { | 871 | enum { |
@@ -866,6 +873,8 @@ enum { | |||
866 | Opt_norm_unmount, | 873 | Opt_norm_unmount, |
867 | Opt_bulk_read, | 874 | Opt_bulk_read, |
868 | Opt_no_bulk_read, | 875 | Opt_no_bulk_read, |
876 | Opt_chk_data_crc, | ||
877 | Opt_no_chk_data_crc, | ||
869 | Opt_err, | 878 | Opt_err, |
870 | }; | 879 | }; |
871 | 880 | ||
@@ -874,6 +883,8 @@ static match_table_t tokens = { | |||
874 | {Opt_norm_unmount, "norm_unmount"}, | 883 | {Opt_norm_unmount, "norm_unmount"}, |
875 | {Opt_bulk_read, "bulk_read"}, | 884 | {Opt_bulk_read, "bulk_read"}, |
876 | {Opt_no_bulk_read, "no_bulk_read"}, | 885 | {Opt_no_bulk_read, "no_bulk_read"}, |
886 | {Opt_chk_data_crc, "chk_data_crc"}, | ||
887 | {Opt_no_chk_data_crc, "no_chk_data_crc"}, | ||
877 | {Opt_err, NULL}, | 888 | {Opt_err, NULL}, |
878 | }; | 889 | }; |
879 | 890 | ||
@@ -919,6 +930,14 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, | |||
919 | c->mount_opts.bulk_read = 1; | 930 | c->mount_opts.bulk_read = 1; |
920 | c->bulk_read = 0; | 931 | c->bulk_read = 0; |
921 | break; | 932 | break; |
933 | case Opt_chk_data_crc: | ||
934 | c->mount_opts.chk_data_crc = 2; | ||
935 | c->no_chk_data_crc = 0; | ||
936 | break; | ||
937 | case Opt_no_chk_data_crc: | ||
938 | c->mount_opts.chk_data_crc = 1; | ||
939 | c->no_chk_data_crc = 1; | ||
940 | break; | ||
922 | default: | 941 | default: |
923 | ubifs_err("unrecognized mount option \"%s\" " | 942 | ubifs_err("unrecognized mount option \"%s\" " |
924 | "or missing value", p); | 943 | "or missing value", p); |
@@ -1027,6 +1046,8 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1027 | goto out_free; | 1046 | goto out_free; |
1028 | } | 1047 | } |
1029 | 1048 | ||
1049 | c->always_chk_crc = 1; | ||
1050 | |||
1030 | err = ubifs_read_superblock(c); | 1051 | err = ubifs_read_superblock(c); |
1031 | if (err) | 1052 | if (err) |
1032 | goto out_free; | 1053 | goto out_free; |
@@ -1168,6 +1189,8 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1168 | if (err) | 1189 | if (err) |
1169 | goto out_infos; | 1190 | goto out_infos; |
1170 | 1191 | ||
1192 | c->always_chk_crc = 0; | ||
1193 | |||
1171 | ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"", | 1194 | ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"", |
1172 | c->vi.ubi_num, c->vi.vol_id, c->vi.name); | 1195 | c->vi.ubi_num, c->vi.vol_id, c->vi.name); |
1173 | if (mounted_read_only) | 1196 | if (mounted_read_only) |
@@ -1313,6 +1336,7 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1313 | 1336 | ||
1314 | mutex_lock(&c->umount_mutex); | 1337 | mutex_lock(&c->umount_mutex); |
1315 | c->remounting_rw = 1; | 1338 | c->remounting_rw = 1; |
1339 | c->always_chk_crc = 1; | ||
1316 | 1340 | ||
1317 | /* Check for enough free space */ | 1341 | /* Check for enough free space */ |
1318 | if (ubifs_calc_available(c, c->min_idx_lebs) <= 0) { | 1342 | if (ubifs_calc_available(c, c->min_idx_lebs) <= 0) { |
@@ -1381,13 +1405,15 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1381 | c->bgt = NULL; | 1405 | c->bgt = NULL; |
1382 | ubifs_err("cannot spawn \"%s\", error %d", | 1406 | ubifs_err("cannot spawn \"%s\", error %d", |
1383 | c->bgt_name, err); | 1407 | c->bgt_name, err); |
1384 | return err; | 1408 | goto out; |
1385 | } | 1409 | } |
1386 | wake_up_process(c->bgt); | 1410 | wake_up_process(c->bgt); |
1387 | 1411 | ||
1388 | c->orph_buf = vmalloc(c->leb_size); | 1412 | c->orph_buf = vmalloc(c->leb_size); |
1389 | if (!c->orph_buf) | 1413 | if (!c->orph_buf) { |
1390 | return -ENOMEM; | 1414 | err = -ENOMEM; |
1415 | goto out; | ||
1416 | } | ||
1391 | 1417 | ||
1392 | /* Check for enough log space */ | 1418 | /* Check for enough log space */ |
1393 | lnum = c->lhead_lnum + 1; | 1419 | lnum = c->lhead_lnum + 1; |
@@ -1414,6 +1440,7 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1414 | dbg_gen("re-mounted read-write"); | 1440 | dbg_gen("re-mounted read-write"); |
1415 | c->vfs_sb->s_flags &= ~MS_RDONLY; | 1441 | c->vfs_sb->s_flags &= ~MS_RDONLY; |
1416 | c->remounting_rw = 0; | 1442 | c->remounting_rw = 0; |
1443 | c->always_chk_crc = 0; | ||
1417 | mutex_unlock(&c->umount_mutex); | 1444 | mutex_unlock(&c->umount_mutex); |
1418 | return 0; | 1445 | return 0; |
1419 | 1446 | ||
@@ -1429,6 +1456,7 @@ out: | |||
1429 | c->ileb_buf = NULL; | 1456 | c->ileb_buf = NULL; |
1430 | ubifs_lpt_free(c, 1); | 1457 | ubifs_lpt_free(c, 1); |
1431 | c->remounting_rw = 0; | 1458 | c->remounting_rw = 0; |
1459 | c->always_chk_crc = 0; | ||
1432 | mutex_unlock(&c->umount_mutex); | 1460 | mutex_unlock(&c->umount_mutex); |
1433 | return err; | 1461 | return err; |
1434 | } | 1462 | } |