[sheepdog] [PATCH v4 1/2] journal: remove journaling support for config
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Tue Apr 16 11:04:34 CEST 2013
From: Hitoshi Mitake <mitake.hitoshi at gmail.com>
The journaling support for config cannot work well because it causes
deadlock in the initialization sequence of sheep.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
sheep/config.c | 14 +-------------
sheep/journal.c | 17 -----------------
2 files changed, 1 insertions(+), 30 deletions(-)
diff --git a/sheep/config.c b/sheep/config.c
index 63c1e81..49916e7 100644
--- a/sheep/config.c
+++ b/sheep/config.c
@@ -36,20 +36,8 @@ char *config_path;
static int write_config(void)
{
int fd, ret;
- int flags = O_RDWR | O_CREAT | O_DSYNC;
-
- if (uatomic_is_true(&sys->use_journal) &&
- journal_write_config((char *)&config, sizeof(config))
- != SD_RES_SUCCESS) {
- sd_eprintf("turn off journaling");
- uatomic_set_false(&sys->use_journal);
- sync();
- }
-
- if (uatomic_is_true(&sys->use_journal))
- flags &= ~O_DSYNC;
- fd = open(config_path, flags, def_fmode);
+ fd = open(config_path, O_RDWR | O_CREAT | O_DSYNC, def_fmode);
if (fd < 0) {
sd_eprintf("failed to open config file, %m");
return SD_RES_EIO;
diff --git a/sheep/journal.c b/sheep/journal.c
index be1a6b7..aa07721 100644
--- a/sheep/journal.c
+++ b/sheep/journal.c
@@ -52,7 +52,6 @@ struct journal_descriptor {
#define JF_STORE 0
#define JF_EPOCH 1
-#define JF_CONFIG 2
static const char *jfile_name[2] = { "journal_file0", "journal_file1", };
static int jfile_fds[2];
@@ -150,10 +149,6 @@ static void journal_get_path(struct journal_descriptor *jd, char *path)
sd_iprintf("%s, %"PRIu32" size %"PRIu64,
path, jd->epoch, jd->size);
break;
- case JF_CONFIG:
- snprintf(path, PATH_MAX, "%s", config_path);
- sd_iprintf("%s, size %"PRIu64, path, jd->size);
- break;
}
}
@@ -441,15 +436,3 @@ int journal_write_epoch(const char *buf, size_t size, uint32_t epoch)
jd.epoch = epoch;
return journal_file_write(&jd, buf);
}
-
-int journal_write_config(const char *buf, size_t size)
-{
- struct journal_descriptor jd = {
- .magic = JOURNAL_DESC_MAGIC,
- .flag = JF_CONFIG,
- .offset = 0,
- .size = size,
- .create = true,
- };
- return journal_file_write(&jd, buf);
-}
--
1.7.2.5
More information about the sheepdog
mailing list