[Debian-ha-commits] [ocfs2-tools] 04/58: scandisk: remove unnecessary scansysfs op
Valentin Vidic
vvidic-guest at moszumanska.debian.org
Tue Jun 20 13:40:40 UTC 2017
This is an automated email from the git hooks/post-receive script.
vvidic-guest pushed a commit to branch upstream
in repository ocfs2-tools.
commit f035b44aa495fb9b2f78243315346c342d8f579d
Author: Junxiao Bi <junxiao.bi at oracle.com>
Date: Wed Jun 22 13:01:06 2016 +0800
scandisk: remove unnecessary scansysfs op
For every block device in sysfs who is not a symbol link,
scansysfs() will run two times on it, run once is enough
and that can improve scandisk speed.
Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
Reviewed-by: Joseph Qi <joseph.qi at huawei.com>
---
libtools-internal/scandisk.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libtools-internal/scandisk.c b/libtools-internal/scandisk.c
index 2f5245e..fca7d34 100644
--- a/libtools-internal/scandisk.c
+++ b/libtools-internal/scandisk.c
@@ -709,15 +709,15 @@ static int scansysfs(struct devlisthead *devlisthead, const char *path, int leve
sysfs_is_disk(newpath);
}
- if (!stat(newpath, &sb) && !level)
+ if (!stat(newpath, &sb) && !level) {
if (S_ISDIR(sb.st_mode))
if (scansysfs(devlisthead, newpath, 1, has_holder) < 0)
return -1;
-
- if (!lstat(newpath, &sb))
+ } else if (!lstat(newpath, &sb)) {
if (S_ISDIR(sb.st_mode))
if (scansysfs(devlisthead, newpath, 1, has_holder) < 0)
return -1;
+ }
}
free(namelist[n]);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/ocfs2-tools.git
More information about the Debian-HA-Commits
mailing list