Recent changes (master)
The following changes since commit d4a507c17533f05bcf6d6eeb8d00f3dad1a020a1:
Merge branch 'fio-jsonplus-patches' of https://github.com/vincentkfu/fio (2017-08-07 13:44:01 -0600)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to f9cfc7d44a80638f81810416385136c35ad34658:
Add ability to keep memory-mapped files (2017-08-08 14:26:56 -0600)
----------------------------------------------------------------
Stephen Bates (1):
Add ability to keep memory-mapped files
fio.h | 1 + memory.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
---
Diff of recent changes:
fio.h +1 -0
@@ -87,6 +87,7 @@ enum {TD_F_CHILD =1U <<12 ,TD_F_NO_PROGRESS =1U <<13 ,TD_F_REGROW_LOGS =1U <<14 , + TD_F_MMAP_KEEP = 1U << 15, }; enum {
memory.c +6 -2
@@ -138,6 +138,9 @@ static int alloc_mem_mmap(struct thread_data *td, size_t total_mem) }if (td->o.mmapfile) { +if (access (td->o.mmapfile,F_OK ) ==0 ) + td->flags |=TD_F_MMAP_KEEP ; + td->mmapfd =open (td->o.mmapfile,O_RDWR |O_CREAT ,0644 );if (td->mmapfd <0 ) {
@@ -169,7 +172,7 @@ static int alloc_mem_mmap(struct thread_data *td, size_t total_mem) td->orig_buffer =NULL ;if (td->mmapfd !=1 && td->mmapfd !=-1 ) {close (td->mmapfd); -if (td->o.mmapfile) +if (td->o.mmapfile && !(td->flags &TD_F_MMAP_KEEP ))unlink (td->o.mmapfile); }
@@ -187,7 +190,8 @@ static void free_mem_mmap(struct thread_data *td, size_t total_mem)if (td->o.mmapfile) {if (td->mmapfd !=-1 )close (td->mmapfd); -unlink (td->o.mmapfile); +if (!(td->flags &TD_F_MMAP_KEEP )) +unlink (td->o.mmapfile);free (td->o.mmapfile); } }