[sheepdog] [PATCH] disk cache: drop O_DSYNC only when O_DIRECT is set
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Thu Oct 25 06:52:01 CEST 2012
To make sure that data is not cached by the host os, we cannot drop
O_DSYNC when O_DIRECT is not set.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/plain_store.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index 9ff2fc3..57d4d79 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -139,7 +139,8 @@ int default_write(uint64_t oid, const struct siocb *iocb)
}
get_obj_path(oid, path);
- if (iocb->flags & SD_FLAG_CMD_CACHE && is_disk_cache_enabled())
+ if (iocb->flags & SD_FLAG_CMD_CACHE && is_disk_cache_enabled() &&
+ flags & O_DIRECT)
flags &= ~O_DSYNC;
fd = open(path, flags, def_fmode);
if (fd < 0)
@@ -302,7 +303,8 @@ int default_create_and_write(uint64_t oid, const struct siocb *iocb)
get_obj_path(oid, path);
get_tmp_obj_path(oid, tmp_path);
- if (iocb->flags & SD_FLAG_CMD_CACHE && is_disk_cache_enabled())
+ if (iocb->flags & SD_FLAG_CMD_CACHE && is_disk_cache_enabled() &&
+ flags & O_DIRECT)
flags &= ~O_DSYNC;
fd = open(tmp_path, flags, def_fmode);
--
1.7.2.5
More information about the sheepdog
mailing list