[PATCH] plain store: do NOT read inode when init

12 views
Skip to first unread message

Meng Lingkun

unread,
Apr 26, 2017, 5:55:11 AM4/26/17
to sheep...@googlegroups.com, Menglingkun
From: Menglingkun <mengl...@cmss.chinamobile.com>

Set sys->vdi_inuse bit is enough. When do the rolling-update(commit:802f915),
reading all the large amount of inodes will slow the startup process to
exceed the siesson timeout between sheep and zookeeper.

Signed-off-by: Meng Lingkun <mengl...@cmss.chinamobile.com>
---
sheep/store/plain_store.c | 36 +++---------------------------------
1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/sheep/store/plain_store.c b/sheep/store/plain_store.c
index f3d2d76..cee52af 100644
--- a/sheep/store/plain_store.c
+++ b/sheep/store/plain_store.c
@@ -173,50 +173,20 @@ static int default_read_from_path(uint64_t oid, const char *path,
return ret;
}

-static int init_vdi_state(uint64_t oid, const char *wd, uint32_t epoch)
-{
- int ret;
- struct sd_inode *inode = xzalloc(SD_INODE_HEADER_SIZE);
- struct siocb iocb = {
- .epoch = epoch,
- .buf = inode,
- .length = SD_INODE_HEADER_SIZE,
- };
- char path[PATH_MAX];
-
- if (epoch == 0)
- get_store_path(oid, iocb.ec_index, path);
- else
- get_store_stale_path(oid, iocb.epoch, iocb.ec_index, path);
-
- ret = default_read_from_path(oid, path, &iocb);
- if (ret != SD_RES_SUCCESS) {
- sd_err("failed to read inode header %" PRIx64 " %" PRId32
- "at %s", oid, epoch, path);
- goto out;
- }
- atomic_set_bit(oid_to_vid(oid), sys->vdi_inuse);
-out:
- free(inode);
- return ret;
-}
-
static int init_objlist_and_vdi_bitmap(uint64_t oid, const char *wd,
uint32_t epoch, uint8_t ec_index,
struct vnode_info *vinfo,
void *arg)
{
- int ret;
+ int ret = SD_RES_SUCCESS;
objlist_cache_insert(oid);

if (is_vdi_obj(oid)) {
sd_debug("found the VDI object %" PRIx64" epoch %"PRIu32
" at %s", oid, epoch, wd);
- ret = init_vdi_state(oid, wd, epoch);
- if (ret != SD_RES_SUCCESS)
- return ret;
+ atomic_set_bit(oid_to_vid(oid), sys->vdi_inuse);
}
- return SD_RES_SUCCESS;
+ return ret;
}

int default_init(void)
--
1.8.3.1


Liu Yuan

unread,
Jun 6, 2017, 10:38:37 PM6/6/17
to Meng Lingkun, sheep...@googlegroups.com, Menglingkun
On Wed, Apr 26, 2017 at 05:48:13PM +0800, Meng Lingkun wrote:
> From: Menglingkun <mengl...@cmss.chinamobile.com>
>
> Set sys->vdi_inuse bit is enough. When do the rolling-update(commit:802f915),
> reading all the large amount of inodes will slow the startup process to
> exceed the siesson timeout between sheep and zookeeper.
>

Applied, thanks.

Yuan
Reply all
Reply to author
Forward
0 new messages