1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Drop extra stat before open of device

Since the !(dev->flags & DEV_REGULAR) code path just called
dev_name_confirmed() which has just called 'stat()' inside,
remove duplicate second stat() call here.
This commit is contained in:
Zdenek Kabelac 2011-12-21 13:24:24 +00:00
parent 538d5e81a7
commit 5339307ca7
2 changed files with 1 additions and 11 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
Drop extra stat call before opening device.
Reduce number of lstat calls when selecting device alias.
Add function to inialize common structure device members.
Always zalloc device structure during initialization.

View File

@ -449,17 +449,6 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
else if (!(name = dev_name_confirmed(dev, quiet)))
return_0;
if (!(dev->flags & DEV_REGULAR)) {
if (stat(name, &buf) < 0) {
log_sys_error("%s: stat failed", name);
return 0;
}
if (buf.st_rdev != dev->dev) {
log_error("%s: device changed", name);
return 0;
}
}
#ifdef O_DIRECT_SUPPORT
if (direct) {
if (!(dev->flags & DEV_O_DIRECT_TESTED))