{"id":3233,"date":"2017-03-02T23:58:26","date_gmt":"2017-03-02T15:58:26","guid":{"rendered":"https:\/\/ixyzero.com\/blog\/?p=3233"},"modified":"2017-03-02T23:58:26","modified_gmt":"2017-03-02T15:58:26","slug":"%e4%bb%80%e4%b9%88%e6%98%afpagecachedentriesinodes","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/3233.html","title":{"rendered":"\u4ec0\u4e48\u662fpagecache\/dentries\/inodes?"},"content":{"rendered":"<p>=Start=<\/p>\n<h4 id=\"id-\u4ec0\u4e48\u662fpagecache\/dentries\/inodes-\u7f18\u7531\uff1a\">\u7f18\u7531\uff1a<\/h4>\n<p>\u6700\u8fd1\u56e0\u4e3a\u65b0\u4e0a\u4e86\u4e00\u4e2a\u626b\u63cf\u529f\u80fd\u5bfc\u81f4\u5927\u8303\u56f4\u5185\u7684\u673a\u5668\u544a\u8b66\uff0c\u65b0\u4e0a\u7684\u529f\u80fd\u4ee3\u7801\u5176\u5b9e\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n<div class=\"code panel pdl conf-macro output-block\" data-hasbody=\"true\" data-macro-name=\"code\">\n<div class=\"codeContent panelContent pdl\">\n<div id=\"highlighter_699046\" class=\"syntaxhighlighter sh-confluence nogutter java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\" title=\"Hint: double-click to select code\">\n<div class=\"line number1 index0 alt2\"><code class=\"java plain\">find \/ -type f -name\u00a0<\/code><code class=\"java string\">\"ffmpeg\"<\/code>\u00a0<code class=\"java plain\">-executable\u00a0<\/code><code class=\"java value\">2<\/code><code class=\"java plain\">&gt;\/dev\/<\/code><code class=\"java keyword\">null<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<p>\u56e0\u4e3affmpeg\u5b89\u88c5\u8def\u5f84\u7684\u4e0d\u786e\u5b9a\u6027\uff0c\u6240\u4ee5\u4f7f\u7528\u4e86\u5168\u76d8\u626b\u63cf\u7684\u529e\u6cd5\uff0c\u867d\u7136\u4e4b\u524d\u6709\u8003\u8651\u8fc7\u8fd9\u6837\u4f1a\u5bf9\u7ebf\u4e0a\u7684\u90e8\u5206\u673a\u5668\u4ea7\u751f\u5f71\u54cd\uff0c\u4f46\u662f\u8bf4\u5b9e\u8bdd\uff0c\u6ca1\u60f3\u5230\u5f71\u54cd\u8fd9\u4e48\u5927\u3002\u3002\u3002<\/p>\n<p>\u800c\u4e14\u6700\u8be1\u5f02\u7684\u5730\u65b9\u5728\u4e8e\uff0c\u540c\u4e00\u4e2a\u547d\u4ee4\u5bf9\u4e8e\u4e0d\u540c\u7684\u673a\u5668\u5f71\u54cd\u5dee\u522b\u5f88\u5927\uff0c\u6709\u7684\u57fa\u672c\u6ca1\u4ec0\u4e48\u5f71\u54cd\uff0c\u6709\u7684\u670d\u52a1\u5668\u4e0a\u9762\u8fd0\u884c\u7684\u670d\u52a1\u53ef\u7528\u6027\u964d\u4f4e\u4e0d\u5c11\uff0c\u800c\u4e14\u66f4\u5947\u602a\u7684\u5730\u65b9\u5728\u4e8e\u2014\u2014\u7269\u7406\u673a\u7684\u7f51\u7edc\u7adf\u7136\u4e5f\u51fa\u73b0\u4e86\u95ee\u9898\u3002\u3002\u3002\u8fd0\u6c14\u4e0d\u597d\uff0c\u8fd9\u79cd\u4e8b\u60c5\u8ba9\u6211\u649e\u4e0a\u4e86\uff0c\u6211\u53ea\u80fd\u8fd9\u4e48\u5b89\u6170\u81ea\u5df1\uff01<\/p>\n<p>\u4e4b\u524d\u5bf9pagecache\/dentries\/inodes\u8fd9\u4e9b\u77e5\u8bc6\u6709\u4e00\u5b9a\u4e86\u89e3\uff0c\u4f46\u4e86\u89e3\u4e0d\u6df1\uff0c\u8d81\u7740\u8fd9\u6b21\u673a\u4f1a\u518d\u597d\u597d\u5b66\u4e60\u4e00\u4e0b\uff0c\u4ee5\u540e\u51fa\u73b0\u95ee\u9898\u4e86\u4e5f\u597d\u5feb\u901f\u5b9a\u4f4d\u3002<\/p>\n<h4 id=\"id-\u4ec0\u4e48\u662fpagecache\/dentries\/inodes-\u6b63\u6587\uff1a\">\u6b63\u6587\uff1a<\/h4>\n<h5 id=\"id-\u4ec0\u4e48\u662fpagecache\/dentries\/inodes-\u53c2\u8003\u89e3\u7b54\uff1a\">\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n<p>It appears you are working with memory caching of directory structures. \u5f53\u6211\u4eec\u6b63\u5728\u4f7f\u7528\u5185\u5b58\u7f13\u5b58\u76ee\u5f55\u7ed3\u6784\u65f6\uff0c<\/p>\n<p>An\u00a0<em><strong>inode<\/strong><\/em>\u00a0in your context is a data structure that represents a file. A\u00a0<em><strong>dentries<\/strong><\/em>\u00a0is a data structure that represents a directory.\u00a0\u5728\u8fd9\u4e2a\u4e0a\u4e0b\u6587\u4e2d\u7684<span style=\"color: #ff0000;\"><strong>inode\u662f\u8868\u793a\u6587\u4ef6\u7684\u6570\u636e\u7ed3\u6784\uff0c\u800cdentries\u662f\u8868\u793a\u76ee\u5f55\u7684\u6570\u636e\u7ed3\u6784<\/strong><\/span>\u3002<\/p>\n<p>These structures could be used to build a memory cache that represents the file structure on a disk. To get a directly listing, the OS could go to the dentries&#8211;if the directory is there&#8211;list its contents (a series of inodes). If not there, go to the disk and read it into memory so that it can be used again.\u00a0\u8fd9\u4e9b\u7ed3\u6784\u53ef\u7528\u4e8e\u6784\u5efa\u8868\u793a\u78c1\u76d8\u4e0a\u7684\u6587\u4ef6\u7ed3\u6784\u7684\u5185\u5b58\u9ad8\u901f\u7f13\u5b58\u3002\u4e3a\u4e86\u76f4\u63a5\u83b7\u5f97\u5217\u8868\uff0c\u64cd\u4f5c\u7cfb\u7edf\u53ef\u4ee5\u53bbdentries\u90a3\u91cc\uff08\u5982\u679c\u76ee\u5f55\u5728\u90a3\u91cc\u7684\u8bdd\uff09\u5217\u51fa\u5176\u5185\u5bb9\uff08\u4e00\u7cfb\u5217inode\uff09\u3002\u5982\u679c\u6ca1\u6709\uff0c\u5219\u4f1a\u53bb\u78c1\u76d8\u4e0a\u5c06\u5176\u8bfb\u5165\u5185\u5b58\uff0c\u4ee5\u4fbf\u5b83\u53ef\u4ee5\u518d\u6b21\u4f7f\u7528\u3002<\/p>\n<p>The\u00a0<em><strong>page cache<\/strong><\/em>\u00a0could contain any memory mappings to blocks on disk. That could conceivably be buffered I\/O, memory mapped files, paged areas of executables&#8211;anything that the OS could hold in memory from a file.\u00a0\u9875\u9762\u7f13\u5b58\uff08page cache\uff09\u53ef\u4ee5\u5305\u542b\u78c1\u76d8\u5757\u7684\u4efb\u4f55\u5185\u5b58\u6620\u5c04\u3002\u8fd9\u53ef\u4ee5\u662f\u7f13\u51b2I\/O\uff0c\u5185\u5b58\u6620\u5c04\u6587\u4ef6\uff0c\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5206\u9875\u533a\u57df\u2014\u2014\u64cd\u4f5c\u7cfb\u7edf\u53ef\u4ee5\u4ece\u6587\u4ef6\u4fdd\u5b58\u5728\u5185\u5b58\u4e2d\u7684\u4efb\u4f55\u5185\u5bb9\u3002<\/p>\n<p>==<\/p>\n<div class=\"code panel pdl conf-macro output-block\" data-hasbody=\"true\" data-macro-name=\"code\">\n<div class=\"codeHeader panelHeader pdl\"><b>\u5982\u4f55\u91ca\u653epagecache\/dentries\/inodes<\/b><\/div>\n<div class=\"codeContent panelContent pdl\">\n<div id=\"highlighter_782883\" class=\"syntaxhighlighter sh-confluence nogutter java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"code\">\n<div class=\"container\" title=\"Hint: double-click to select code\">\n<div class=\"line number1 index0 alt2\"><code class=\"java plain\">To free pagecache:<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"java plain\"># echo\u00a0<\/code><code class=\"java value\">1<\/code>\u00a0<code class=\"java plain\">&gt; \/proc\/sys\/vm\/drop_caches<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"java plain\">To free dentries and inodes:<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"java plain\"># echo\u00a0<\/code><code class=\"java value\">2<\/code>\u00a0<code class=\"java plain\">&gt; \/proc\/sys\/vm\/drop_caches<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"java plain\">To free pagecache, dentries and inodes:<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"java plain\"># echo\u00a0<\/code><code class=\"java value\">3<\/code>\u00a0<code class=\"java plain\">&gt; \/proc\/sys\/vm\/drop_caches<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<h5 id=\"id-\u4ec0\u4e48\u662fpagecache\/dentries\/inodes-\u53c2\u8003\u94fe\u63a5\uff1a\">\u53c2\u8003\u94fe\u63a5\uff1a<\/h5>\n<ul>\n<li><a class=\"external-link\" href=\"http:\/\/unix.stackexchange.com\/questions\/87908\/how-do-you-empty-the-buffers-and-cache-on-a-linux-system\" target=\"_blank\" rel=\"nofollow\">\u5982\u4f55\u6e05\u7a7aLinux\u7cfb\u7edf\u4e0a\u7684buffer\u548ccache\uff1f<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/stackoverflow.com\/questions\/29870068\/what-are-pagecache-dentries-inodes\" target=\"_blank\" rel=\"nofollow\">\u4ec0\u4e48\u662fpagecache\/dentries\/inodes<\/a><\/li>\n<li><a class=\"external-link\" href=\"http:\/\/www.linuxatemyram.com\/\" target=\"_blank\" rel=\"nofollow\">Linux ate my RAM<\/a><\/li>\n<\/ul>\n<p>=END=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531\uff1a \u6700\u8fd1\u56e0\u4e3a\u65b0\u4e0a\u4e86\u4e00\u4e2a\u626b\u63cf\u529f\u80fd\u5bfc\u81f4\u5927\u8303\u56f4\u5185\u7684\u673a\u5668\u544a\u8b66\uff0c\u65b0\u4e0a\u7684\u529f\u80fd\u4ee3\u7801\u5176\u5b9e\u975e\u5e38\u7b80\u5355\uff1a fin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,11],"tags":[760,758,30,761],"class_list":["post-3233","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-linux","tag-dentry","tag-inode","tag-linux","tag-pagecache"],"views":8279,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=3233"}],"version-history":[{"count":1,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3233\/revisions"}],"predecessor-version":[{"id":3234,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3233\/revisions\/3234"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=3233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=3233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=3233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}