提交 2f3d7efc 编写于 作者: S SimonLi 提交者: Gitee

回退 'Pull Request !342 : 增加/proc/fs_cache来显示文件系统缓存维测信息'

上级 b3120b54
...@@ -63,8 +63,6 @@ extern void ProcMountsInit(void); ...@@ -63,8 +63,6 @@ extern void ProcMountsInit(void);
extern void ProcUptimeInit(void); extern void ProcUptimeInit(void);
void ProcFsCacheInit(void);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }
......
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "internal.h"
#include "proc_fs.h"
#include "vnode.h"
#include "path_cache.h"
#include "los_vm_filemap.h"
static char* VnodeTypeToStr(enum VnodeType type) {
switch (type) {
case VNODE_TYPE_UNKNOWN:
return "UKN";
case VNODE_TYPE_REG:
return "REG";
case VNODE_TYPE_DIR:
return "DIR";
case VNODE_TYPE_BLK:
return "BLK";
case VNODE_TYPE_CHR:
return "CHR";
case VNODE_TYPE_BCHR:
return "BCH";
case VNODE_TYPE_FIFO:
return "FIF";
case VNODE_TYPE_LNK:
return "LNK";
default:
return "BAD";
}
}
static int VnodeListProcess(struct SeqBuf *buf, LIST_HEAD* list)
{
int count = 0;
struct Vnode *item = NULL;
struct Vnode *nextItem = NULL;
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, list, struct Vnode, actFreeEntry) {
LosBufPrintf(buf, "%-10p %-10p %-10p %10p 0x%08x %-3d %-4s %-3d %-3d %o\n",
item, item->parent, item->data, item->vop, item->hash, item->useCount,
VnodeTypeToStr(item->type), item->gid, item->uid, item->mode);
count++;
}
return count;
}
static int PathCacheListProcess(struct SeqBuf *buf)
{
int count = 0;
LIST_HEAD* bucketList = GetPathCacheList();
for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) {
struct PathCache *pc = NULL;
LIST_HEAD *list = &bucketList[i];
LOS_DL_LIST_FOR_EACH_ENTRY(pc, list, struct PathCache, hashEntry) {
LosBufPrintf(buf, "%-3d %-10p %-11p %-10p %-9d %s\n", i, pc,
pc->parentVnode, pc->childVnode, pc->hit, pc->name);
count++;
}
}
return count;
}
static void PageCacheEntryProcess(struct SeqBuf *buf, struct page_mapping *mapping)
{
LosFilePage *fpage = NULL;
if (mapping == NULL) {
LosBufPrintf(buf, "null]\n");
return;
}
LOS_DL_LIST_FOR_EACH_ENTRY(fpage, &mapping->page_list, LosFilePage, node) {
LosBufPrintf(buf, "%d,", fpage->pgoff);
}
LosBufPrintf(buf, "]\n");
return;
}
static void PageCacheMapProcess(struct SeqBuf *buf)
{
struct filelist *flist = &tg_filelist;
struct file *filep = NULL;
(void)sem_wait(&flist->fl_sem);
for (int i = 3; i < CONFIG_NFILE_DESCRIPTORS; i++) {
if (!get_bit(i)) {
continue;
}
filep = &flist->fl_files[i];
if (filep == NULL) {
continue;
}
LosBufPrintf(buf, "[%d]%s:[", i, filep->f_path);
PageCacheEntryProcess(buf, filep->f_mapping);
}
(void)sem_post(&flist->fl_sem);
}
static int FsCacheInfoFill(struct SeqBuf *buf, void *arg)
{
int vnodeFree= 0;
int vnodeActive= 0;
int vnodeVirtual= 0;
int vnodeTotal = 0;
int pathCacheTotal = 0;
int pathCacheTotalTry = 0;
int pathCacheTotalHit = 0;
int pageCacheTotalTry = 0;
int pageCacheTotalHit = 0;
ResetPathCacheHitInfo(&pathCacheTotalHit, &pathCacheTotalTry);
ResetPageCacheHitInfo(&pageCacheTotalTry, &pageCacheTotalHit);
VnodeHold();
LosBufPrintf(buf, "\n=================================================================\n");
LosBufPrintf(buf, "VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
vnodeVirtual = VnodeListProcess(buf, GetVnodeVirtualList());
vnodeFree = VnodeListProcess(buf, GetVnodeFreeList());
vnodeActive = VnodeListProcess(buf, GetVnodeActiveList());
vnodeTotal = vnodeVirtual + vnodeFree + vnodeActive;
LosBufPrintf(buf, "\n=================================================================\n");
LosBufPrintf(buf, "No. CacheAddr ParentAddr ChildAddr HitCount Name\n");
pathCacheTotal = PathCacheListProcess(buf);
LosBufPrintf(buf, "\n=================================================================\n");
PageCacheMapProcess(buf);
LosBufPrintf(buf, "\n=================================================================\n");
LosBufPrintf(buf, "PathCache Total:%d Try:%d Hit:%d\n",
pathCacheTotal, pathCacheTotalTry, pathCacheTotalHit);
LosBufPrintf(buf, "Vnode Total:%d Free:%d Virtual:%d Active:%d\n",
vnodeTotal, vnodeFree, vnodeVirtual, vnodeActive);
LosBufPrintf(buf, "PageCache Try:%d Hit:%d\n", pageCacheTotalTry, pageCacheTotalHit);
VnodeDrop();
return 0;
}
static const struct ProcFileOperations FS_CACHE_PROC_FOPS = {
.read = FsCacheInfoFill,
};
void ProcFsCacheInit(void)
{
#ifdef LOSCFG_DEBUG_VERSION
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0, NULL);
if (pde == NULL) {
PRINT_ERR("create fs_cache error!\n");
return;
}
pde->procFileOps = &FS_CACHE_PROC_FOPS;
#endif
}
...@@ -64,7 +64,6 @@ void ProcFsInit(void) ...@@ -64,7 +64,6 @@ void ProcFsInit(void)
ProcProcessInit(); ProcProcessInit();
ProcUptimeInit(); ProcUptimeInit();
ProcKernelTraceInit(); ProcKernelTraceInit();
ProcFsCacheInit();
} }
LOS_MODULE_INIT(ProcFsInit, LOS_INIT_LEVEL_KMOD_EXTENDED); LOS_MODULE_INIT(ProcFsInit, LOS_INIT_LEVEL_KMOD_EXTENDED);
......
...@@ -42,9 +42,6 @@ struct PathCache { ...@@ -42,9 +42,6 @@ struct PathCache {
LIST_ENTRY childEntry; /* list entry for cache list in the child vnode */ LIST_ENTRY childEntry; /* list entry for cache list in the child vnode */
LIST_ENTRY hashEntry; /* list entry for buckets in the hash table */ LIST_ENTRY hashEntry; /* list entry for buckets in the hash table */
uint8_t nameLen; /* length of path component */ uint8_t nameLen; /* length of path component */
#ifdef LOSCFG_DEBUG_VERSION
int hit; /* cache hit count*/
#endif
char name[0]; /* path component name */ char name[0]; /* path component name */
}; };
...@@ -55,9 +52,5 @@ int PathCacheLookup(struct Vnode *parent, const char *name, int len, struct Vnod ...@@ -55,9 +52,5 @@ int PathCacheLookup(struct Vnode *parent, const char *name, int len, struct Vnod
void VnodePathCacheFree(struct Vnode *vnode); void VnodePathCacheFree(struct Vnode *vnode);
void PathCacheMemoryDump(void); void PathCacheMemoryDump(void);
void PathCacheDump(void); void PathCacheDump(void);
LIST_HEAD* GetPathCacheList(void);
#ifdef LOSCFG_DEBUG_VERSION
void ResetPathCacheHitInfo(int *hit, int *try);
#endif
#endif /* _PATH_CACHE_H */ #endif /* _PATH_CACHE_H */
...@@ -176,8 +176,5 @@ void VnodeMemoryDump(void); ...@@ -176,8 +176,5 @@ void VnodeMemoryDump(void);
mode_t GetUmask(void); mode_t GetUmask(void);
int VfsPermissionCheck(uint fuid, uint fgid, mode_t fileMode, int accMode); int VfsPermissionCheck(uint fuid, uint fgid, mode_t fileMode, int accMode);
int VfsVnodePermissionCheck(const struct Vnode *node, int accMode); int VfsVnodePermissionCheck(const struct Vnode *node, int accMode);
LIST_HEAD* GetVnodeFreeList(void);
LIST_HEAD* GetVnodeActiveList(void);
LIST_HEAD* GetVnodeVirtualList(void);
#endif /* !_VNODE_H_ */ #endif /* !_VNODE_H_ */
...@@ -37,23 +37,6 @@ ...@@ -37,23 +37,6 @@
#define PATH_CACHE_HASH_MASK (LOSCFG_MAX_PATH_CACHE_SIZE - 1) #define PATH_CACHE_HASH_MASK (LOSCFG_MAX_PATH_CACHE_SIZE - 1)
LIST_HEAD g_pathCacheHashEntrys[LOSCFG_MAX_PATH_CACHE_SIZE]; LIST_HEAD g_pathCacheHashEntrys[LOSCFG_MAX_PATH_CACHE_SIZE];
#ifdef LOSCFG_DEBUG_VERSION
static int g_totalPathCacheHit = 0;
static int g_totalPathCacheTry = 0;
#define TRACE_TRY_CACHE() do { g_totalPathCacheTry++; } while (0)
#define TRACE_HIT_CACHE(pc) do { pc->hit++; g_totalPathCacheHit++; } while (0)
void ResetPathCacheHitInfo(int *hit, int *try)
{
*hit = g_totalPathCacheHit;
*try = g_totalPathCacheTry;
g_totalPathCacheHit = 0;
g_totalPathCacheTry = 0;
}
#else
#define TRACE_TRY_CACHE()
#define TRACE_HIT_CACHE(pc)
#endif
int PathCacheInit(void) int PathCacheInit(void)
{ {
...@@ -67,12 +50,12 @@ void PathCacheDump(void) ...@@ -67,12 +50,12 @@ void PathCacheDump(void)
{ {
PRINTK("-------->pathCache dump in\n"); PRINTK("-------->pathCache dump in\n");
for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) { for (int i = 0; i < LOSCFG_MAX_PATH_CACHE_SIZE; i++) {
struct PathCache *pc = NULL; struct PathCache *nc = NULL;
LIST_HEAD *nhead = &g_pathCacheHashEntrys[i]; LIST_HEAD *nhead = &g_pathCacheHashEntrys[i];
LOS_DL_LIST_FOR_EACH_ENTRY(pc, nhead, struct PathCache, hashEntry) { LOS_DL_LIST_FOR_EACH_ENTRY(nc, nhead, struct PathCache, hashEntry) {
PRINTK(" pathCache dump hash %d item %s %p %p %d\n", i, PRINTK(" pathCache dump hash %d item %s %p %p %d\n", i,
pc->name, pc->parentVnode, pc->childVnode, pc->nameLen); nc->name, nc->parentVnode, nc->childVnode, nc->nameLen);
} }
} }
PRINTK("-------->pathCache dump out\n"); PRINTK("-------->pathCache dump out\n");
...@@ -111,7 +94,7 @@ static void PathCacheInsert(struct Vnode *parent, struct PathCache *cache, const ...@@ -111,7 +94,7 @@ static void PathCacheInsert(struct Vnode *parent, struct PathCache *cache, const
struct PathCache *PathCacheAlloc(struct Vnode *parent, struct Vnode *vnode, const char *name, uint8_t len) struct PathCache *PathCacheAlloc(struct Vnode *parent, struct Vnode *vnode, const char *name, uint8_t len)
{ {
struct PathCache *pc = NULL; struct PathCache *nc = NULL;
size_t pathCacheSize; size_t pathCacheSize;
int ret; int ret;
...@@ -120,55 +103,53 @@ struct PathCache *PathCacheAlloc(struct Vnode *parent, struct Vnode *vnode, cons ...@@ -120,55 +103,53 @@ struct PathCache *PathCacheAlloc(struct Vnode *parent, struct Vnode *vnode, cons
} }
pathCacheSize = sizeof(struct PathCache) + len + 1; pathCacheSize = sizeof(struct PathCache) + len + 1;
pc = (struct PathCache*)zalloc(pathCacheSize); nc = (struct PathCache*)zalloc(pathCacheSize);
if (pc == NULL) { if (nc == NULL) {
PRINT_ERR("pathCache alloc failed, no memory!\n"); PRINT_ERR("pathCache alloc failed, no memory!\n");
return NULL; return NULL;
} }
ret = strncpy_s(pc->name, len + 1, name, len); ret = strncpy_s(nc->name, len + 1, name, len);
if (ret != LOS_OK) { if (ret != LOS_OK) {
return NULL; return NULL;
} }
pc->parentVnode = parent; nc->parentVnode = parent;
pc->nameLen = len; nc->nameLen = len;
pc->childVnode = vnode; nc->childVnode = vnode;
LOS_ListAdd((&(parent->childPathCaches)), (&(pc->childEntry))); LOS_ListAdd((&(parent->childPathCaches)), (&(nc->childEntry)));
LOS_ListAdd((&(vnode->parentPathCaches)), (&(pc->parentEntry))); LOS_ListAdd((&(vnode->parentPathCaches)), (&(nc->parentEntry)));
PathCacheInsert(parent, pc, name, len); PathCacheInsert(parent, nc, name, len);
return pc; return nc;
} }
int PathCacheFree(struct PathCache *pc) int PathCacheFree(struct PathCache *nc)
{ {
if (pc == NULL) { if (nc == NULL) {
PRINT_ERR("pathCache free: invalid pathCache\n"); PRINT_ERR("pathCache free: invalid pathCache\n");
return -ENOENT; return -ENOENT;
} }
LOS_ListDelete(&pc->hashEntry); LOS_ListDelete(&nc->hashEntry);
LOS_ListDelete(&pc->parentEntry); LOS_ListDelete(&nc->parentEntry);
LOS_ListDelete(&pc->childEntry); LOS_ListDelete(&nc->childEntry);
free(pc); free(nc);
return LOS_OK; return LOS_OK;
} }
int PathCacheLookup(struct Vnode *parent, const char *name, int len, struct Vnode **vnode) int PathCacheLookup(struct Vnode *parent, const char *name, int len, struct Vnode **vnode)
{ {
struct PathCache *pc = NULL; struct PathCache *nc = NULL;
int hash = NameHash(name, len, parent) & PATH_CACHE_HASH_MASK; int hash = NameHash(name, len, parent) & PATH_CACHE_HASH_MASK;
LIST_HEAD *dhead = &g_pathCacheHashEntrys[hash]; LIST_HEAD *dhead = &g_pathCacheHashEntrys[hash];
TRACE_TRY_CACHE(); LOS_DL_LIST_FOR_EACH_ENTRY(nc, dhead, struct PathCache, hashEntry) {
LOS_DL_LIST_FOR_EACH_ENTRY(pc, dhead, struct PathCache, hashEntry) { if (nc->parentVnode == parent && nc->nameLen == len && !strncmp(nc->name, name, len)) {
if (pc->parentVnode == parent && pc->nameLen == len && !strncmp(pc->name, name, len)) { *vnode = nc->childVnode;
*vnode = pc->childVnode;
TRACE_HIT_CACHE(pc);
return LOS_OK; return LOS_OK;
} }
} }
...@@ -203,8 +184,3 @@ void VnodePathCacheFree(struct Vnode *vnode) ...@@ -203,8 +184,3 @@ void VnodePathCacheFree(struct Vnode *vnode)
FreeParentPathCache(vnode); FreeParentPathCache(vnode);
FreeChildPathCache(vnode); FreeChildPathCache(vnode);
} }
LIST_HEAD* GetPathCacheList()
{
return g_pathCacheHashEntrys;
}
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
LIST_HEAD g_vnodeFreeList; /* free vnodes list */ LIST_HEAD g_vnodeFreeList; /* free vnodes list */
LIST_HEAD g_vnodeVirtualList; /* dev vnodes list */ LIST_HEAD g_vnodeVirtualList; /* dev vnodes list */
LIST_HEAD g_vnodeActiveList; /* inuse vnodes list */ LIST_HEAD g_vnodeCurrList; /* inuse vnodes list */
static int g_freeVnodeSize = 0; /* system free vnodes size */ static int g_freeVnodeSize = 0; /* system free vnodes size */
static int g_totalVnodeSize = 0; /* total vnode size */ static int g_totalVnodeSize = 0; /* total vnode size */
...@@ -57,7 +57,7 @@ int VnodesInit(void) ...@@ -57,7 +57,7 @@ int VnodesInit(void)
LOS_ListInit(&g_vnodeFreeList); LOS_ListInit(&g_vnodeFreeList);
LOS_ListInit(&g_vnodeVirtualList); LOS_ListInit(&g_vnodeVirtualList);
LOS_ListInit(&g_vnodeActiveList); LOS_ListInit(&g_vnodeCurrList);
retval = VnodeAlloc(NULL, &g_rootVnode); retval = VnodeAlloc(NULL, &g_rootVnode);
if (retval != LOS_OK) { if (retval != LOS_OK) {
PRINT_ERR("VnodeInit failed error %d\n", retval); PRINT_ERR("VnodeInit failed error %d\n", retval);
...@@ -94,7 +94,7 @@ struct Vnode *VnodeReclaimLru(void) ...@@ -94,7 +94,7 @@ struct Vnode *VnodeReclaimLru(void)
struct Vnode *nextItem = NULL; struct Vnode *nextItem = NULL;
int releaseCount = 0; int releaseCount = 0;
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_vnodeActiveList, struct Vnode, actFreeEntry) { LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
if ((item->useCount > 0) || if ((item->useCount > 0) ||
(item->flag & VNODE_FLAG_MOUNT_ORIGIN) || (item->flag & VNODE_FLAG_MOUNT_ORIGIN) ||
(item->flag & VNODE_FLAG_MOUNT_NEW)) { (item->flag & VNODE_FLAG_MOUNT_NEW)) {
...@@ -152,7 +152,7 @@ int VnodeAlloc(struct VnodeOps *vop, struct Vnode **newVnode) ...@@ -152,7 +152,7 @@ int VnodeAlloc(struct VnodeOps *vop, struct Vnode **newVnode)
LOS_ListAdd(&g_vnodeVirtualList, &(vnode->actFreeEntry)); LOS_ListAdd(&g_vnodeVirtualList, &(vnode->actFreeEntry));
vnode->vop = &g_devfsOps; vnode->vop = &g_devfsOps;
} else { } else {
LOS_ListTailInsert(&g_vnodeActiveList, &(vnode->actFreeEntry)); LOS_ListTailInsert(&g_vnodeCurrList, &(vnode->actFreeEntry));
vnode->vop = vop; vnode->vop = vop;
} }
VnodeDrop(); VnodeDrop();
...@@ -204,7 +204,7 @@ int VnodeFreeAll(const struct Mount *mount) ...@@ -204,7 +204,7 @@ int VnodeFreeAll(const struct Mount *mount)
struct Vnode *nextVnode = NULL; struct Vnode *nextVnode = NULL;
int ret; int ret;
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(vnode, nextVnode, &g_vnodeActiveList, struct Vnode, actFreeEntry) { LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(vnode, nextVnode, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
if ((vnode->originMount == mount) && !(vnode->flag & VNODE_FLAG_MOUNT_NEW)) { if ((vnode->originMount == mount) && !(vnode->flag & VNODE_FLAG_MOUNT_NEW)) {
ret = VnodeFree(vnode); ret = VnodeFree(vnode);
if (ret != LOS_OK) { if (ret != LOS_OK) {
...@@ -220,7 +220,7 @@ BOOL VnodeInUseIter(const struct Mount *mount) ...@@ -220,7 +220,7 @@ BOOL VnodeInUseIter(const struct Mount *mount)
{ {
struct Vnode *vnode = NULL; struct Vnode *vnode = NULL;
LOS_DL_LIST_FOR_EACH_ENTRY(vnode, &g_vnodeActiveList, struct Vnode, actFreeEntry) { LOS_DL_LIST_FOR_EACH_ENTRY(vnode, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
if (vnode->originMount == mount) { if (vnode->originMount == mount) {
if ((vnode->useCount > 0) || (vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)) { if ((vnode->useCount > 0) || (vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)) {
return TRUE; return TRUE;
...@@ -294,7 +294,7 @@ static void RefreshLRU(struct Vnode *vnode) ...@@ -294,7 +294,7 @@ static void RefreshLRU(struct Vnode *vnode)
return; return;
} }
LOS_ListDelete(&(vnode->actFreeEntry)); LOS_ListDelete(&(vnode->actFreeEntry));
LOS_ListTailInsert(&g_vnodeActiveList, &(vnode->actFreeEntry)); LOS_ListTailInsert(&g_vnodeCurrList, &(vnode->actFreeEntry));
} }
static int ProcessVirtualVnode(struct Vnode *parent, uint32_t flags, struct Vnode **vnode) static int ProcessVirtualVnode(struct Vnode *parent, uint32_t flags, struct Vnode **vnode)
...@@ -612,7 +612,7 @@ void VnodeMemoryDump(void) ...@@ -612,7 +612,7 @@ void VnodeMemoryDump(void)
struct Vnode *nextItem = NULL; struct Vnode *nextItem = NULL;
int vnodeCount = 0; int vnodeCount = 0;
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_vnodeActiveList, struct Vnode, actFreeEntry) { LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_vnodeCurrList, struct Vnode, actFreeEntry) {
if ((item->useCount > 0) || if ((item->useCount > 0) ||
(item->flag & VNODE_FLAG_MOUNT_ORIGIN) || (item->flag & VNODE_FLAG_MOUNT_ORIGIN) ||
(item->flag & VNODE_FLAG_MOUNT_NEW)) { (item->flag & VNODE_FLAG_MOUNT_NEW)) {
...@@ -625,18 +625,3 @@ void VnodeMemoryDump(void) ...@@ -625,18 +625,3 @@ void VnodeMemoryDump(void)
PRINTK("Vnode number = %d\n", vnodeCount); PRINTK("Vnode number = %d\n", vnodeCount);
PRINTK("Vnode memory size = %d(B)\n", vnodeCount * sizeof(struct Vnode)); PRINTK("Vnode memory size = %d(B)\n", vnodeCount * sizeof(struct Vnode));
} }
LIST_HEAD* GetVnodeFreeList()
{
return &g_vnodeFreeList;
}
LIST_HEAD* GetVnodeVirtualList()
{
return &g_vnodeVirtualList;
}
LIST_HEAD* GetVnodeActiveList()
{
return &g_vnodeActiveList;
}
...@@ -206,9 +206,6 @@ VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, int off, int le ...@@ -206,9 +206,6 @@ VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, int off, int le
typedef struct ProcessCB LosProcessCB; typedef struct ProcessCB LosProcessCB;
VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB); VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB);
#ifdef LOSCFG_DEBUG_VERSION
VOID ResetPageCacheHitInfo(int *try, int *hit);
#endif
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }
......
...@@ -47,24 +47,6 @@ ...@@ -47,24 +47,6 @@
#define UNUSED(x) (VOID)x #define UNUSED(x) (VOID)x
#endif #endif
#ifdef LOSCFG_DEBUG_VERSION
static int g_totalPageCacheTry = 0;
static int g_totalPageCacheHit = 0;
#define TRACE_TRY_CACHE() do { g_totalPageCacheTry++; } while (0)
#define TRACE_HIT_CACHE() do { g_totalPageCacheHit++; } while (0)
VOID ResetPageCacheHitInfo(int *try, int *hit)
{
*try = g_totalPageCacheTry;
*hit = g_totalPageCacheHit;
g_totalPageCacheHit = 0;
g_totalPageCacheTry = 0;
}
#else
#define TRACE_TRY_CACHE()
#define TRACE_HIT_CACHE()
#endif
#ifdef LOSCFG_KERNEL_VM #ifdef LOSCFG_KERNEL_VM
STATIC VOID OsPageCacheAdd(LosFilePage *page, struct page_mapping *mapping, VM_OFFSET_T pgoff) STATIC VOID OsPageCacheAdd(LosFilePage *page, struct page_mapping *mapping, VM_OFFSET_T pgoff)
...@@ -383,9 +365,7 @@ INT32 OsVmmFileFault(LosVmMapRegion *region, LosVmPgFault *vmf) ...@@ -383,9 +365,7 @@ INT32 OsVmmFileFault(LosVmMapRegion *region, LosVmPgFault *vmf)
/* get or create a new cache node */ /* get or create a new cache node */
LOS_SpinLockSave(&mapping->list_lock, &intSave); LOS_SpinLockSave(&mapping->list_lock, &intSave);
fpage = OsFindGetEntry(mapping, vmf->pgoff); fpage = OsFindGetEntry(mapping, vmf->pgoff);
TRACE_TRY_CACHE();
if (fpage != NULL) { if (fpage != NULL) {
TRACE_HIT_CACHE();
OsPageRefIncLocked(fpage); OsPageRefIncLocked(fpage);
} else { } else {
fpage = OsPageCacheAlloc(mapping, vmf->pgoff); fpage = OsPageCacheAlloc(mapping, vmf->pgoff);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册