diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-03-07 09:29:45 -0500 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-03-07 10:13:23 -0500 |
commit | 5a1f36c90c9b21a7aa31c29a1926b376dd6a11cf (patch) | |
tree | fbf23e16f60f031720157482a9200ecdc765b4f5 /fs/ubifs | |
parent | 7ca58bad6904c721678cf2171dc78b97cc03d500 (diff) |
UBIFS: improve error messages
Ricard complaints that the following error message is odd:
"UBIFS error (pid 1578): validate_sb: bad superblock, error 8"
and he is right. This patch improves the error messages a bit and makes
them more user-friendly.
Reported-by: Ricard Wanderlof <ricard.wanderlof@axis.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/sb.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 6094c5a5d7a8..771f7fb6ce92 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -410,13 +410,23 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
410 | } | 410 | } |
411 | 411 | ||
412 | if (c->main_lebs < UBIFS_MIN_MAIN_LEBS) { | 412 | if (c->main_lebs < UBIFS_MIN_MAIN_LEBS) { |
413 | err = 7; | 413 | ubifs_err("too few main LEBs count %d, must be at least %d", |
414 | c->main_lebs, UBIFS_MIN_MAIN_LEBS); | ||
414 | goto failed; | 415 | goto failed; |
415 | } | 416 | } |
416 | 417 | ||
417 | if (c->max_bud_bytes < (long long)c->leb_size * UBIFS_MIN_BUD_LEBS || | 418 | max_bytes = (long long)c->leb_size * UBIFS_MIN_BUD_LEBS; |
418 | c->max_bud_bytes > (long long)c->leb_size * c->main_lebs) { | 419 | if (c->max_bud_bytes < max_bytes) { |
419 | err = 8; | 420 | ubifs_err("too small journal (%lld bytes), must be at least " |
421 | "%lld bytes", c->max_bud_bytes, max_bytes); | ||
422 | goto failed; | ||
423 | } | ||
424 | |||
425 | max_bytes = (long long)c->leb_size * c->main_lebs; | ||
426 | if (c->max_bud_bytes > max_bytes) { | ||
427 | ubifs_err("too large journal size (%lld bytes), only %lld bytes" | ||
428 | "available in the main area", | ||
429 | c->max_bud_bytes, max_bytes); | ||
420 | goto failed; | 430 | goto failed; |
421 | } | 431 | } |
422 | 432 | ||
@@ -450,7 +460,6 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
450 | goto failed; | 460 | goto failed; |
451 | } | 461 | } |
452 | 462 | ||
453 | max_bytes = c->main_lebs * (long long)c->leb_size; | ||
454 | if (c->rp_size < 0 || max_bytes < c->rp_size) { | 463 | if (c->rp_size < 0 || max_bytes < c->rp_size) { |
455 | err = 14; | 464 | err = 14; |
456 | goto failed; | 465 | goto failed; |