]> www.infradead.org Git - mtd-utils.git/commitdiff
ubifs-utils: Adapt log.c in libubifs
authorZhihao Cheng <chengzhihao1@huawei.com>
Mon, 11 Nov 2024 08:37:01 +0000 (16:37 +0800)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Mon, 11 Nov 2024 09:32:45 +0000 (10:32 +0100)
Adapt log.c in libubifs, compared with linux kernel implementations:
 1. Remove debug related implementations(eg. dbg_check_bud_bytes), debug
    functions are not needed by fsck, because fsck will check fs in
    another way.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
ubifs-utils/libubifs/log.c

index b6ac9c4281ef1d22fe6920e587dcb5d47672311a..0d45926100e88ff222a88b312d5c775b2cbaa592 100644 (file)
  * journal.
  */
 
+#include "linux_err.h"
+#include "bitops.h"
+#include "kmem.h"
 #include "ubifs.h"
+#include "defs.h"
+#include "debug.h"
+#include "misc.h"
 
 static int dbg_check_bud_bytes(struct ubifs_info *c);
 
@@ -737,26 +743,7 @@ out_free:
  * ('c->bud_bytes' is correct). Returns zero in case of success and %-EINVAL in
  * case of failure.
  */
-static int dbg_check_bud_bytes(struct ubifs_info *c)
+static int dbg_check_bud_bytes(__unused struct ubifs_info *c)
 {
-       int i, err = 0;
-       struct ubifs_bud *bud;
-       long long bud_bytes = 0;
-
-       if (!dbg_is_chk_gen(c))
-               return 0;
-
-       spin_lock(&c->buds_lock);
-       for (i = 0; i < c->jhead_cnt; i++)
-               list_for_each_entry(bud, &c->jheads[i].buds_list, list)
-                       bud_bytes += c->leb_size - bud->start;
-
-       if (c->bud_bytes != bud_bytes) {
-               ubifs_err(c, "bad bud_bytes %lld, calculated %lld",
-                         c->bud_bytes, bud_bytes);
-               err = -EINVAL;
-       }
-       spin_unlock(&c->buds_lock);
-
-       return err;
+       return 0;
 }