diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-11 04:17:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-11 04:17:42 -0500 |
commit | f437e8b53eab92a5829e65781e29aed23d8ffd0c (patch) | |
tree | 48982c8818a4ac5cddb84ca6a1d55620eb9680ee /fs/ubifs/orphan.c | |
parent | 140573d33b703194b7e1893711e78b7f546cca7c (diff) | |
parent | 8e4921515c1a379539607eb443d51c30f4f7f338 (diff) |
Merge commit 'v2.6.29-rc4' into sched/core
Diffstat (limited to 'fs/ubifs/orphan.c')
-rw-r--r-- | fs/ubifs/orphan.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index 9e6f403f170e..152a7b34a141 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -46,7 +46,7 @@ | |||
46 | * Orphans are accumulated in a rb-tree. When an inode's link count drops to | 46 | * Orphans are accumulated in a rb-tree. When an inode's link count drops to |
47 | * zero, the inode number is added to the rb-tree. It is removed from the tree | 47 | * zero, the inode number is added to the rb-tree. It is removed from the tree |
48 | * when the inode is deleted. Any new orphans that are in the orphan tree when | 48 | * when the inode is deleted. Any new orphans that are in the orphan tree when |
49 | * the commit is run, are written to the orphan area in 1 or more orph nodes. | 49 | * the commit is run, are written to the orphan area in 1 or more orphan nodes. |
50 | * If the orphan area is full, it is consolidated to make space. There is | 50 | * If the orphan area is full, it is consolidated to make space. There is |
51 | * always enough space because validation prevents the user from creating more | 51 | * always enough space because validation prevents the user from creating more |
52 | * than the maximum number of orphans allowed. | 52 | * than the maximum number of orphans allowed. |
@@ -231,7 +231,7 @@ static int tot_avail_orphs(struct ubifs_info *c) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * do_write_orph_node - write a node | 234 | * do_write_orph_node - write a node to the orphan head. |
235 | * @c: UBIFS file-system description object | 235 | * @c: UBIFS file-system description object |
236 | * @len: length of node | 236 | * @len: length of node |
237 | * @atomic: write atomically | 237 | * @atomic: write atomically |
@@ -264,11 +264,11 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic) | |||
264 | } | 264 | } |
265 | 265 | ||
266 | /** | 266 | /** |
267 | * write_orph_node - write an orph node | 267 | * write_orph_node - write an orphan node. |
268 | * @c: UBIFS file-system description object | 268 | * @c: UBIFS file-system description object |
269 | * @atomic: write atomically | 269 | * @atomic: write atomically |
270 | * | 270 | * |
271 | * This function builds an orph node from the cnext list and writes it to the | 271 | * This function builds an orphan node from the cnext list and writes it to the |
272 | * orphan head. On success, %0 is returned, otherwise a negative error code | 272 | * orphan head. On success, %0 is returned, otherwise a negative error code |
273 | * is returned. | 273 | * is returned. |
274 | */ | 274 | */ |
@@ -326,11 +326,11 @@ static int write_orph_node(struct ubifs_info *c, int atomic) | |||
326 | } | 326 | } |
327 | 327 | ||
328 | /** | 328 | /** |
329 | * write_orph_nodes - write orph nodes until there are no more to commit | 329 | * write_orph_nodes - write orphan nodes until there are no more to commit. |
330 | * @c: UBIFS file-system description object | 330 | * @c: UBIFS file-system description object |
331 | * @atomic: write atomically | 331 | * @atomic: write atomically |
332 | * | 332 | * |
333 | * This function writes orph nodes for all the orphans to commit. On success, | 333 | * This function writes orphan nodes for all the orphans to commit. On success, |
334 | * %0 is returned, otherwise a negative error code is returned. | 334 | * %0 is returned, otherwise a negative error code is returned. |
335 | */ | 335 | */ |
336 | static int write_orph_nodes(struct ubifs_info *c, int atomic) | 336 | static int write_orph_nodes(struct ubifs_info *c, int atomic) |
@@ -478,14 +478,14 @@ int ubifs_orphan_end_commit(struct ubifs_info *c) | |||
478 | } | 478 | } |
479 | 479 | ||
480 | /** | 480 | /** |
481 | * clear_orphans - erase all LEBs used for orphans. | 481 | * ubifs_clear_orphans - erase all LEBs used for orphans. |
482 | * @c: UBIFS file-system description object | 482 | * @c: UBIFS file-system description object |
483 | * | 483 | * |
484 | * If recovery is not required, then the orphans from the previous session | 484 | * If recovery is not required, then the orphans from the previous session |
485 | * are not needed. This function locates the LEBs used to record | 485 | * are not needed. This function locates the LEBs used to record |
486 | * orphans, and un-maps them. | 486 | * orphans, and un-maps them. |
487 | */ | 487 | */ |
488 | static int clear_orphans(struct ubifs_info *c) | 488 | int ubifs_clear_orphans(struct ubifs_info *c) |
489 | { | 489 | { |
490 | int lnum, err; | 490 | int lnum, err; |
491 | 491 | ||
@@ -547,9 +547,9 @@ static int insert_dead_orphan(struct ubifs_info *c, ino_t inum) | |||
547 | * do_kill_orphans - remove orphan inodes from the index. | 547 | * do_kill_orphans - remove orphan inodes from the index. |
548 | * @c: UBIFS file-system description object | 548 | * @c: UBIFS file-system description object |
549 | * @sleb: scanned LEB | 549 | * @sleb: scanned LEB |
550 | * @last_cmt_no: cmt_no of last orph node read is passed and returned here | 550 | * @last_cmt_no: cmt_no of last orphan node read is passed and returned here |
551 | * @outofdate: whether the LEB is out of date is returned here | 551 | * @outofdate: whether the LEB is out of date is returned here |
552 | * @last_flagged: whether the end orph node is encountered | 552 | * @last_flagged: whether the end orphan node is encountered |
553 | * | 553 | * |
554 | * This function is a helper to the 'kill_orphans()' function. It goes through | 554 | * This function is a helper to the 'kill_orphans()' function. It goes through |
555 | * every orphan node in a LEB and for every inode number recorded, removes | 555 | * every orphan node in a LEB and for every inode number recorded, removes |
@@ -580,8 +580,8 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
580 | /* | 580 | /* |
581 | * The commit number on the master node may be less, because | 581 | * The commit number on the master node may be less, because |
582 | * of a failed commit. If there are several failed commits in a | 582 | * of a failed commit. If there are several failed commits in a |
583 | * row, the commit number written on orph nodes will continue to | 583 | * row, the commit number written on orphan nodes will continue |
584 | * increase (because the commit number is adjusted here) even | 584 | * to increase (because the commit number is adjusted here) even |
585 | * though the commit number on the master node stays the same | 585 | * though the commit number on the master node stays the same |
586 | * because the master node has not been re-written. | 586 | * because the master node has not been re-written. |
587 | */ | 587 | */ |
@@ -589,9 +589,9 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
589 | c->cmt_no = cmt_no; | 589 | c->cmt_no = cmt_no; |
590 | if (cmt_no < *last_cmt_no && *last_flagged) { | 590 | if (cmt_no < *last_cmt_no && *last_flagged) { |
591 | /* | 591 | /* |
592 | * The last orph node had a higher commit number and was | 592 | * The last orphan node had a higher commit number and |
593 | * flagged as the last written for that commit number. | 593 | * was flagged as the last written for that commit |
594 | * That makes this orph node, out of date. | 594 | * number. That makes this orphan node, out of date. |
595 | */ | 595 | */ |
596 | if (!first) { | 596 | if (!first) { |
597 | ubifs_err("out of order commit number %llu in " | 597 | ubifs_err("out of order commit number %llu in " |
@@ -658,10 +658,10 @@ static int kill_orphans(struct ubifs_info *c) | |||
658 | /* | 658 | /* |
659 | * Orph nodes always start at c->orph_first and are written to each | 659 | * Orph nodes always start at c->orph_first and are written to each |
660 | * successive LEB in turn. Generally unused LEBs will have been unmapped | 660 | * successive LEB in turn. Generally unused LEBs will have been unmapped |
661 | * but may contain out of date orph nodes if the unmap didn't go | 661 | * but may contain out of date orphan nodes if the unmap didn't go |
662 | * through. In addition, the last orph node written for each commit is | 662 | * through. In addition, the last orphan node written for each commit is |
663 | * marked (top bit of orph->cmt_no is set to 1). It is possible that | 663 | * marked (top bit of orph->cmt_no is set to 1). It is possible that |
664 | * there are orph nodes from the next commit (i.e. the commit did not | 664 | * there are orphan nodes from the next commit (i.e. the commit did not |
665 | * complete successfully). In that case, no orphans will have been lost | 665 | * complete successfully). In that case, no orphans will have been lost |
666 | * due to the way that orphans are written, and any orphans added will | 666 | * due to the way that orphans are written, and any orphans added will |
667 | * be valid orphans anyway and so can be deleted. | 667 | * be valid orphans anyway and so can be deleted. |
@@ -718,7 +718,7 @@ int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only) | |||
718 | if (unclean) | 718 | if (unclean) |
719 | err = kill_orphans(c); | 719 | err = kill_orphans(c); |
720 | else if (!read_only) | 720 | else if (!read_only) |
721 | err = clear_orphans(c); | 721 | err = ubifs_clear_orphans(c); |
722 | 722 | ||
723 | return err; | 723 | return err; |
724 | } | 724 | } |