Add compiler flag to disable explicit msync() calls

This commit is contained in:
Patrick J Cherry
2018-01-31 20:45:48 +00:00
parent f2fa00260b
commit 7f98f6ef9e
2 changed files with 8 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ VPATH=src:tests/unit
DESTDIR?=/
PREFIX?=/usr/local/bin
INSTALLDIR=$(DESTDIR)/$(PREFIX)
ifdef DEBUG
CFLAGS_EXTRA=-g -DDEBUG
LDFLAGS_EXTRA=-g
@@ -12,6 +12,11 @@ else
CFLAGS_EXTRA=-O2
endif
NO_MSYNC=1
ifdef NO_MSYNC
CFLAGS_EXTRA += -DNO_MSYNC
endif
CFLAGS_EXTRA += -fPIC --std=gnu99
LDFLAGS_EXTRA += -Wl,--relax,--gc-sections -L$(LIB) -Wl,-rpath-link,$(LIB)

View File

@@ -472,7 +472,7 @@ void client_reply_to_write( struct client* client, struct nbd_request request )
bitset_set_range(client->serve->allocation_map, request.from, request.len);
}
if (1) /* not sure whether this is necessary... */
#ifndef NO_MSYNC
{
/* multiple of 4K page size */
uint64_t from_rounded = request.from & (!0xfff);
@@ -485,6 +485,7 @@ void client_reply_to_write( struct client* client, struct nbd_request request )
"msync failed %ld %ld", request.from, request.len
);
}
#endif
client_write_reply( client, &request, 0);
}