• Home
  • Raw
  • Download

Lines Matching +full:sub +full:- +full:systems

4  * Copyright (C) 2006-2008 Nokia Corporation.
17 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 * If the root of a TNC sub-tree is clean and old enough, then the children are
33 * dumps entire sub-trees.
35 * The age of znodes is just the time-stamp when they were last looked at.
39 * un-mounts, which is done by the 'ubifs_infos_lock' and 'c->umount_mutex'.
44 /* List of all UBIFS file-system instances */
61 * shrink_tnc - shrink TNC tree.
62 * @c: UBIFS file-system description object
76 ubifs_assert(c, mutex_is_locked(&c->umount_mutex)); in shrink_tnc()
77 ubifs_assert(c, mutex_is_locked(&c->tnc_mutex)); in shrink_tnc()
79 if (!c->zroot.znode || atomic_long_read(&c->clean_zn_cnt) == 0) in shrink_tnc()
84 * to destroy large sub-trees. Indeed, if a znode is old, then all its in shrink_tnc()
87 * Note, we are holding 'c->tnc_mutex', so we do not have to lock the in shrink_tnc()
88 * 'c->space_lock' when _reading_ 'c->clean_zn_cnt', because it is in shrink_tnc()
89 * changed only when the 'c->tnc_mutex' is held. in shrink_tnc()
92 znode = ubifs_tnc_levelorder_next(c, c->zroot.znode, NULL); in shrink_tnc()
94 atomic_long_read(&c->clean_zn_cnt) > 0) { in shrink_tnc()
98 * If the znode is clean, but it is in the 'c->cnext' list, this in shrink_tnc()
108 * the znodes which are in the 'c->cnext' list as freeable. in shrink_tnc()
110 * Also note, if the root of a sub-tree is not in 'c->cnext', in shrink_tnc()
111 * then the whole sub-tree is not in 'c->cnext' as well, so it in shrink_tnc()
112 * is safe to dump whole sub-tree. in shrink_tnc()
115 if (znode->cnext) { in shrink_tnc()
122 abs(time - znode->time) >= age) { in shrink_tnc()
123 if (znode->parent) in shrink_tnc()
124 znode->parent->zbranch[znode->iip].znode = NULL; in shrink_tnc()
126 c->zroot.znode = NULL; in shrink_tnc()
130 atomic_long_sub(freed, &c->clean_zn_cnt); in shrink_tnc()
135 if (unlikely(!c->zroot.znode)) in shrink_tnc()
139 znode = ubifs_tnc_levelorder_next(c, c->zroot.znode, znode); in shrink_tnc()
147 * shrink_tnc_trees - shrink UBIFS TNC trees.
152 * This function walks the list of mounted UBIFS file-systems and frees clean
167 /* Iterate over all mounted UBIFS file-systems and try to shrink them */ in shrink_tnc_trees()
175 if (c->shrinker_run_no == run_no) in shrink_tnc_trees()
177 if (!mutex_trylock(&c->umount_mutex)) { in shrink_tnc_trees()
178 /* Some un-mount is in progress, try next FS */ in shrink_tnc_trees()
180 p = p->next; in shrink_tnc_trees()
184 * We're holding 'c->umount_mutex', so the file-system won't go in shrink_tnc_trees()
187 if (!mutex_trylock(&c->tnc_mutex)) { in shrink_tnc_trees()
188 mutex_unlock(&c->umount_mutex); in shrink_tnc_trees()
190 p = p->next; in shrink_tnc_trees()
195 * OK, now we have TNC locked, the file-system cannot go away - in shrink_tnc_trees()
198 c->shrinker_run_no = run_no; in shrink_tnc_trees()
200 mutex_unlock(&c->tnc_mutex); in shrink_tnc_trees()
203 p = p->next; in shrink_tnc_trees()
208 list_move_tail(&c->infos_list, &ubifs_infos); in shrink_tnc_trees()
209 mutex_unlock(&c->umount_mutex); in shrink_tnc_trees()
218 * kick_a_thread - kick a background thread to start commit.
221 * %-1 if a thread was kicked or there is another reason to assume the memory
231 * Iterate over all mounted UBIFS file-systems and find out if there is in kick_a_thread()
240 if (!mutex_trylock(&c->umount_mutex)) { in kick_a_thread()
242 * Some un-mount is in progress, it will in kick_a_thread()
246 return -1; in kick_a_thread()
249 dirty_zn_cnt = atomic_long_read(&c->dirty_zn_cnt); in kick_a_thread()
251 if (!dirty_zn_cnt || c->cmt_state == COMMIT_BROKEN || in kick_a_thread()
252 c->ro_mount || c->ro_error) { in kick_a_thread()
253 mutex_unlock(&c->umount_mutex); in kick_a_thread()
257 if (c->cmt_state != COMMIT_RESTING) { in kick_a_thread()
259 mutex_unlock(&c->umount_mutex); in kick_a_thread()
260 return -1; in kick_a_thread()
264 list_move_tail(&c->infos_list, &ubifs_infos); in kick_a_thread()
268 mutex_unlock(&c->umount_mutex); in kick_a_thread()
269 return -1; in kick_a_thread()
271 mutex_unlock(&c->umount_mutex); in kick_a_thread()
294 unsigned long nr = sc->nr_to_scan; in ubifs_shrink_scan()
304 * And we return -1 which means will make VM call us again in ubifs_shrink_scan()
316 freed += shrink_tnc_trees(nr - freed, YOUNG_ZNODE_AGE, &contention); in ubifs_shrink_scan()
321 freed += shrink_tnc_trees(nr - freed, 0, &contention); in ubifs_shrink_scan()