diff options
| author | Vijaikumar M <vmallika@redhat.com> | 2014-05-05 12:43:26 +0530 |
|---|---|---|
| committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2014-05-08 22:24:27 -0700 |
| commit | 5dda1d4e00b8235656b7e4e8de35f599bf033148 (patch) | |
| tree | c414a4c4bf22ae61a672025ac01cb8c0812920d6 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
| parent | 065b91b4993f1ab0abc8b1db4d5745a6b58545b0 (diff) | |
glusterd/snapshot: Execute lvm snapshots in parallel
Back-end LVM Snapshot is executed parallely as synop task
This helps is gaining performance when there are more bricks in a
node.
This patch also removes unwanted logs printed in snapshot cleanup
Change-Id: I3174cb4547ebb670eca37a98eb9d75ecb0672a90
BUG: 1061685
Signed-off-by: Vijaikumar M <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/7461
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index dd4f84265db..1134d29dc5b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -6981,15 +6981,21 @@ glusterd_add_inode_size_to_dict (dict_t *dict, int count) } struct mntent * -glusterd_get_mnt_entry_info (char *mnt_pt, FILE *mtab) +glusterd_get_mnt_entry_info (char *mnt_pt, char *buff, int buflen, + struct mntent *entry_ptr) { - struct mntent *entry = NULL; + struct mntent *entry = NULL; + FILE *mtab = NULL; + + GF_ASSERT (mnt_pt); + GF_ASSERT (buff); + GF_ASSERT (entry_ptr); mtab = setmntent (_PATH_MOUNTED, "r"); if (!mtab) goto out; - entry = getmntent (mtab); + entry = getmntent_r (mtab, entry_ptr, buff, buflen); while (1) { if (!entry) @@ -6998,10 +7004,13 @@ glusterd_get_mnt_entry_info (char *mnt_pt, FILE *mtab) if (!strcmp (entry->mnt_dir, mnt_pt) && strcmp (entry->mnt_type, "rootfs")) break; - entry = getmntent (mtab); + entry = getmntent_r (mtab, entry_ptr, buff, buflen); } out: + if (NULL != mtab) { + endmntent (mtab); + } return entry; } @@ -7011,9 +7020,10 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo, { int ret = -1; char key[1024] = {0}; + char buff [PATH_MAX] = {0}; char base_key[1024] = {0}; + struct mntent save_entry = {0}; char *mnt_pt = NULL; - FILE *mtab = NULL; struct mntent *entry = NULL; snprintf (base_key, sizeof (base_key), "brick%d", count); @@ -7022,7 +7032,8 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo, if (ret) goto out; - entry = glusterd_get_mnt_entry_info (mnt_pt, mtab); + entry = glusterd_get_mnt_entry_info (mnt_pt, buff, sizeof (buff), + &save_entry); if (!entry) { ret = -1; goto out; @@ -7052,8 +7063,6 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo, out: GF_FREE (mnt_pt); - if (mtab) - endmntent (mtab); return ret; } @@ -7064,8 +7073,9 @@ glusterd_get_brick_mount_device (char *brick_path) int ret = -1; char *mnt_pt = NULL; char *device = NULL; - FILE *mtab = NULL; + char buff [PATH_MAX] = ""; struct mntent *entry = NULL; + struct mntent save_entry = {0,}; xlator_t *this = NULL; this = THIS; @@ -7079,7 +7089,8 @@ glusterd_get_brick_mount_device (char *brick_path) goto out; } - entry = glusterd_get_mnt_entry_info (mnt_pt, mtab); + entry = glusterd_get_mnt_entry_info (mnt_pt, buff, sizeof (buff), + &save_entry); if (NULL == entry) { gf_log (this->name, GF_LOG_ERROR, "Failed to get mnt entry " "for %s mount path", mnt_pt); @@ -7090,10 +7101,6 @@ glusterd_get_brick_mount_device (char *brick_path) device = gf_strdup (entry->mnt_fsname); out: - if (NULL != mtab) { - endmntent (mtab); - } - return device; } @@ -10362,7 +10369,8 @@ glusterd_merge_brick_status (dict_t *dst, dict_t *src) ret = dict_get_int64 (src, snapbrckcnt, &brick_count); if (ret) { gf_log (this->name, GF_LOG_TRACE, - "No bricks for this volume in this dict"); + "No bricks for this volume in this dict (%s)", + snapbrckcnt); continue; } @@ -10374,7 +10382,8 @@ glusterd_merge_brick_status (dict_t *dst, dict_t *src) ret = dict_get_int64 (src, snapbrckord, &brick_order); if (ret) { gf_log (this->name, GF_LOG_ERROR, - "Failed to get brick order"); + "Failed to get brick order (%s)", + snapbrckord); goto out; } @@ -10384,14 +10393,14 @@ glusterd_merge_brick_status (dict_t *dst, dict_t *src) ret = dict_get_int32 (src, key, &brick_online); if (ret) { gf_log (this->name, GF_LOG_ERROR, "failed to " - "get the brick status"); + "get the brick status (%s)", key); goto out; } ret = dict_set_int32 (dst, key, brick_online); if (ret) { gf_log (this->name, GF_LOG_ERROR, "failed to " - "set the brick status"); + "set the brick status (%s)", key); goto out; } brick_online = 0; |
