Lines Matching +full:- +full:e
4 * Copyright (C) 2006-2008 Nokia Corporation
6 * SPDX-License-Identifier: GPL-2.0+
13 * This file implements functions needed to recover from unclean un-mounts.
15 * an un-mount was completed successfully. If not, the process of mounting
16 * incorporates additional checking and fixing of on-flash data structures.
17 * UBIFS always cleans away all remnants of an unclean un-mount, so that
19 * read-only, and the flash is not modified in that case.
30 * writes in @c->max_write_size bytes at a time.
48 * is_empty - determine whether a buffer is empty (contains all 0xff).
67 * first_non_ff - find offset of the first non-0xff byte.
71 * This function returns offset of the first non-0xff byte in @buf or %-1 if
82 return -1; in first_non_ff()
86 * get_master_node - get the last valid master node allowing for corruption.
87 * @c: UBIFS file-system description object
105 const int sz = c->mst_node_alsz; in get_master_node()
109 sbuf = vmalloc(c->leb_size); in get_master_node()
111 return -ENOMEM; in get_master_node()
113 err = ubifs_leb_read(c, lnum, sbuf, 0, c->leb_size, 0); in get_master_node()
114 if (err && err != -EBADMSG) in get_master_node()
120 len = c->leb_size; in get_master_node()
121 while (offs + UBIFS_MST_NODE_SZ <= c->leb_size) { in get_master_node()
124 if (le32_to_cpu(ch->magic) != UBIFS_NODE_MAGIC) in get_master_node()
128 len -= sz; in get_master_node()
134 offs -= sz; in get_master_node()
135 buf -= sz; in get_master_node()
140 offs -= sz; in get_master_node()
141 buf -= sz; in get_master_node()
155 if (ch->node_type != UBIFS_MST_NODE) in get_master_node()
161 len -= sz; in get_master_node()
165 if (offs < c->leb_size) { in get_master_node()
172 len -= sz; in get_master_node()
175 if (offs < c->leb_size) in get_master_node()
182 err = -EINVAL; in get_master_node()
191 * write_rcvrd_mst_node - write recovered master node.
192 * @c: UBIFS file-system description object
200 int err = 0, lnum = UBIFS_MST_LNUM, sz = c->mst_node_alsz; in write_rcvrd_mst_node()
205 save_flags = mst->flags; in write_rcvrd_mst_node()
206 mst->flags |= cpu_to_le32(UBIFS_MST_RCVRY); in write_rcvrd_mst_node()
216 mst->flags = save_flags; in write_rcvrd_mst_node()
221 * ubifs_recover_master_node - recover the master node.
222 * @c: UBIFS file-system description object
233 const int sz = c->mst_node_alsz; in ubifs_recover_master_node()
247 offs1 = (void *)mst1 - buf1; in ubifs_recover_master_node()
248 if ((le32_to_cpu(mst1->flags) & UBIFS_MST_RCVRY) && in ubifs_recover_master_node()
257 offs2 = (void *)mst2 - buf2; in ubifs_recover_master_node()
262 UBIFS_MST_NODE_SZ - UBIFS_CH_SZ)) in ubifs_recover_master_node()
271 c->leb_size - offs2 - sz < sz) { in ubifs_recover_master_node()
295 offs2 = (void *)mst2 - buf2; in ubifs_recover_master_node()
296 if (offs2 + sz + sz <= c->leb_size) in ubifs_recover_master_node()
304 memcpy(c->mst_node, mst, UBIFS_MST_NODE_SZ); in ubifs_recover_master_node()
306 if (c->ro_mount) { in ubifs_recover_master_node()
307 /* Read-only mode. Keep a copy for switching to rw mode */ in ubifs_recover_master_node()
308 c->rcvrd_mst_node = kmalloc(sz, GFP_KERNEL); in ubifs_recover_master_node()
309 if (!c->rcvrd_mst_node) { in ubifs_recover_master_node()
310 err = -ENOMEM; in ubifs_recover_master_node()
313 memcpy(c->rcvrd_mst_node, c->mst_node, UBIFS_MST_NODE_SZ); in ubifs_recover_master_node()
318 * is clean at this point, i.e., %UBIFS_MST_DIRTY is not set. in ubifs_recover_master_node()
319 * E.g., consider the following chain of events: in ubifs_recover_master_node()
331 * 4. However, this master node (@c->mst_node) is marked as in ubifs_recover_master_node()
334 * node when it is re-mounter R/W later. in ubifs_recover_master_node()
339 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); in ubifs_recover_master_node()
343 c->max_sqnum = le64_to_cpu(mst->ch.sqnum) - 1; in ubifs_recover_master_node()
344 err = write_rcvrd_mst_node(c, c->mst_node); in ubifs_recover_master_node()
356 err = -EINVAL; in ubifs_recover_master_node()
373 * ubifs_write_rcvrd_mst_node - write the recovered master node.
374 * @c: UBIFS file-system description object
377 * read-only mode and must now be written because we are remounting rw.
385 if (!c->rcvrd_mst_node) in ubifs_write_rcvrd_mst_node()
387 c->rcvrd_mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); in ubifs_write_rcvrd_mst_node()
388 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); in ubifs_write_rcvrd_mst_node()
389 err = write_rcvrd_mst_node(c, c->rcvrd_mst_node); in ubifs_write_rcvrd_mst_node()
392 kfree(c->rcvrd_mst_node); in ubifs_write_rcvrd_mst_node()
393 c->rcvrd_mst_node = NULL; in ubifs_write_rcvrd_mst_node()
398 * is_last_write - determine if an offset was in the last write to a LEB.
399 * @c: UBIFS file-system description object
405 * for subsequent empty space starting from the next @c->max_write_size
414 * Round up to the next @c->max_write_size boundary i.e. @offs is in in is_last_write()
417 empty_offs = ALIGN(offs + 1, c->max_write_size); in is_last_write()
418 check_len = c->leb_size - empty_offs; in is_last_write()
419 p = buf + empty_offs - offs; in is_last_write()
424 * clean_buf - clean the data from an LEB sitting in a buffer.
425 * @c: UBIFS file-system description object
433 * @c->min_io_size boundary.
444 empty_offs = ALIGN(*offs, c->min_io_size); in clean_buf()
445 pad_len = empty_offs - *offs; in clean_buf()
449 *len -= pad_len; in clean_buf()
450 memset(*buf, 0xff, c->leb_size - empty_offs); in clean_buf()
454 * no_more_nodes - determine if there are no more nodes in a buffer.
455 * @c: UBIFS file-system description object
469 int skip, dlen = le32_to_cpu(ch->len); in no_more_nodes()
472 skip = ALIGN(offs + UBIFS_CH_SZ, c->max_write_size) - offs; in no_more_nodes()
473 if (is_empty(buf + skip, len - skip)) in no_more_nodes()
479 if (ubifs_check_node(c, buf, lnum, offs, 1, 0) != -EUCLEAN) { in no_more_nodes()
484 skip = ALIGN(offs + dlen, c->max_write_size) - offs; in no_more_nodes()
486 if (is_empty(buf + skip, len - skip)) in no_more_nodes()
493 * fix_unclean_leb - fix an unclean LEB.
494 * @c: UBIFS file-system description object
501 int lnum = sleb->lnum, endpt = start; in fix_unclean_leb()
504 if (!list_empty(&sleb->nodes)) { in fix_unclean_leb()
507 snod = list_entry(sleb->nodes.prev, in fix_unclean_leb()
509 endpt = snod->offs + snod->len; in fix_unclean_leb()
512 if (c->ro_mount && !c->remounting_rw) { in fix_unclean_leb()
517 lnum, start, sleb->endpt); in fix_unclean_leb()
520 return -ENOMEM; in fix_unclean_leb()
521 ucleb->lnum = lnum; in fix_unclean_leb()
522 ucleb->endpt = endpt; in fix_unclean_leb()
523 list_add_tail(&ucleb->list, &c->unclean_leb_list); in fix_unclean_leb()
530 lnum, start, sleb->endpt); in fix_unclean_leb()
536 int len = ALIGN(endpt, c->min_io_size); in fix_unclean_leb()
539 err = ubifs_leb_read(c, lnum, sleb->buf, 0, in fix_unclean_leb()
546 int pad_len = len - ALIGN(endpt, 8); in fix_unclean_leb()
549 void *buf = sleb->buf + len - pad_len; in fix_unclean_leb()
554 err = ubifs_leb_change(c, lnum, sleb->buf, len); in fix_unclean_leb()
564 * drop_last_group - drop the last group of nodes.
573 while (!list_empty(&sleb->nodes)) { in drop_last_group()
577 snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, in drop_last_group()
579 ch = snod->node; in drop_last_group()
580 if (ch->group_type != UBIFS_IN_NODE_GROUP) in drop_last_group()
584 sleb->lnum, snod->offs); in drop_last_group()
585 *offs = snod->offs; in drop_last_group()
586 list_del(&snod->list); in drop_last_group()
588 sleb->nodes_cnt -= 1; in drop_last_group()
593 * drop_last_node - drop the last node.
604 if (!list_empty(&sleb->nodes)) { in drop_last_node()
605 snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, in drop_last_node()
609 sleb->lnum, snod->offs); in drop_last_node()
610 *offs = snod->offs; in drop_last_node()
611 list_del(&snod->list); in drop_last_node()
613 sleb->nodes_cnt -= 1; in drop_last_node()
618 * ubifs_recover_leb - scan and recover a LEB.
619 * @c: UBIFS file-system description object
622 * @sbuf: LEB-sized buffer to use
623 * @jhead: journal head number this LEB belongs to (%-1 if the LEB does not
634 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; in ubifs_recover_leb()
635 int grouped = jhead == -1 ? 0 : c->jheads[jhead].grouped; in ubifs_recover_leb()
665 node_len = ALIGN(le32_to_cpu(ch->len), 8); in ubifs_recover_leb()
668 len -= node_len; in ubifs_recover_leb()
673 len -= ret; in ubifs_recover_leb()
683 err = -EINVAL; in ubifs_recover_leb()
704 /* Make sure we dump interesting non-0xFF data */ in ubifs_recover_leb()
711 min_io_unit = round_down(offs, c->min_io_size); in ubifs_recover_leb()
739 * can't we just clean-up the second half of B by putting a in ubifs_recover_leb()
744 * Imagine the file-system is full, we run GC which starts in ubifs_recover_leb()
746 * the current GC head LEB). The @c->gc_lnum is -1, which means in ubifs_recover_leb()
755 * Then we clean-up LEB Y by padding min. I/O unit. And later in ubifs_recover_leb()
761 * user-visible effect of this which I once observed and in ubifs_recover_leb()
762 * analysed is that we cannot mount the file-system with in ubifs_recover_leb()
763 * -ENOSPC error. in ubifs_recover_leb()
775 len = c->leb_size - offs; in ubifs_recover_leb()
787 /* Re-scan the corrupted data with verbose messages */ in ubifs_recover_leb()
792 err = -EUCLEAN; in ubifs_recover_leb()
800 * get_cs_sqnum - get commit start sequence number.
801 * @c: UBIFS file-system description object
817 return -ENOMEM; in get_cs_sqnum()
818 if (c->leb_size - offs < UBIFS_CS_NODE_SZ) in get_cs_sqnum()
822 if (err && err != -EBADMSG) in get_cs_sqnum()
829 if (cs_node->ch.node_type != UBIFS_CS_NODE) { in get_cs_sqnum()
830 ubifs_err(c, "Node a CS node, type is %d", cs_node->ch.node_type); in get_cs_sqnum()
833 if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) { in get_cs_sqnum()
835 (unsigned long long)le64_to_cpu(cs_node->cmt_no), in get_cs_sqnum()
836 c->cmt_no); in get_cs_sqnum()
839 *cs_sqnum = le64_to_cpu(cs_node->ch.sqnum); in get_cs_sqnum()
845 err = -EINVAL; in get_cs_sqnum()
853 * ubifs_recover_log_leb - scan and recover a log LEB.
854 * @c: UBIFS file-system description object
857 * @sbuf: LEB-sized buffer to use
873 if (next_lnum >= UBIFS_LOG_LNUM + c->log_lebs) in ubifs_recover_log_leb()
875 if (next_lnum != c->ltail_lnum) { in ubifs_recover_log_leb()
883 if (sleb->nodes_cnt) { in ubifs_recover_log_leb()
885 unsigned long long cs_sqnum = c->cs_sqnum; in ubifs_recover_log_leb()
887 snod = list_entry(sleb->nodes.next, in ubifs_recover_log_leb()
898 if (snod->sqnum > cs_sqnum) { in ubifs_recover_log_leb()
902 return ERR_PTR(-EUCLEAN); in ubifs_recover_log_leb()
907 return ubifs_recover_leb(c, lnum, offs, sbuf, -1); in ubifs_recover_log_leb()
911 * recover_head - recover a head.
912 * @c: UBIFS file-system description object
915 * @sbuf: LEB-sized buffer to use
923 int len = c->max_write_size, err; in recover_head()
925 if (offs + len > c->leb_size) in recover_head()
926 len = c->leb_size - offs; in recover_head()
947 * ubifs_recover_inl_heads - recover index and LPT heads.
948 * @c: UBIFS file-system description object
949 * @sbuf: LEB-sized buffer to use
954 * This deals with the recovery of a half-completed journal commit. UBIFS is
956 * the index and LPT are wandering trees, data from a half-completed commit will
967 ubifs_assert(!c->ro_mount || c->remounting_rw); in ubifs_recover_inl_heads()
969 dbg_rcvry("checking index head at %d:%d", c->ihead_lnum, c->ihead_offs); in ubifs_recover_inl_heads()
970 err = recover_head(c, c->ihead_lnum, c->ihead_offs, sbuf); in ubifs_recover_inl_heads()
974 dbg_rcvry("checking LPT head at %d:%d", c->nhead_lnum, c->nhead_offs); in ubifs_recover_inl_heads()
976 return recover_head(c, c->nhead_lnum, c->nhead_offs, sbuf); in ubifs_recover_inl_heads()
980 * clean_an_unclean_leb - read and write a LEB to remove corruption.
981 * @c: UBIFS file-system description object
983 * @sbuf: LEB-sized buffer to use
985 * This function reads a LEB up to a point pre-determined by the mount recovery,
987 * off any following corruption, or non-fatal ECC errors.
994 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1; in clean_an_unclean_leb()
1005 if (err && err != -EBADMSG) in clean_an_unclean_leb()
1021 node_len = ALIGN(le32_to_cpu(ch->len), 8); in clean_an_unclean_leb()
1024 len -= node_len; in clean_an_unclean_leb()
1032 len -= ret; in clean_an_unclean_leb()
1039 return -EUCLEAN; in clean_an_unclean_leb()
1049 return -EUCLEAN; in clean_an_unclean_leb()
1053 len = ALIGN(ucleb->endpt, c->min_io_size); in clean_an_unclean_leb()
1054 if (len > ucleb->endpt) { in clean_an_unclean_leb()
1055 int pad_len = len - ALIGN(ucleb->endpt, 8); in clean_an_unclean_leb()
1058 buf = c->sbuf + len - pad_len; in clean_an_unclean_leb()
1074 * ubifs_clean_lebs - clean LEBs recovered during read-only mount.
1075 * @c: UBIFS file-system description object
1076 * @sbuf: LEB-sized buffer to use
1079 * written but was not because UBIFS was mounted read-only. This happens when
1080 * remounting to read-write mode.
1087 while (!list_empty(&c->unclean_leb_list)) { in ubifs_clean_lebs()
1091 ucleb = list_entry(c->unclean_leb_list.next, in ubifs_clean_lebs()
1096 list_del(&ucleb->list); in ubifs_clean_lebs()
1104 * grab_empty_leb - grab an empty LEB to use as GC LEB and run commit.
1105 * @c: UBIFS file-system description object
1108 * LEB to be used as GC LEB (@c->gc_lnum), and then runs the commit. Returns
1117 * run the commit, not vice-versa. The reason is that there might be in grab_empty_leb()
1119 * @c->gc_lnum just before the power cut happened. During the regular in grab_empty_leb()
1120 * UBIFS operation (not now) @c->gc_lnum is marked as "taken", so no in grab_empty_leb()
1122 * not marked as taken, so if we run commit - what happens? Right, the in grab_empty_leb()
1134 ubifs_dump_budg(c, &c->bi); in grab_empty_leb()
1144 c->gc_lnum = lnum; in grab_empty_leb()
1151 * ubifs_rcvry_gc_commit - recover the GC LEB number and run the commit.
1152 * @c: UBIFS file-system description object
1154 * Out-of-place garbage collection requires always one empty LEB with which to
1155 * start garbage collection. The LEB number is recorded in c->gc_lnum and is
1163 * size-recovery and orphans to be written to the flash. That is important to
1170 struct ubifs_wbuf *wbuf = &c->jheads[GCHD].wbuf; in ubifs_rcvry_gc_commit()
1174 dbg_rcvry("GC head LEB %d, offs %d", wbuf->lnum, wbuf->offs); in ubifs_rcvry_gc_commit()
1176 c->gc_lnum = -1; in ubifs_rcvry_gc_commit()
1177 if (wbuf->lnum == -1 || wbuf->offs == c->leb_size) in ubifs_rcvry_gc_commit()
1180 err = ubifs_find_dirty_leb(c, &lp, wbuf->offs, 2); in ubifs_rcvry_gc_commit()
1182 if (err != -ENOSPC) in ubifs_rcvry_gc_commit()
1190 ubifs_assert(lp.free + lp.dirty >= wbuf->offs); in ubifs_rcvry_gc_commit()
1202 mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead); in ubifs_rcvry_gc_commit()
1210 mutex_unlock(&wbuf->io_mutex); in ubifs_rcvry_gc_commit()
1213 if (err == -EAGAIN) in ubifs_rcvry_gc_commit()
1214 err = -EINVAL; in ubifs_rcvry_gc_commit()
1220 return -EINVAL; in ubifs_rcvry_gc_commit()
1222 err = ubifs_leb_unmap(c, c->gc_lnum); in ubifs_rcvry_gc_commit()
1237 * struct size_entry - inode size information for recovery.
1238 * @rb: link in the RB-tree of sizes
1255 * add_ino - add an entry to the size tree.
1256 * @c: UBIFS file-system description object
1265 struct rb_node **p = &c->size_tree.rb_node, *parent = NULL; in add_ino()
1266 struct size_entry *e; in add_ino() local
1270 e = rb_entry(parent, struct size_entry, rb); in add_ino()
1271 if (inum < e->inum) in add_ino()
1272 p = &(*p)->rb_left; in add_ino()
1274 p = &(*p)->rb_right; in add_ino()
1277 e = kzalloc(sizeof(struct size_entry), GFP_KERNEL); in add_ino()
1278 if (!e) in add_ino()
1279 return -ENOMEM; in add_ino()
1281 e->inum = inum; in add_ino()
1282 e->i_size = i_size; in add_ino()
1283 e->d_size = d_size; in add_ino()
1284 e->exists = exists; in add_ino()
1286 rb_link_node(&e->rb, parent, p); in add_ino()
1287 rb_insert_color(&e->rb, &c->size_tree); in add_ino()
1293 * find_ino - find an entry on the size tree.
1294 * @c: UBIFS file-system description object
1299 struct rb_node *p = c->size_tree.rb_node; in find_ino()
1300 struct size_entry *e; in find_ino() local
1303 e = rb_entry(p, struct size_entry, rb); in find_ino()
1304 if (inum < e->inum) in find_ino()
1305 p = p->rb_left; in find_ino()
1306 else if (inum > e->inum) in find_ino()
1307 p = p->rb_right; in find_ino()
1309 return e; in find_ino()
1315 * remove_ino - remove an entry from the size tree.
1316 * @c: UBIFS file-system description object
1321 struct size_entry *e = find_ino(c, inum); in remove_ino() local
1323 if (!e) in remove_ino()
1325 rb_erase(&e->rb, &c->size_tree); in remove_ino()
1326 kfree(e); in remove_ino()
1330 * ubifs_destroy_size_tree - free resources related to the size tree.
1331 * @c: UBIFS file-system description object
1335 struct size_entry *e, *n; in ubifs_destroy_size_tree() local
1337 rbtree_postorder_for_each_entry_safe(e, n, &c->size_tree, rb) { in ubifs_destroy_size_tree()
1338 if (e->inode) in ubifs_destroy_size_tree()
1339 iput(e->inode); in ubifs_destroy_size_tree()
1340 kfree(e); in ubifs_destroy_size_tree()
1343 c->size_tree = RB_ROOT; in ubifs_destroy_size_tree()
1347 * ubifs_recover_size_accum - accumulate inode sizes for recovery.
1348 * @c: UBIFS file-system description object
1356 * To accomplish those purposes, a rb-tree is constructed containing an entry
1375 struct size_entry *e; in ubifs_recover_size_accum() local
1383 e = find_ino(c, inum); in ubifs_recover_size_accum()
1384 if (e) { in ubifs_recover_size_accum()
1385 e->i_size = new_size; in ubifs_recover_size_accum()
1386 e->exists = 1; in ubifs_recover_size_accum()
1395 e = find_ino(c, inum); in ubifs_recover_size_accum()
1396 if (e) { in ubifs_recover_size_accum()
1397 if (new_size > e->d_size) in ubifs_recover_size_accum()
1398 e->d_size = new_size; in ubifs_recover_size_accum()
1406 e = find_ino(c, inum); in ubifs_recover_size_accum()
1407 if (e) in ubifs_recover_size_accum()
1408 e->d_size = new_size; in ubifs_recover_size_accum()
1416 * fix_size_in_place - fix inode size in place on flash.
1417 * @c: UBIFS file-system description object
1418 * @e: inode size information for recovery
1420 static int fix_size_in_place(struct ubifs_info *c, struct size_entry *e) in fix_size_in_place() argument
1422 struct ubifs_ino_node *ino = c->sbuf; in fix_size_in_place()
1430 ino_key_init(c, &key, e->inum); in fix_size_in_place()
1438 i_size = le64_to_cpu(ino->size); in fix_size_in_place()
1439 if (i_size >= e->d_size) in fix_size_in_place()
1442 err = ubifs_leb_read(c, lnum, c->sbuf, 0, c->leb_size, 1); in fix_size_in_place()
1446 ino = c->sbuf + offs; in fix_size_in_place()
1447 ino->size = cpu_to_le64(e->d_size); in fix_size_in_place()
1448 len = le32_to_cpu(ino->ch.len); in fix_size_in_place()
1449 crc = crc32(UBIFS_CRC32_INIT, (void *)ino + 8, len - 8); in fix_size_in_place()
1450 ino->ch.crc = cpu_to_le32(crc); in fix_size_in_place()
1452 p = c->sbuf; in fix_size_in_place()
1453 len = c->leb_size - 1; in fix_size_in_place()
1455 len -= 1; in fix_size_in_place()
1456 len = ALIGN(len + 1, c->min_io_size); in fix_size_in_place()
1458 err = ubifs_leb_change(c, lnum, c->sbuf, len); in fix_size_in_place()
1461 dbg_rcvry("inode %lu at %d:%d size %lld -> %lld", in fix_size_in_place()
1462 (unsigned long)e->inum, lnum, offs, i_size, e->d_size); in fix_size_in_place()
1466 ubifs_warn(c, "inode %lu failed to fix size %lld -> %lld error %d", in fix_size_in_place()
1467 (unsigned long)e->inum, e->i_size, e->d_size, err); in fix_size_in_place()
1473 * ubifs_recover_size - recover inode size.
1474 * @c: UBIFS file-system description object
1483 struct rb_node *this = rb_first(&c->size_tree); in ubifs_recover_size()
1486 struct size_entry *e; in ubifs_recover_size() local
1489 e = rb_entry(this, struct size_entry, rb); in ubifs_recover_size()
1490 if (!e->exists) { in ubifs_recover_size()
1493 ino_key_init(c, &key, e->inum); in ubifs_recover_size()
1494 err = ubifs_tnc_lookup(c, &key, c->sbuf); in ubifs_recover_size()
1495 if (err && err != -ENOENT) in ubifs_recover_size()
1497 if (err == -ENOENT) { in ubifs_recover_size()
1500 (unsigned long)e->inum); in ubifs_recover_size()
1501 err = ubifs_tnc_remove_ino(c, e->inum); in ubifs_recover_size()
1505 struct ubifs_ino_node *ino = c->sbuf; in ubifs_recover_size()
1507 e->exists = 1; in ubifs_recover_size()
1508 e->i_size = le64_to_cpu(ino->size); in ubifs_recover_size()
1512 if (e->exists && e->i_size < e->d_size) { in ubifs_recover_size()
1513 if (c->ro_mount) { in ubifs_recover_size()
1518 ubifs_assert(!e->inode); in ubifs_recover_size()
1520 inode = ubifs_iget(c->vfs_sb, e->inum); in ubifs_recover_size()
1525 if (inode->i_size < e->d_size) { in ubifs_recover_size()
1526 dbg_rcvry("ino %lu size %lld -> %lld", in ubifs_recover_size()
1527 (unsigned long)e->inum, in ubifs_recover_size()
1528 inode->i_size, e->d_size); in ubifs_recover_size()
1529 inode->i_size = e->d_size; in ubifs_recover_size()
1530 ui->ui_size = e->d_size; in ubifs_recover_size()
1531 ui->synced_i_size = e->d_size; in ubifs_recover_size()
1532 e->inode = inode; in ubifs_recover_size()
1540 err = fix_size_in_place(c, e); in ubifs_recover_size()
1543 if (e->inode) in ubifs_recover_size()
1544 iput(e->inode); in ubifs_recover_size()
1550 rb_erase(&e->rb, &c->size_tree); in ubifs_recover_size()
1551 kfree(e); in ubifs_recover_size()