MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _pcache_clean

Function _pcache_clean

components/dfs/dfs_v2/src/dfs_pcache.c:201–233  ·  view source on GitHub ↗

* @brief Clean up page cache entries for a specific mount point * * This function iterates through both inactive and active lists of the page cache * to clean up entries associated with the given mount point. It performs cleanup * and calls the provided callback function for each matching address space. * * @param[in] mnt Pointer to the mount point structure to clean up * @param[in] cb Cal

Source from the content-addressed store, hash-verified

199 * The callback takes an address space pointer and returns an integer
200 */
201static void _pcache_clean(struct dfs_mnt *mnt, int (*cb)(struct dfs_aspace *aspace))
202{
203 rt_list_t *node = RT_NULL;
204 struct dfs_aspace *aspace = RT_NULL;
205
206 dfs_pcache_lock();
207
208 node = __pcache.list_inactive.next;
209 while (node != &__pcache.list_active)
210 {
211 aspace = rt_list_entry(node, struct dfs_aspace, cache_node);
212 node = node->next;
213 if (aspace && aspace->mnt == mnt)
214 {
215 dfs_aspace_clean(aspace);
216 cb(aspace);
217 }
218 }
219
220 node = __pcache.list_active.next;
221 while (node != &__pcache.list_inactive)
222 {
223 aspace = rt_list_entry(node, struct dfs_aspace, cache_node);
224 node = node->next;
225 if (aspace && aspace->mnt == mnt)
226 {
227 dfs_aspace_clean(aspace);
228 cb(aspace);
229 }
230 }
231
232 dfs_pcache_unlock();
233}
234
235/**
236 * @brief Unmount and clean up page cache for a specific mount point

Callers 2

dfs_pcache_unmountFunction · 0.85
dfs_pcache_cleanFunction · 0.85

Calls 3

dfs_pcache_lockFunction · 0.85
dfs_aspace_cleanFunction · 0.85
dfs_pcache_unlockFunction · 0.85

Tested by

no test coverage detected