Lines Matching +full:- +full:- +full:quiet
1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (C) 2006-2008 Nokia Corporation
12 * This file implements the scan which is a general-purpose function for
14 * journal, to do garbage collection. for the TNC in-the-gaps method, and by
25 * scan_padding_bytes - scan for padding bytes.
51 * ubifs_scan_a_node - scan for a node or padding.
52 * @c: UBIFS file-system description object
57 * @quiet: print no messages
62 int offs, int quiet) in ubifs_scan_a_node() argument
67 magic = le32_to_cpu(ch->magic); in ubifs_scan_a_node()
81 dbg_ntype(ch->node_type), lnum, offs); in ubifs_scan_a_node()
83 if (ubifs_check_node(c, buf, lnum, offs, quiet, 1)) in ubifs_scan_a_node()
86 if (ch->node_type == UBIFS_PAD_NODE) { in ubifs_scan_a_node()
88 int pad_len = le32_to_cpu(pad->pad_len); in ubifs_scan_a_node()
89 int node_len = le32_to_cpu(ch->len); in ubifs_scan_a_node()
93 offs + node_len + pad_len > c->leb_size) { in ubifs_scan_a_node()
94 if (!quiet) { in ubifs_scan_a_node()
102 /* Make the node pads to 8-byte boundary */ in ubifs_scan_a_node()
104 if (!quiet) in ubifs_scan_a_node()
105 ubifs_err(c, "bad padding length %d - %d", in ubifs_scan_a_node()
120 * ubifs_start_scan - create LEB scanning information at start of scan.
121 * @c: UBIFS file-system description object
124 * @sbuf: scan buffer (must be c->leb_size)
139 return ERR_PTR(-ENOMEM); in ubifs_start_scan()
141 sleb->lnum = lnum; in ubifs_start_scan()
142 INIT_LIST_HEAD(&sleb->nodes); in ubifs_start_scan()
143 sleb->buf = sbuf; in ubifs_start_scan()
145 err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0); in ubifs_start_scan()
146 if (err && err != -EBADMSG) { in ubifs_start_scan()
148 c->leb_size - offs, lnum, offs, err); in ubifs_start_scan()
161 * ubifs_end_scan - update LEB scanning information at end of scan.
162 * @c: UBIFS file-system description object
172 ubifs_assert(offs % c->min_io_size == 0); in ubifs_end_scan()
174 sleb->endpt = ALIGN(offs, c->min_io_size); in ubifs_end_scan()
178 * ubifs_add_snod - add a scanned node to LEB scanning information.
179 * @c: UBIFS file-system description object
195 return -ENOMEM; in ubifs_add_snod()
197 snod->sqnum = le64_to_cpu(ch->sqnum); in ubifs_add_snod()
198 snod->type = ch->node_type; in ubifs_add_snod()
199 snod->offs = offs; in ubifs_add_snod()
200 snod->len = le32_to_cpu(ch->len); in ubifs_add_snod()
201 snod->node = buf; in ubifs_add_snod()
203 switch (ch->node_type) { in ubifs_add_snod()
212 key_read(c, &ino->key, &snod->key); in ubifs_add_snod()
215 invalid_key_init(c, &snod->key); in ubifs_add_snod()
218 list_add_tail(&snod->list, &sleb->nodes); in ubifs_add_snod()
219 sleb->nodes_cnt += 1; in ubifs_add_snod()
224 * ubifs_scanned_corruption - print information after UBIFS scanned corruption.
225 * @c: UBIFS file-system description object
236 len = c->leb_size - offs; in ubifs_scanned_corruption()
244 * ubifs_scan - scan a logical eraseblock.
245 * @c: UBIFS file-system description object
248 * @sbuf: scan buffer (must be of @c->leb_size bytes in size)
249 * @quiet: print no messages
253 * %-EUCLEAN if the LEB neads recovery, and other negative error codes in case
256 * If @quiet is non-zero, this function does not print large and scary
260 int offs, void *sbuf, int quiet) in ubifs_scan() argument
263 int err, len = c->leb_size - offs; in ubifs_scan()
279 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in ubifs_scan()
284 len -= ret; in ubifs_scan()
304 err = -EINVAL; in ubifs_scan()
312 node_len = ALIGN(le32_to_cpu(ch->len), 8); in ubifs_scan()
315 len -= node_len; in ubifs_scan()
318 if (offs % c->min_io_size) { in ubifs_scan()
319 if (!quiet) in ubifs_scan()
320 ubifs_err(c, "empty space starts at non-aligned offset %d", in ubifs_scan()
327 for (; len > 4; offs += 4, buf = buf + 4, len -= 4) in ubifs_scan()
330 for (; len; offs++, buf++, len--) in ubifs_scan()
332 if (!quiet) in ubifs_scan()
341 if (!quiet) { in ubifs_scan()
345 err = -EUCLEAN; in ubifs_scan()
356 * ubifs_scan_destroy - destroy LEB scanning information.
364 head = &sleb->nodes; in ubifs_scan_destroy()
366 node = list_entry(head->next, struct ubifs_scan_node, list); in ubifs_scan_destroy()
367 list_del(&node->list); in ubifs_scan_destroy()