Skip to content

Commit b65867d

Browse files
committed
register a file to trimmap when opening it
1 parent 7177677 commit b65867d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

  • src/third_party/wiredtiger/src/os_posix

src/third_party/wiredtiger/src/os_posix/os_open.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
#include "wt_internal.h"
1010

11+
#if defined (TDN_TRIM5) || defined (TDN_TRIM5_2)
12+
#include "mytrim.h"
13+
extern TRIM_MAP* trimmap;
14+
extern FILE* my_fp4;
15+
extern size_t my_trim_freq_config; //how often trim will call
16+
#endif
1117
/*
1218
* __open_directory --
1319
* Open up a file handle to a directory.
@@ -144,6 +150,17 @@ __wt_open(WT_SESSION_IMPL *session,
144150
WT_ERR(posix_fadvise(fd, 0, 0, POSIX_FADV_RANDOM));
145151
#endif
146152

153+
#if defined (TDN_TRIM5) || defined (TDN_TRIM5_2)
154+
//simple register object to trimmap
155+
if( ((strstr(name, "linkbench/collection") != 0) || (strstr(name, "linkbench/index") != 0)) ) {
156+
//achieve offset in retval
157+
158+
printf("==> open %s fd %d\n", name, fd);
159+
trimmap_add(trimmap, fd, TRIM_INIT_THRESHOLD);
160+
printf("==> register object %s current size %d\n", name, trimmap->size);
161+
162+
}
163+
#endif
147164
WT_ERR(__wt_calloc_one(session, &fh));
148165
WT_ERR(__wt_strdup(session, name, &fh->name));
149166
fh->name_hash = hash;

0 commit comments

Comments
 (0)