Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'linux-next' of git://git.infradead.org/~dedekind/ubifs-2.6

* 'linux-next' of git://git.infradead.org/~dedekind/ubifs-2.6:
UBIFS: make minimum fanout 3
UBIFS: fix division by zero
UBIFS: amend f_fsid
UBIFS: fill f_fsid
UBIFS: improve statfs reporting even more
UBIFS: introduce LEB overhead
UBIFS: add forgotten gc_idx_lebs component
UBIFS: fix assertion
UBIFS: improve statfs reporting
UBIFS: remove incorrect index space check
UBIFS: push empty flash hack down
UBIFS: do not update min_idx_lebs in stafs
UBIFS: allow for racing between GC and TNC
UBIFS: always read hashed-key nodes under TNC mutex
UBIFS: fix zero-length truncations

+221 -141
+87 -27
fs/ubifs/budget.c
··· 302 302 int subtract_lebs; 303 303 long long available; 304 304 305 - /* 306 - * Force the amount available to the total size reported if the used 307 - * space is zero. 308 - */ 309 - if (c->lst.total_used <= UBIFS_INO_NODE_SZ && 310 - c->budg_data_growth + c->budg_dd_growth == 0) { 311 - /* Do the same calculation as for c->block_cnt */ 312 - available = c->main_lebs - 2; 313 - available *= c->leb_size - c->dark_wm; 314 - return available; 315 - } 316 - 317 305 available = c->main_bytes - c->lst.total_used; 318 306 319 307 /* ··· 702 714 } 703 715 704 716 /** 705 - * ubifs_budg_get_free_space - return amount of free space. 717 + * ubifs_reported_space - calculate reported free space. 718 + * @c: the UBIFS file-system description object 719 + * @free: amount of free space 720 + * 721 + * This function calculates amount of free space which will be reported to 722 + * user-space. User-space application tend to expect that if the file-system 723 + * (e.g., via the 'statfs()' call) reports that it has N bytes available, they 724 + * are able to write a file of size N. UBIFS attaches node headers to each data 725 + * node and it has to write indexind nodes as well. This introduces additional 726 + * overhead, and UBIFS it has to report sligtly less free space to meet the 727 + * above expectetion. 728 + * 729 + * This function assumes free space is made up of uncompressed data nodes and 730 + * full index nodes (one per data node, tripled because we always allow enough 731 + * space to write the index thrice). 732 + * 733 + * Note, the calculation is pessimistic, which means that most of the time 734 + * UBIFS reports less space than it actually has. 735 + */ 736 + long long ubifs_reported_space(const struct ubifs_info *c, uint64_t free) 737 + { 738 + int divisor, factor, f; 739 + 740 + /* 741 + * Reported space size is @free * X, where X is UBIFS block size 742 + * divided by UBIFS block size + all overhead one data block 743 + * introduces. The overhead is the node header + indexing overhead. 744 + * 745 + * Indexing overhead calculations are based on the following formula: 746 + * I = N/(f - 1) + 1, where I - number of indexing nodes, N - number 747 + * of data nodes, f - fanout. Because effective UBIFS fanout is twice 748 + * as less than maximum fanout, we assume that each data node 749 + * introduces 3 * @c->max_idx_node_sz / (@c->fanout/2 - 1) bytes. 750 + * Note, the multiplier 3 is because UBIFS reseves thrice as more space 751 + * for the index. 752 + */ 753 + f = c->fanout > 3 ? c->fanout >> 1 : 2; 754 + factor = UBIFS_BLOCK_SIZE; 755 + divisor = UBIFS_MAX_DATA_NODE_SZ; 756 + divisor += (c->max_idx_node_sz * 3) / (f - 1); 757 + free *= factor; 758 + do_div(free, divisor); 759 + return free; 760 + } 761 + 762 + /** 763 + * ubifs_get_free_space - return amount of free space. 706 764 * @c: UBIFS file-system description object 707 765 * 708 - * This function returns amount of free space on the file-system. 766 + * This function calculates amount of free space to report to user-space. 767 + * 768 + * Because UBIFS may introduce substantial overhead (the index, node headers, 769 + * alighment, wastage at the end of eraseblocks, etc), it cannot report real 770 + * amount of free flash space it has (well, because not all dirty space is 771 + * reclamable, UBIFS does not actually know the real amount). If UBIFS did so, 772 + * it would bread user expectetion about what free space is. Users seem to 773 + * accustomed to assume that if the file-system reports N bytes of free space, 774 + * they would be able to fit a file of N bytes to the FS. This almost works for 775 + * traditional file-systems, because they have way less overhead than UBIFS. 776 + * So, to keep users happy, UBIFS tries to take the overhead into account. 709 777 */ 710 - long long ubifs_budg_get_free_space(struct ubifs_info *c) 778 + long long ubifs_get_free_space(struct ubifs_info *c) 711 779 { 712 - int min_idx_lebs, rsvd_idx_lebs; 780 + int min_idx_lebs, rsvd_idx_lebs, lebs; 713 781 long long available, outstanding, free; 714 782 715 - /* Do exactly the same calculations as in 'do_budget_space()' */ 716 783 spin_lock(&c->space_lock); 717 784 min_idx_lebs = ubifs_calc_min_idx_lebs(c); 785 + outstanding = c->budg_data_growth + c->budg_dd_growth; 718 786 787 + /* 788 + * Force the amount available to the total size reported if the used 789 + * space is zero. 790 + */ 791 + if (c->lst.total_used <= UBIFS_INO_NODE_SZ && !outstanding) { 792 + spin_unlock(&c->space_lock); 793 + return (long long)c->block_cnt << UBIFS_BLOCK_SHIFT; 794 + } 795 + 796 + available = ubifs_calc_available(c, min_idx_lebs); 797 + 798 + /* 799 + * When reporting free space to user-space, UBIFS guarantees that it is 800 + * possible to write a file of free space size. This means that for 801 + * empty LEBs we may use more precise calculations than 802 + * 'ubifs_calc_available()' is using. Namely, we know that in empty 803 + * LEBs we would waste only @c->leb_overhead bytes, not @c->dark_wm. 804 + * Thus, amend the available space. 805 + * 806 + * Note, the calculations below are similar to what we have in 807 + * 'do_budget_space()', so refer there for comments. 808 + */ 719 809 if (min_idx_lebs > c->lst.idx_lebs) 720 810 rsvd_idx_lebs = min_idx_lebs - c->lst.idx_lebs; 721 811 else 722 812 rsvd_idx_lebs = 0; 723 - 724 - if (rsvd_idx_lebs > c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt 725 - - c->lst.taken_empty_lebs) { 726 - spin_unlock(&c->space_lock); 727 - return 0; 728 - } 729 - 730 - available = ubifs_calc_available(c, min_idx_lebs); 731 - outstanding = c->budg_data_growth + c->budg_dd_growth; 732 - c->min_idx_lebs = min_idx_lebs; 813 + lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - 814 + c->lst.taken_empty_lebs; 815 + lebs -= rsvd_idx_lebs; 816 + available += lebs * (c->dark_wm - c->leb_overhead); 733 817 spin_unlock(&c->space_lock); 734 818 735 819 if (available > outstanding)
-1
fs/ubifs/dir.c
··· 587 587 if (err) { 588 588 if (err != -ENOSPC) 589 589 return err; 590 - err = 0; 591 590 budgeted = 0; 592 591 } 593 592
+16 -4
fs/ubifs/file.c
··· 793 793 int err; 794 794 struct ubifs_budget_req req; 795 795 loff_t old_size = inode->i_size, new_size = attr->ia_size; 796 - int offset = new_size & (UBIFS_BLOCK_SIZE - 1); 796 + int offset = new_size & (UBIFS_BLOCK_SIZE - 1), budgeted = 1; 797 797 struct ubifs_inode *ui = ubifs_inode(inode); 798 798 799 799 dbg_gen("ino %lu, size %lld -> %lld", inode->i_ino, old_size, new_size); ··· 811 811 /* A funny way to budget for truncation node */ 812 812 req.dirtied_ino_d = UBIFS_TRUN_NODE_SZ; 813 813 err = ubifs_budget_space(c, &req); 814 - if (err) 815 - return err; 814 + if (err) { 815 + /* 816 + * Treat truncations to zero as deletion and always allow them, 817 + * just like we do for '->unlink()'. 818 + */ 819 + if (new_size || err != -ENOSPC) 820 + return err; 821 + budgeted = 0; 822 + } 816 823 817 824 err = vmtruncate(inode, new_size); 818 825 if (err) ··· 876 869 err = ubifs_jnl_truncate(c, inode, old_size, new_size); 877 870 mutex_unlock(&ui->ui_mutex); 878 871 out_budg: 879 - ubifs_release_budget(c, &req); 872 + if (budgeted) 873 + ubifs_release_budget(c, &req); 874 + else { 875 + c->nospace = c->nospace_rp = 0; 876 + smp_wmb(); 877 + } 880 878 return err; 881 879 } 882 880
+8 -10
fs/ubifs/find.c
··· 211 211 * dirty index heap, and it falls-back to LPT scanning if the heaps are empty 212 212 * or do not have an LEB which satisfies the @min_space criteria. 213 213 * 214 - * Note: 215 - * o LEBs which have less than dead watermark of dirty space are never picked 216 - * by this function; 217 - * 218 - * Returns zero and the LEB properties of 219 - * found dirty LEB in case of success, %-ENOSPC if no dirty LEB was found and a 220 - * negative error code in case of other failures. The returned LEB is marked as 221 - * "taken". 214 + * Note, LEBs which have less than dead watermark of free + dirty space are 215 + * never picked by this function. 222 216 * 223 217 * The additional @pick_free argument controls if this function has to return a 224 218 * free or freeable LEB if one is present. For example, GC must to set it to %1, ··· 225 231 * 226 232 * In addition @pick_free is set to %2 by the recovery process in order to 227 233 * recover gc_lnum in which case an index LEB must not be returned. 234 + * 235 + * This function returns zero and the LEB properties of found dirty LEB in case 236 + * of success, %-ENOSPC if no dirty LEB was found and a negative error code in 237 + * case of other failures. The returned LEB is marked as "taken". 228 238 */ 229 239 int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp, 230 240 int min_space, int pick_free) ··· 243 245 int lebs, rsvd_idx_lebs = 0; 244 246 245 247 spin_lock(&c->space_lock); 246 - lebs = c->lst.empty_lebs; 248 + lebs = c->lst.empty_lebs + c->idx_gc_cnt; 247 249 lebs += c->freeable_cnt - c->lst.taken_empty_lebs; 248 250 249 251 /* ··· 315 317 lp = idx_lp; 316 318 317 319 if (lp) { 318 - ubifs_assert(lp->dirty >= c->dead_wm); 320 + ubifs_assert(lp->free + lp->dirty >= c->dead_wm); 319 321 goto found; 320 322 } 321 323
+6
fs/ubifs/gc.c
··· 344 344 if (err) 345 345 goto out; 346 346 347 + /* Allow for races with TNC */ 348 + c->gced_lnum = lnum; 349 + smp_wmb(); 350 + c->gc_seq += 1; 351 + smp_wmb(); 352 + 347 353 if (c->gc_lnum == -1) { 348 354 c->gc_lnum = lnum; 349 355 err = LEB_RETAINED;
+17 -32
fs/ubifs/misc.h
··· 284 284 } 285 285 286 286 /** 287 - * ubifs_reported_space - calculate reported free space. 288 - * @c: the UBIFS file-system description object 289 - * @free: amount of free space 290 - * 291 - * This function calculates amount of free space which will be reported to 292 - * user-space. User-space application tend to expect that if the file-system 293 - * (e.g., via the 'statfs()' call) reports that it has N bytes available, they 294 - * are able to write a file of size N. UBIFS attaches node headers to each data 295 - * node and it has to write indexind nodes as well. This introduces additional 296 - * overhead, and UBIFS it has to report sligtly less free space to meet the 297 - * above expectetion. 298 - * 299 - * This function assumes free space is made up of uncompressed data nodes and 300 - * full index nodes (one per data node, doubled because we always allow enough 301 - * space to write the index twice). 302 - * 303 - * Note, the calculation is pessimistic, which means that most of the time 304 - * UBIFS reports less space than it actually has. 305 - */ 306 - static inline long long ubifs_reported_space(const struct ubifs_info *c, 307 - uint64_t free) 308 - { 309 - int divisor, factor; 310 - 311 - divisor = UBIFS_MAX_DATA_NODE_SZ + (c->max_idx_node_sz * 3); 312 - factor = UBIFS_MAX_DATA_NODE_SZ - UBIFS_DATA_NODE_SZ; 313 - do_div(free, divisor); 314 - 315 - return free * factor; 316 - } 317 - 318 - /** 319 287 * ubifs_current_time - round current time to time granularity. 320 288 * @inode: inode 321 289 */ ··· 291 323 { 292 324 return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ? 293 325 current_fs_time(inode->i_sb) : CURRENT_TIME_SEC; 326 + } 327 + 328 + /** 329 + * ubifs_tnc_lookup - look up a file-system node. 330 + * @c: UBIFS file-system description object 331 + * @key: node key to lookup 332 + * @node: the node is returned here 333 + * 334 + * This function look up and reads node with key @key. The caller has to make 335 + * sure the @node buffer is large enough to fit the node. Returns zero in case 336 + * of success, %-ENOENT if the node was not found, and a negative error code in 337 + * case of failure. 338 + */ 339 + static inline int ubifs_tnc_lookup(struct ubifs_info *c, 340 + const union ubifs_key *key, void *node) 341 + { 342 + return ubifs_tnc_locate(c, key, node, NULL, NULL); 294 343 } 295 344 296 345 #endif /* __UBIFS_MISC_H__ */
+14 -8
fs/ubifs/super.c
··· 370 370 { 371 371 struct ubifs_info *c = dentry->d_sb->s_fs_info; 372 372 unsigned long long free; 373 + __le32 *uuid = (__le32 *)c->uuid; 373 374 374 - free = ubifs_budg_get_free_space(c); 375 + free = ubifs_get_free_space(c); 375 376 dbg_gen("free space %lld bytes (%lld blocks)", 376 377 free, free >> UBIFS_BLOCK_SHIFT); 377 378 ··· 387 386 buf->f_files = 0; 388 387 buf->f_ffree = 0; 389 388 buf->f_namelen = UBIFS_MAX_NLEN; 390 - 389 + buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]); 390 + buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]); 391 391 return 0; 392 392 } 393 393 ··· 532 530 c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); 533 531 c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); 534 532 533 + /* 534 + * Calculate how many bytes would be wasted at the end of LEB if it was 535 + * fully filled with data nodes of maximum size. This is used in 536 + * calculations when reporting free space. 537 + */ 538 + c->leb_overhead = c->leb_size % UBIFS_MAX_DATA_NODE_SZ; 535 539 return 0; 536 540 } 537 541 ··· 655 647 * internally because it does not make much sense for UBIFS, but it is 656 648 * necessary to report something for the 'statfs()' call. 657 649 * 658 - * Subtract the LEB reserved for GC and the LEB which is reserved for 659 - * deletions. 660 - * 661 - * Review 'ubifs_calc_available()' if changing this calculation. 650 + * Subtract the LEB reserved for GC, the LEB which is reserved for 651 + * deletions, and assume only one journal head is available. 662 652 */ 663 - tmp64 = c->main_lebs - 2; 664 - tmp64 *= (uint64_t)c->leb_size - c->dark_wm; 653 + tmp64 = c->main_lebs - 2 - c->jhead_cnt + 1; 654 + tmp64 *= (uint64_t)c->leb_size - c->leb_overhead; 665 655 tmp64 = ubifs_reported_space(c, tmp64); 666 656 c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT; 667 657
+61 -55
fs/ubifs/tnc.c
··· 506 506 if (keys_cmp(c, key, &node_key) != 0) 507 507 ret = 0; 508 508 } 509 - if (ret == 0) 509 + if (ret == 0 && c->replaying) 510 510 dbg_mnt("dangling branch LEB %d:%d len %d, key %s", 511 511 zbr->lnum, zbr->offs, zbr->len, DBGKEY(key)); 512 512 return ret; ··· 1382 1382 } 1383 1383 1384 1384 /** 1385 - * ubifs_tnc_lookup - look up a file-system node. 1385 + * maybe_leb_gced - determine if a LEB may have been garbage collected. 1386 1386 * @c: UBIFS file-system description object 1387 - * @key: node key to lookup 1388 - * @node: the node is returned here 1387 + * @lnum: LEB number 1388 + * @gc_seq1: garbage collection sequence number 1389 1389 * 1390 - * This function look up and reads node with key @key. The caller has to make 1391 - * sure the @node buffer is large enough to fit the node. Returns zero in case 1392 - * of success, %-ENOENT if the node was not found, and a negative error code in 1393 - * case of failure. 1390 + * This function determines if @lnum may have been garbage collected since 1391 + * sequence number @gc_seq1. If it may have been then %1 is returned, otherwise 1392 + * %0 is returned. 1394 1393 */ 1395 - int ubifs_tnc_lookup(struct ubifs_info *c, const union ubifs_key *key, 1396 - void *node) 1394 + static int maybe_leb_gced(struct ubifs_info *c, int lnum, int gc_seq1) 1397 1395 { 1398 - int found, n, err; 1399 - struct ubifs_znode *znode; 1400 - struct ubifs_zbranch zbr, *zt; 1396 + int gc_seq2, gced_lnum; 1401 1397 1402 - mutex_lock(&c->tnc_mutex); 1403 - found = ubifs_lookup_level0(c, key, &znode, &n); 1404 - if (!found) { 1405 - err = -ENOENT; 1406 - goto out; 1407 - } else if (found < 0) { 1408 - err = found; 1409 - goto out; 1410 - } 1411 - zt = &znode->zbranch[n]; 1412 - if (is_hash_key(c, key)) { 1413 - /* 1414 - * In this case the leaf node cache gets used, so we pass the 1415 - * address of the zbranch and keep the mutex locked 1416 - */ 1417 - err = tnc_read_node_nm(c, zt, node); 1418 - goto out; 1419 - } 1420 - zbr = znode->zbranch[n]; 1421 - mutex_unlock(&c->tnc_mutex); 1422 - 1423 - err = ubifs_tnc_read_node(c, &zbr, node); 1424 - return err; 1425 - 1426 - out: 1427 - mutex_unlock(&c->tnc_mutex); 1428 - return err; 1398 + gced_lnum = c->gced_lnum; 1399 + smp_rmb(); 1400 + gc_seq2 = c->gc_seq; 1401 + /* Same seq means no GC */ 1402 + if (gc_seq1 == gc_seq2) 1403 + return 0; 1404 + /* Different by more than 1 means we don't know */ 1405 + if (gc_seq1 + 1 != gc_seq2) 1406 + return 1; 1407 + /* 1408 + * We have seen the sequence number has increased by 1. Now we need to 1409 + * be sure we read the right LEB number, so read it again. 1410 + */ 1411 + smp_rmb(); 1412 + if (gced_lnum != c->gced_lnum) 1413 + return 1; 1414 + /* Finally we can check lnum */ 1415 + if (gced_lnum == lnum) 1416 + return 1; 1417 + return 0; 1429 1418 } 1430 1419 1431 1420 /** ··· 1425 1436 * @lnum: LEB number is returned here 1426 1437 * @offs: offset is returned here 1427 1438 * 1428 - * This function is the same as 'ubifs_tnc_lookup()' but it returns the node 1429 - * location also. See 'ubifs_tnc_lookup()'. 1439 + * This function look up and reads node with key @key. The caller has to make 1440 + * sure the @node buffer is large enough to fit the node. Returns zero in case 1441 + * of success, %-ENOENT if the node was not found, and a negative error code in 1442 + * case of failure. The node location can be returned in @lnum and @offs. 1430 1443 */ 1431 1444 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, 1432 1445 void *node, int *lnum, int *offs) 1433 1446 { 1434 - int found, n, err; 1447 + int found, n, err, safely = 0, gc_seq1; 1435 1448 struct ubifs_znode *znode; 1436 1449 struct ubifs_zbranch zbr, *zt; 1437 1450 1451 + again: 1438 1452 mutex_lock(&c->tnc_mutex); 1439 1453 found = ubifs_lookup_level0(c, key, &znode, &n); 1440 1454 if (!found) { ··· 1448 1456 goto out; 1449 1457 } 1450 1458 zt = &znode->zbranch[n]; 1459 + if (lnum) { 1460 + *lnum = zt->lnum; 1461 + *offs = zt->offs; 1462 + } 1451 1463 if (is_hash_key(c, key)) { 1452 1464 /* 1453 1465 * In this case the leaf node cache gets used, so we pass the 1454 1466 * address of the zbranch and keep the mutex locked 1455 1467 */ 1456 - *lnum = zt->lnum; 1457 - *offs = zt->offs; 1458 1468 err = tnc_read_node_nm(c, zt, node); 1459 1469 goto out; 1460 1470 } 1471 + if (safely) { 1472 + err = ubifs_tnc_read_node(c, zt, node); 1473 + goto out; 1474 + } 1475 + /* Drop the TNC mutex prematurely and race with garbage collection */ 1461 1476 zbr = znode->zbranch[n]; 1477 + gc_seq1 = c->gc_seq; 1462 1478 mutex_unlock(&c->tnc_mutex); 1463 1479 1464 - *lnum = zbr.lnum; 1465 - *offs = zbr.offs; 1480 + if (ubifs_get_wbuf(c, zbr.lnum)) { 1481 + /* We do not GC journal heads */ 1482 + err = ubifs_tnc_read_node(c, &zbr, node); 1483 + return err; 1484 + } 1466 1485 1467 - err = ubifs_tnc_read_node(c, &zbr, node); 1468 - return err; 1486 + err = fallible_read_node(c, key, &zbr, node); 1487 + if (maybe_leb_gced(c, zbr.lnum, gc_seq1)) { 1488 + /* 1489 + * The node may have been GC'ed out from under us so try again 1490 + * while keeping the TNC mutex locked. 1491 + */ 1492 + safely = 1; 1493 + goto again; 1494 + } 1495 + return 0; 1469 1496 1470 1497 out: 1471 1498 mutex_unlock(&c->tnc_mutex); ··· 1509 1498 { 1510 1499 int found, n, err; 1511 1500 struct ubifs_znode *znode; 1512 - struct ubifs_zbranch zbr; 1513 1501 1514 1502 dbg_tnc("name '%.*s' key %s", nm->len, nm->name, DBGKEY(key)); 1515 1503 mutex_lock(&c->tnc_mutex); ··· 1532 1522 goto out_unlock; 1533 1523 } 1534 1524 1535 - zbr = znode->zbranch[n]; 1536 - mutex_unlock(&c->tnc_mutex); 1537 - 1538 - err = tnc_read_node_nm(c, &zbr, node); 1539 - return err; 1525 + err = tnc_read_node_nm(c, &znode->zbranch[n], node); 1540 1526 1541 1527 out_unlock: 1542 1528 mutex_unlock(&c->tnc_mutex);
+1 -1
fs/ubifs/ubifs-media.h
··· 87 87 #define UBIFS_SK_LEN 8 88 88 89 89 /* Minimum index tree fanout */ 90 - #define UBIFS_MIN_FANOUT 2 90 + #define UBIFS_MIN_FANOUT 3 91 91 92 92 /* Maximum number of levels in UBIFS indexing B-tree */ 93 93 #define UBIFS_MAX_LEVELS 512
+11 -3
fs/ubifs/ubifs.h
··· 995 995 * @max_idx_node_sz: maximum indexing node aligned on 8-bytes boundary 996 996 * @max_inode_sz: maximum possible inode size in bytes 997 997 * @max_znode_sz: size of znode in bytes 998 + * 999 + * @leb_overhead: how many bytes are wasted in an LEB when it is filled with 1000 + * data nodes of maximum size - used in free space reporting 998 1001 * @dead_wm: LEB dead space watermark 999 1002 * @dark_wm: LEB dark space watermark 1000 1003 * @block_cnt: count of 4KiB blocks on the FS ··· 1031 1028 * @sbuf: a buffer of LEB size used by GC and replay for scanning 1032 1029 * @idx_gc: list of index LEBs that have been garbage collected 1033 1030 * @idx_gc_cnt: number of elements on the idx_gc list 1031 + * @gc_seq: incremented for every non-index LEB garbage collected 1032 + * @gced_lnum: last non-index LEB that was garbage collected 1034 1033 * 1035 1034 * @infos_list: links all 'ubifs_info' objects 1036 1035 * @umount_mutex: serializes shrinker and un-mount ··· 1229 1224 int max_idx_node_sz; 1230 1225 long long max_inode_sz; 1231 1226 int max_znode_sz; 1227 + 1228 + int leb_overhead; 1232 1229 int dead_wm; 1233 1230 int dark_wm; 1234 1231 int block_cnt; ··· 1264 1257 void *sbuf; 1265 1258 struct list_head idx_gc; 1266 1259 int idx_gc_cnt; 1260 + volatile int gc_seq; 1261 + volatile int gced_lnum; 1267 1262 1268 1263 struct list_head infos_list; 1269 1264 struct mutex umount_mutex; ··· 1443 1434 struct ubifs_budget_req *req); 1444 1435 void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode, 1445 1436 struct ubifs_budget_req *req); 1446 - long long ubifs_budg_get_free_space(struct ubifs_info *c); 1437 + long long ubifs_get_free_space(struct ubifs_info *c); 1447 1438 int ubifs_calc_min_idx_lebs(struct ubifs_info *c); 1448 1439 void ubifs_convert_page_budget(struct ubifs_info *c); 1440 + long long ubifs_reported_space(const struct ubifs_info *c, uint64_t free); 1449 1441 long long ubifs_calc_available(const struct ubifs_info *c, int min_idx_lebs); 1450 1442 1451 1443 /* find.c */ ··· 1461 1451 /* tnc.c */ 1462 1452 int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, 1463 1453 struct ubifs_znode **zn, int *n); 1464 - int ubifs_tnc_lookup(struct ubifs_info *c, const union ubifs_key *key, 1465 - void *node); 1466 1454 int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, 1467 1455 void *node, const struct qstr *nm); 1468 1456 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key,