System and method for using a memory buffer to stream data from a tape to multiple clients
View Patent ↗Embodiments described herein provide systems and methods for streaming data to multiple reading clients. More particularly, embodiments described herein provide systems and methods for using a memory buffer to stream file data from a mounted tape file system volume to multiple reading clients.
1. A system for providing a network based file system, comprising:
a memory;
a processor;
a non-transitory computer readable storage medium storing a set of computer program instructions, the set of computer program instructions comprising instructions executable to:
for a request for a file either partially stored or not stored at all in a disk-based cache,
initiate a tape reading session corresponding to the file;
allocate a buffer in the memory for the tape reading session, wherein the buffer is a circular buffer;
during the tape reading session:
store file data in the buffer read from an LTFS volume;
restore the file to the disk-based cache from the buffer;
reply to read requests for file data of the file from non-lagging network file system interface clients associated with the tape reading session from the buffer; and
reply to read requests for file data of the file from lagging network file system interface clients from the disk-based cache, wherein a network file system interface client was determined to be a lagging network file system interface client based on a position in the circular buffer associated with the network file system client at risk of being overwritten, the risk of being overwritten determined by a space in the circular buffer between a producer writing data in the circular buffer and the position in the circular buffer associated with the network file system interface client.
2. The system of claim 1 , wherein the tape reading session comprises:
a tape data producer configured to write file data into the buffer;
one or more consumers configured to read data from the buffer; and
wherein the set of computer program instructions further comprise instructions executable to expel lagging consumers from the tape reading session.
3. The system of claim 2 , wherein the set of computer program instructions further comprise instructions executable to determine that a consumer is lagging if a data available size for that consumer equals a buffer size of the circular buffer.
4. The system of claim 2 , wherein the set of computer program instructions further comprise instructions executable to:
maintain an absolute producer index and virtual producer index;
maintain an absolute consumer index for each of the one or more consumers and a virtual consumer index for each of the one or more consumers; and
for a consumer, delete the absolute consumer index and virtual consumer index for that consumer if that consumer is expelled from the tape reading session.
5. The system of claim 4 , wherein the set of computer program instructions further comprise instructions executable to map linear file positions to positions in the buffer.
6. The system of claim 2 , wherein the one or more consumers comprise a file restoration consumer and one or more client consumers.
7. The system of claim 6 , wherein the set of computer program instructions further comprise instructions executable to add a client consumer to the tape reading session for each network file system interface client from which an “open” command is received for the file within a defined portion of the tape reading session.
8. A computer program product comprising a non-transitory computer readable medium storing a set of computer program instructions comprising instructions executable to:
for a request for a file either partially stored or not stored at all in a disk-based cache, initiate a tape reading session corresponding to the file;
allocate a buffer in memory for the tape reading, wherein the buffer is a circular buffer;
during the tape reading session:
store file data in the buffer read from an LTFS volume;
restore the file to the disk-based cache from the buffer;
reply to read requests for file data of the file from non-lagging network file system interface clients associated with the tape reading session from the buffer; and
reply to read requests for file data of the file from lagging network file system interface clients from the disk-based cache, wherein a network file system interface client was determined to be a lagging network file system interface client based on a position in the circular buffer associated with the network file system client at risk of being overwritten, the risk of being overwritten determined by a space in the circular buffer between a producer writing data in the circular buffer and the position in the circular buffer associated with the network file system interface client.
9. The computer program product of claim 8 , wherein the tape reading session comprises:
a tape data producer configured to write file data into the buffer;
one or more consumers configured to read data from the buffer:
wherein the set of computer program instructions further comprise instructions executable to expel lagging consumers from the tape reading session.
10. The computer program product of claim 9 , wherein the set of computer program instructions are further comprise instructions executable to determine that a consumer is lagging if a data available size for that consumer equals a buffer size of the circular buffer.
11. The computer program product of claim 9 , wherein the set of computer program instructions further comprise instructions executable to:
maintain an absolute producer index and virtual producer index;
maintain an absolute consumer index for each of the one or more consumers and a virtual consumer index for each of the one or more consumers; and
for a consumer, delete the absolute consumer index and virtual consumer index for that consumer if that consumer is expelled from the tape reading session.
12. The computer program product of claim 8 , wherein the set of computer program instructions further comprise instructions executable to map linear file positions to positions in the buffer.
13. The computer program product of claim 9 , wherein the one or more consumers comprise a file restoration consumer and one or more client consumers.
14. The computer program product of claim 13 , wherein the set of computer program instructions further comprise instructions executable to add a client consumer to the tape reading session for each network file system interface client from which an “open” command is received for the file within a defined portion of the tape reading session.
15. A method for reading file data from a tape file comprising:
interfacing with a media library having tapes storing files according to a tape file system;
maintaining a read cache of files in a data store, the read cache containing file stubs of files in the media library;
presenting a network file system interface to clients;
for a request for a file having a file stub in the read cache,
initiating a tape reading session corresponding to the file;
allocating a buffer in memory for the tape reading session, wherein the buffer is a circular buffer;
during the tape reading session:
storing file data for the file in the buffer read from a tape file system volume;
restoring the file to the data store from the buffer;
replying to read requests for file data of the file from the buffer for read requests from non-lagging network file system interface clients associated with the tape reading session; and
replying to read requests for file data of the file from the data store from lagging network file system interface clients, wherein a network file system interface client was determined to be a lagging network file system interface client based on a position in the circular buffer associated with the network file system client at risk of being overwritten, the risk of being overwritten determined by a space in the circular buffer between a producer writing data in the circular buffer and the position in the circular buffer associated with the network file system interface client.
16. The method of claim 15 , wherein:
the tape reading session comprises:
a tape data producer configured to write file data into the buffer;
one or more consumers configured to read data from the buffer; and
the method further comprises expelling lagging consumers from the tape reading session.
17. The method of claim 16 , further comprising determining that a consumer is lagging if a data available size for that consumer equals a buffer size of the circular buffer.
18. The method of claim 16 , further comprising:
maintaining an absolute producer index and virtual producer index;
maintaining an absolute consumer index for each of the one or more consumers and a virtual consumer index for each of the one or more consumers; and
for a consumer, deleting the absolute consumer index and virtual consumer index for that consumer if that consumer is expelled from the tape reading session.
19. The method of claim 18 , further comprising mapping linear file positions to positions in the buffer.
20. The method of claim 16 , wherein the one or more consumers comprise a file restoration consumer and one or more client consumers.
21. The method of claim 20 , further comprising adding a client consumer to the tape reading session for each network file system interface client from which an “open” command is received for the file within a defined portion of the tape reading session.