US10157143B2ActiveUtilityA1

File access method and apparatus, and storage system

86
Assignee: HUAWEI TECH CO LTDPriority: Sep 1, 2014Filed: Feb 28, 2017Granted: Dec 18, 2018
Est. expirySep 1, 2034(~8.1 yrs left)· nominal 20-yr term from priority
G06F 9/545G06F 2212/1024G06F 12/1009G06F 12/08G06F 16/13
86
PatentIndex Score
5
Cited by
35
References
15
Claims

Abstract

A file access method and apparatus, and a storage system are provided. After receiving a file access request including a file identifier, first physical address space is accessed according to first virtual address space and a first mapping relationship between the first virtual address space and the first physical address space storing a file system. After obtaining, from the first physical address space, an index node of an object file indicated by the file identifier, a file page table is obtained according to information included in the index node, where the file page table records second physical address space of the object file. Then, second virtual address space is allocated to the object file. After establishing a second mapping relationship between the second physical address space and the second virtual address space, the object file in the second physical address space is accessed according to the second virtual address space.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A file access method, comprising:
 receiving a file access request from a process, wherein the file access request comprises a file identifier that indicates a to-be-accessed object file; 
 accessing first physical address space according to preset first virtual address space and a preset first mapping relationship between the first virtual address space and the first physical address space storing a file system, wherein the first virtual address space is a part of user space of an operating system, and the first physical address space is a part of memory space; 
 obtaining, from the first physical address space, an index node of the object file according to the file identifier of the object file, wherein the index node comprises information about a file page table of the object file; 
 obtaining the file page table of the object file according to the information about the file page table of the object file and comprised in the index node, wherein the file page table records second physical address space of a data page of the object file and stored in the first physical address space, and the data page of the object file is used to store file data; 
 allocating second virtual address space to the object file, wherein the second virtual address space is a part of sharing space in the user space of the operating system and allocated to all processes, and the second virtual address space is continuous address space; 
 establishing a second mapping relationship between the second physical address space and the second virtual address space; and 
 accessing the object file in the second physical address space according to the second virtual address space and the second mapping relationship. 
 
     
     
       2. The method according to  claim 1 , wherein establishing a second mapping relationship between the second physical address space and the second virtual address space comprises:
 establishing the second mapping relationship by linking the file page table of the object file to a process page table corresponding to the second virtual address space. 
 
     
     
       3. The method according to  claim 1 , wherein:
 the second virtual address space is greater than the second physical address space; and 
 accessing the object file in the second physical address space according to the second virtual address space and the second mapping relationship comprises:
 performing a read operation on the object file in the second physical address space according to the second virtual address space and the second mapping relationship, and 
 ending the read operation when a virtual address corresponding to data to be read during the read operation exceeds virtual address space corresponding to the object file. 
 
 
     
     
       4. The method according to  claim 1 , wherein:
 the second virtual address space is greater than the second physical address space; and 
 accessing the object file in the second physical address space according to the second virtual address space and the second mapping relationship comprises:
 performing a write operation on the object file in the second physical address space according to the second virtual address space and the second mapping relationship, and 
 ending the write operation when a virtual address corresponding to data to be written during the write operation exceeds the second virtual address space. 
 
 
     
     
       5. The method according to  claim 1 , further comprising:
 establishing, in kernel space, the first mapping relationship between the first virtual address space and the first physical address space, and storing, in a process page table corresponding to the kernel space, a mapping page table corresponding to the first mapping relationship; and 
 wherein after the file access request is received from the process, the method further comprises:
 determining that a process page table corresponding to the first virtual address space does not record the first mapping relationship, and 
 linking, to the process page table corresponding to the first virtual address space, the mapping page table that is stored in the kernel space and corresponding to the first mapping relationship. 
 
 
     
     
       6. A storage system, comprising:
 a memory, configured to store a file; and 
 a processor, coupled to the memory and configured to:
 receive a file access request from a process, wherein the file access request comprises a file identifier that indicates a to-be-accessed object file, 
 access first physical address space according to preset first virtual address space and a preset first mapping relationship between the first virtual address space and the first physical address space storing a file system, wherein the first virtual address space is a part of user space of an operating system, and the first physical address space is a part of memory space, 
 obtain, from the first physical address space, an index node of the object file according to the file identifier of the object file, wherein the index node comprises information about a file page table of the object file, 
 obtain the file page table of the object file according to the information about the file page table of the object file and comprised in the index node, wherein the file page table records second physical address space of a data page of the object file and stored in the first physical address space, and the data page of the object file is used to store file data, 
 allocate second virtual address space to the object file, wherein the second virtual address space is a part of sharing space in the user space of the operating system and allocated to all processes, and the second virtual address space is continuous address space, 
 establish a second mapping relationship between the second physical address space and the second virtual address space, and 
 access the object file in the second physical address space according to the second virtual address space and the second mapping relationship. 
 
 
     
     
       7. The storage system according to  claim 6 , wherein the processor is configured to:
 establish the second mapping relationship by linking the file page table of the object file to a process page table corresponding to the second virtual address space. 
 
     
     
       8. The storage system according to  claim 6 , wherein:
 the second virtual address space is greater than the second physical address space; and 
 the processor is configured to:
 perform a read operation on the object file in the second physical address space according to the second virtual address space and the second mapping relationship, and 
 end the read operation when a virtual address corresponding to data to be read during the read operation exceeds virtual address space corresponding to the object file. 
 
 
     
     
       9. The storage system according to  claim 6 , wherein:
 the second virtual address space is greater than the second physical address space; and 
 the processor is configured to:
 perform a write operation on the object file in the second physical address space according to the second virtual address space and the second mapping relationship, and 
 end the write operation when a virtual address corresponding to data to be written during the write operation exceeds the second virtual address space. 
 
 
     
     
       10. The storage system according to  claim 6 , wherein the processor is further configured to:
 establish, in kernel space, the first mapping relationship between the first virtual address space and the first physical address space, and store, in a process page table corresponding to the kernel space, a mapping page table corresponding to the first mapping relationship; 
 after the file access request is received from the process, determine that a process page table corresponding to the first virtual address space does not record the first mapping relationship; and 
 link, to the process page table corresponding to the first virtual address space, the mapping page table that is stored in the kernel space and corresponding to the first mapping relationship. 
 
     
     
       11. A non-transitory computer-readable storage medium comprising instructions which, when executed by a computer, cause the computer to:
 receive a file access request from a process, wherein the file access request comprises a file identifier that indicates a to-be-accessed object file; 
 access first physical address space according to preset first virtual address space and a preset first mapping relationship between the first virtual address space and the first physical address space storing a file system, wherein the first virtual address space is a part of user space of an operating system, and the first physical address space is a part of memory space; 
 obtain, from the first physical address space, an index node of the object file according to the file identifier of the object file, wherein the index node comprises information about a file page table of the object file; 
 obtain the file page table of the object file according to the information about the file page table of the object file and comprised in the index node, wherein the file page table records second physical address space of a data page of the object file and stored in the first physical address space, and the data page of the object file is used to store file data; 
 allocate second virtual address space to the object file, wherein the second virtual address space is a part of sharing space in the user space of the operating system and allocated to all processes, and the second virtual address space is continuous address space; 
 establish a second mapping relationship between the second physical address space and the second virtual address space; and 
 access the object file in the second physical address space according to the second virtual address space and the second mapping relationship. 
 
     
     
       12. The non-transitory computer-readable storage medium according to  claim 11  comprising instructions which, when executed by the computer, cause the computer to:
 establish the second mapping relationship by linking the file page table of the object file to a process page table corresponding to the second virtual address space. 
 
     
     
       13. The non-transitory computer-readable storage medium according to  claim 11  comprising instructions which, when executed by the computer, cause the computer to:
 perform a read operation on the object file in the second physical address space according to the second virtual address space and the second mapping relationship, wherein the second virtual address space is greater than the second physical address space; and 
 end the read operation when a virtual address corresponding to data to be read during the read operation exceeds virtual address space corresponding to the object file. 
 
     
     
       14. The non-transitory computer-readable storage medium according to  claim 11  comprising instructions which, when executed by the computer, cause the computer to:
 perform a write operation on the object file in the second physical address space according to the second virtual address space and the second mapping relationship, wherein the second virtual address space is greater than the second physical address space; and 
 end the write operation when a virtual address corresponding to data to be written during the write operation exceeds the second virtual address space. 
 
     
     
       15. The non-transitory computer-readable storage medium according to  claim 11 , comprising instructions which, when executed by the computer, cause the computer to:
 establish, in kernel space, the first mapping relationship between the first virtual address space and the first physical address space, and store, in a process page table corresponding to the kernel space, a mapping page table corresponding to the first mapping relationship; and 
 link, to a process page table corresponding to the first virtual address space, the mapping page table that is stored in the kernel space and corresponding to the first mapping relationship after the file access request is received from the process and when the process page table corresponding to the first virtual address space does not record the first mapping relationship.

Cited by (0)

No later patents cite this yet.

References (0)

No backward citations on record.