aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
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);