aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2008-09-02 09:29:46 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-09-30 04:12:56 -0400
commit4793e7c5e1c88382ead18db5ca072bac54467318 (patch)
tree07e5e99d988b28fed07d5a01141169362c5a007d /fs/ubifs/super.c
parenta70948b564e9f6cb81115c606d46f5b74a77b7c2 (diff)
UBIFS: add bulk-read facility
Some flash media are capable of reading sequentially at faster rates. UBIFS bulk-read facility is designed to take advantage of that, by reading in one go consecutive data nodes that are also located consecutively in the same LEB. Read speed on Arm platform with OneNAND goes from 17 MiB/s to 19 MiB/s. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index d87b0cf5f661..b1c57e8ee855 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -401,6 +401,11 @@ static int ubifs_show_options(struct seq_file *s, struct vfsmount *mnt)
401 else if (c->mount_opts.unmount_mode == 1) 401 else if (c->mount_opts.unmount_mode == 1)
402 seq_printf(s, ",norm_unmount"); 402 seq_printf(s, ",norm_unmount");
403 403
404 if (c->mount_opts.bulk_read == 2)
405 seq_printf(s, ",bulk_read");
406 else if (c->mount_opts.bulk_read == 1)
407 seq_printf(s, ",no_bulk_read");
408
404 return 0; 409 return 0;
405} 410}
406 411
@@ -538,6 +543,18 @@ static int init_constants_early(struct ubifs_info *c)
538 * calculations when reporting free space. 543 * calculations when reporting free space.
539 */ 544 */
540 c->leb_overhead = c->leb_size % UBIFS_MAX_DATA_NODE_SZ; 545 c->leb_overhead = c->leb_size % UBIFS_MAX_DATA_NODE_SZ;
546 /* Buffer size for bulk-reads */
547 c->bulk_read_buf_size = UBIFS_MAX_BULK_READ * UBIFS_MAX_DATA_NODE_SZ;
548 if (c->bulk_read_buf_size > c->leb_size)
549 c->bulk_read_buf_size = c->leb_size;
550 if (c->bulk_read_buf_size > 128 * 1024) {
551 /* Check if we can kmalloc more than 128KiB */
552 void *try = kmalloc(c->bulk_read_buf_size, GFP_KERNEL);
553
554 kfree(try);
555 if (!try)
556 c->bulk_read_buf_size = 128 * 1024;
557 }
541 return 0; 558 return 0;
542} 559}
543 560
@@ -840,17 +857,23 @@ static int check_volume_empty(struct ubifs_info *c)
840 * 857 *
841 * Opt_fast_unmount: do not run a journal commit before un-mounting 858 * Opt_fast_unmount: do not run a journal commit before un-mounting
842 * Opt_norm_unmount: run a journal commit before un-mounting 859 * Opt_norm_unmount: run a journal commit before un-mounting
860 * Opt_bulk_read: enable bulk-reads
861 * Opt_no_bulk_read: disable bulk-reads
843 * Opt_err: just end of array marker 862 * Opt_err: just end of array marker
844 */ 863 */
845enum { 864enum {
846 Opt_fast_unmount, 865 Opt_fast_unmount,
847 Opt_norm_unmount, 866 Opt_norm_unmount,
867 Opt_bulk_read,
868 Opt_no_bulk_read,
848 Opt_err, 869 Opt_err,
849}; 870};
850 871
851static match_table_t tokens = { 872static match_table_t tokens = {
852 {Opt_fast_unmount, "fast_unmount"}, 873 {Opt_fast_unmount, "fast_unmount"},
853 {Opt_norm_unmount, "norm_unmount"}, 874 {Opt_norm_unmount, "norm_unmount"},
875 {Opt_bulk_read, "bulk_read"},
876 {Opt_no_bulk_read, "no_bulk_read"},
854 {Opt_err, NULL}, 877 {Opt_err, NULL},
855}; 878};
856 879
@@ -888,6 +911,14 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
888 c->mount_opts.unmount_mode = 1; 911 c->mount_opts.unmount_mode = 1;
889 c->fast_unmount = 0; 912 c->fast_unmount = 0;
890 break; 913 break;
914 case Opt_bulk_read:
915 c->mount_opts.bulk_read = 2;
916 c->bulk_read = 1;
917 break;
918 case Opt_no_bulk_read:
919 c->mount_opts.bulk_read = 1;
920 c->bulk_read = 0;
921 break;
891 default: 922 default:
892 ubifs_err("unrecognized mount option \"%s\" " 923 ubifs_err("unrecognized mount option \"%s\" "
893 "or missing value", p); 924 "or missing value", p);