{"id":90311,"date":"2024-03-03T13:55:16","date_gmt":"2024-03-03T05:55:16","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=90311"},"modified":"2024-03-03T13:55:16","modified_gmt":"2024-03-03T05:55:16","slug":"linux-vfs","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-vfs.html","title":{"rendered":"Linux\u865a\u62df\u6587\u4ef6\u7cfb\u7edf–VFS\u7b80\u4ecb"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | Linux\u4e2d\u53ef\u4ee5\u652f\u6301\u591a\u79cd\u6587\u4ef6\u7cfb\u7edf\uff0c\u800c\u4e14\u652f\u6301\u5404\u79cd\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u76f8\u4e92\u8bbf\u95ee\uff0c\u8fd9\u662f\u56e0\u4e3a\u6709\u4e00\u4e2a\u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u3002\u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u4e5f\u53eb\u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u8f6c\u6362\uff08Virtual Filesystem Switch\uff0c\u7b80\u79f0VFS\uff09\uff0c\u4e4b\u6240\u4ee5\u8bf4\u5b83\u865a\u62df\uff0c\u662f\u56e0\u4e3a\u8be5\u6587\u4ef6\u7cfb\u7edf\u7684\u5404\u79cd\u6570\u636e\u7ed3\u6784\u90fd\u662f\u968f\u65f6\u5efa\u7acb\u6216\u5220\u9664\u7684\uff0c\u5728\u76d8\u4e0a\u5e76\u4e0d\u6c38\u4e45\u5b58\u5728\uff0c\u53ea\u80fd\u5b58\u653e\u5728\u5185\u5b58\u4e2d\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u53ea\u6709VFS\u662f\u65e0\u6cd5\u5de5\u4f5c\u7684\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u771f\u6b63\u7684\u6587\u4ef6\u7cfb\u7edf\u3002 <\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n \u6211\u4eec\u628a\u5404\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u5b9e\u9645\u6587\u4ef6\u7cfb\u7edf\u53eb\u505a\u903b\u8f91\u6587\u4ef6\u7cfb\u7edf\uff0cVFS\u662fLinux \u5185\u6838\u4e0e\u8fd9\u4e9b\u903b\u8f91\u6587\u4ef6\u7cfb\u7edf\u7684\u4e00\u4e2a\u63a5\u53e3\uff0c\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u3002<\/p>\n VFS\u662fLinux \u6838\u5fc3\u7684\u4e00\u90e8\u5206\uff0c\u5176\u4ed6\u5185\u6838\u5b50\u7cfb\u7edf\u4e0eVFS\u6253\u4ea4\u9053\uff0cVFS\u53c8\u7ba1\u7406\u5176\u4ed6\u903b\u8f91\u6587\u4ef6\u7cfb\u7edf\u3002\u6240\u4ee5VFS\u662f\u6587\u4ef6\u7cfb\u7edf\u548cLinux \u5185\u6838\u7684\u63a5\u53e3\uff0cVFS\u4ee5\u7edf\u4e00\u6570\u636e\u7ed3\u6784\u7ba1\u7406\u5404\u79cd\u903b\u8f91\u6587\u4ef6\u7cfb\u7edf\uff0c\u63a5\u53d7\u7528\u6237\u5c42\u5bf9\u6587\u4ef6\u7cfb\u7edf\u7684\u5404\u79cd\u64cd\u4f5c\u3002<\/p>\n VFS\u5b58\u5728\u7684\u610f\u4e49<\/strong><\/div>\n 1. \u5411\u4e0a\uff0c\u5bf9\u5e94\u7528\u5c42\u63d0\u4f9b\u4e00\u4e2a\u6807\u51c6\u7684\u6587\u4ef6\u64cd\u4f5c\u63a5\u53e3\uff1b<\/p>\n 2. \u5bf9\u4e0b\uff0c\u5bf9\u6587\u4ef6\u7cfb\u7edf\u63d0\u4f9b\u4e00\u4e2a\u6807\u51c6\u7684\u63a5\u53e3\uff0c\u4ee5\u4fbf\u5176\u4ed6\u64cd\u4f5c\u7cfb\u7edf\u7684\u6587\u4ef6\u7cfb\u7edf\u53ef\u4ee5\u65b9\u4fbf\u7684\u79fb\u690d\u5230Linux\u4e0a\uff1b<\/p>\n 3. VFS\u5185\u90e8\u5219\u901a\u8fc7\u4e00\u7cfb\u5217\u9ad8\u6548\u7684\u7ba1\u7406\u673a\u5236\uff0c\u6bd4\u5982inode cache, dentry cache \u4ee5\u53ca\u6587\u4ef6\u7cfb\u7edf\u7684\u9884\u8bfb\u7b49\u6280\u672f\uff0c\u4f7f\u5f97\u5e95\u5c42\u6587\u4ef6\u7cfb\u7edf\u4e0d\u9700\u6c89\u6eba\u5230\u590d\u6742\u7684\u5185\u6838\u64cd\u4f5c\uff0c\u5373\u53ef\u83b7\u5f97\u9ad8\u6027\u80fd\uff1b<\/p>\n 4. \u6b64\u5916VFS\u628a\u4e00\u4e9b\u590d\u6742\u7684\u64cd\u4f5c\u5c3d\u91cf\u62bd\u8c61\u5230VFS\u5185\u90e8\uff0c\u4f7f\u5f97\u5e95\u5c42\u6587\u4ef6\u7cfb\u7edf\u5b9e\u73b0\u66f4\u7b80\u5355\u3002<\/p>\n \u901a\u7528\u6587\u4ef6\u6a21\u578b<\/strong><\/div>\n VFS\u4e3a\u5e95\u5c42\u6587\u4ef6\u7cfb\u7edf\u63d0\u4f9b\u4e86\u62bd\u8c61\uff0c\u6709\u4e24\u79cd\u7b56\u7565\u63d0\u4f9b\u8fd9\u79cd\u62bd\u8c61\u3002<\/p>\n 1. \u63d0\u4f9b\u4e00\u4e2a\u6700\u5c0f\u7684\u901a\u7528\u6a21\u578b\uff0c\u4f7f\u5f97\u8fd9\u4e2a\u6a21\u578b\u652f\u6301\u7684\u529f\u80fd\u662f\u6240\u6709\u6587\u4ef6\u7cfb\u7edf\u7684\u6700\u5c0f\u4ea4\u96c6<\/p>\n 2. \u63d0\u4f9b\u4e00\u4e2a\u5c3d\u91cf\u5927\u7684\u901a\u7528\u6a21\u578b\uff0c\u4f7f\u5f97\u8fd9\u4e2a\u6a21\u578b\u5305\u542b\u6240\u6709\u6587\u4ef6\u7cfb\u7edf\u529f\u80fd\u7684\u5408\u96c6\u3002<\/p>\n Linux\u91c7\u7528\u7b2c\u4e8c\u79cd\u7b56\u7565\u6765\u5b9e\u73b0VFS\uff0c\u56e0\u6b64VFS\u5c01\u88c5\u4e86\u5e95\u5c42\u6587\u4ef6\u7cfb\u7edf\u7684\u6240\u6709\u529f\u80fd\u548c\u62bd\u8c61\uff0cVFS\u8d1f\u8d23\u628a\u5e94\u7528\u5c42\u7684\u8bf7\u6c42\u8f6c\u53d1\u7ed9\u7279\u5b9a\u7684\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n \u5728\u5904\u7406\u6587\u4ef6\u65f6\uff0c\u5e94\u7528\u7a7a\u95f4\u548c\u5185\u6838\u7a7a\u95f4\u4f7f\u7528\u7684\u5bf9\u8c61\u662f\u4e0d\u540c\u7684\u3002\u5bf9\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\uff0c\u6587\u4ef6\u63cf\u8ff0\u7b26\u7528\u6765\u8868\u793a\u4e00\u4e2a\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u662f\u6253\u5f00\u6587\u4ef6\u65f6\u5185\u6838\u5206\u914d\u7ed9\u8fd9\u4e2a\u6587\u4ef6\u7684\u4e00\u4e2a\u6574\u6570\uff0c\u6ce8\u610f\uff0c\u8fd9\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u53ea\u5728\u672c\u8fdb\u7a0b\u5185\u6709\u6548\uff1b\u800c\u5bf9\u4e8e\u5185\u6838\u6765\u8bf4\uff0c\u5219\u4f7f\u7528\u4e00\u4e2ainode\u6765\u8868\u793a\u4e00\u4e2a\u6587\u4ef6\uff0c\u8fd9\u4e2ainode\u53ef\u80fd\u5bf9\u5e94\u7740\u5e94\u7528\u5c42\u591a\u4e2a\u8fdb\u7a0b\u5185\u7684\u591a\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u3002<\/p>\n \n |