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

Function dfs_pcache_dump

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

* @brief Dump page cache information for debugging purposes * * This function prints detailed information about the page cache, including: * - Total page count and capacity * - File paths and page counts for each address space * - Optional detailed page information (with --dump or --dirty flags) * * @param[in] argc Number of command line arguments * @param[in] argv Command line arguments a

Source from the content-addressed store, hash-verified

885 * @see _dfs_aspace_dump() for the actual page dumping implementation
886 */
887static int dfs_pcache_dump(int argc, char **argv)
888{
889 int dump = 0;
890 rt_list_t *node;
891 struct dfs_aspace *aspace;
892
893 if (argc == 2)
894 {
895 if (strcmp(argv[1], "--dump") == 0)
896 {
897 dump = 1;
898 }
899 else if (strcmp(argv[1], "--dirty") == 0)
900 {
901 dump = 2;
902 }
903 else
904 {
905 rt_kprintf("dfs page cache dump\n");
906 rt_kprintf("usage: dfs_cache\n");
907 rt_kprintf(" dfs_cache --dump\n");
908 rt_kprintf(" dfs_cache --dirty\n");
909 return 0;
910 }
911 }
912
913 dfs_pcache_lock();
914
915 rt_kprintf("total pages count: %d / %d\n", rt_atomic_load(&(__pcache.pages_count)), RT_PAGECACHE_COUNT);
916
917 rt_list_for_each(node, &__pcache.list_active)
918 {
919 if (node != &__pcache.list_inactive)
920 {
921 aspace = rt_list_entry(node, struct dfs_aspace, cache_node);
922
923 if (aspace->mnt)
924 {
925 rt_kprintf("file: %s%s pages: %d\n", aspace->fullpath, aspace->pathname, aspace->pages_count);
926 }
927 else
928 {
929 rt_kprintf("unknown type, pages: %d\n", aspace->pages_count);
930 }
931
932 if (dump > 0)
933 {
934 _dfs_aspace_dump(aspace, dump == 2 ? 1 : 0);
935 }
936 }
937 }
938
939 dfs_pcache_unlock();
940
941 return 0;
942}
943MSH_CMD_EXPORT_ALIAS(dfs_pcache_dump, dfs_cache, dump dfs page cache);
944

Callers

nothing calls this directly

Calls 4

rt_kprintfFunction · 0.85
dfs_pcache_lockFunction · 0.85
_dfs_aspace_dumpFunction · 0.85
dfs_pcache_unlockFunction · 0.85

Tested by

no test coverage detected