aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-01-30 11:58:32 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-03-08 03:12:48 -0500
commit3e8e2e0c8da1f1701a8014543c951c41751791cc (patch)
treee58e0c2530b91f1809e59f3c2cdb2dee6856d338 /fs/ubifs/super.c
parentf43ec882b8b65de0ebde2e1ad52e8de0349d83ae (diff)
UBIFS: incorporate maximum write size
Incorporate maximum write size into the UBIFS description data structure. This patch just introduces new 'c->max_write_size' and 'c->max_write_shift' fields as a preparation for the following patches. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 703a62109cf2..efc327b92f98 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -507,6 +507,8 @@ static int init_constants_early(struct ubifs_info *c)
507 c->half_leb_size = c->leb_size / 2; 507 c->half_leb_size = c->leb_size / 2;
508 c->min_io_size = c->di.min_io_size; 508 c->min_io_size = c->di.min_io_size;
509 c->min_io_shift = fls(c->min_io_size) - 1; 509 c->min_io_shift = fls(c->min_io_size) - 1;
510 c->max_write_size = c->di.max_write_size;
511 c->max_write_shift = fls(c->max_write_size) - 1;
510 512
511 if (c->leb_size < UBIFS_MIN_LEB_SZ) { 513 if (c->leb_size < UBIFS_MIN_LEB_SZ) {
512 ubifs_err("too small LEBs (%d bytes), min. is %d bytes", 514 ubifs_err("too small LEBs (%d bytes), min. is %d bytes",
@@ -526,6 +528,18 @@ static int init_constants_early(struct ubifs_info *c)
526 } 528 }
527 529
528 /* 530 /*
531 * Maximum write size has to be greater or equivalent to min. I/O
532 * size, and be multiple of min. I/O size.
533 */
534 if (c->max_write_size < c->min_io_size ||
535 c->max_write_size % c->min_io_size ||
536 !is_power_of_2(c->max_write_size)) {
537 ubifs_err("bad write buffer size %d for %d min. I/O unit",
538 c->max_write_size, c->min_io_size);
539 return -EINVAL;
540 }
541
542 /*
529 * UBIFS aligns all node to 8-byte boundary, so to make function in 543 * UBIFS aligns all node to 8-byte boundary, so to make function in
530 * io.c simpler, assume minimum I/O unit size to be 8 bytes if it is 544 * io.c simpler, assume minimum I/O unit size to be 8 bytes if it is
531 * less than 8. 545 * less than 8.
@@ -533,6 +547,10 @@ static int init_constants_early(struct ubifs_info *c)
533 if (c->min_io_size < 8) { 547 if (c->min_io_size < 8) {
534 c->min_io_size = 8; 548 c->min_io_size = 8;
535 c->min_io_shift = 3; 549 c->min_io_shift = 3;
550 if (c->max_write_size < c->min_io_size) {
551 c->max_write_size = c->min_io_size;
552 c->max_write_shift = c->min_io_shift;
553 }
536 } 554 }
537 555
538 c->ref_node_alsz = ALIGN(UBIFS_REF_NODE_SZ, c->min_io_size); 556 c->ref_node_alsz = ALIGN(UBIFS_REF_NODE_SZ, c->min_io_size);
@@ -1391,6 +1409,7 @@ static int mount_ubifs(struct ubifs_info *c)
1391 1409
1392 dbg_msg("compiled on: " __DATE__ " at " __TIME__); 1410 dbg_msg("compiled on: " __DATE__ " at " __TIME__);
1393 dbg_msg("min. I/O unit size: %d bytes", c->min_io_size); 1411 dbg_msg("min. I/O unit size: %d bytes", c->min_io_size);
1412 dbg_msg("max. write size: %d bytes", c->max_write_size);
1394 dbg_msg("LEB size: %d bytes (%d KiB)", 1413 dbg_msg("LEB size: %d bytes (%d KiB)",
1395 c->leb_size, c->leb_size >> 10); 1414 c->leb_size, c->leb_size >> 10);
1396 dbg_msg("data journal heads: %d", 1415 dbg_msg("data journal heads: %d",