libbdev: be less noisy about clean driver restarts
Change-Id: Ie02a459c9b544d361ab00bac431ef99de53b0c5f
This commit is contained in:
parent
1760f1c717
commit
32c9b6653b
3 changed files with 29 additions and 3 deletions
|
@ -36,9 +36,17 @@ static int bdev_recover(dev_t dev, int update_endpt)
|
||||||
*/
|
*/
|
||||||
bdev_call_t *call, *next;
|
bdev_call_t *call, *next;
|
||||||
endpoint_t endpt;
|
endpoint_t endpt;
|
||||||
int r, nr_tries;
|
int r, active, nr_tries;
|
||||||
|
|
||||||
printf("bdev: recovering from a driver restart on major %d\n", major(dev));
|
/* Only print output if there is something to recover. Some drivers may be
|
||||||
|
* shut down and later restarted legitimately, and if they were not in use
|
||||||
|
* while that happened, there is no need to flood the console with messages.
|
||||||
|
*/
|
||||||
|
active = bdev_minor_is_open(dev) || bdev_call_iter_maj(dev, NULL, &next);
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
printf("bdev: recovering from a driver restart on major %d\n",
|
||||||
|
major(dev));
|
||||||
|
|
||||||
for (nr_tries = 0; nr_tries < RECOVER_TRIES; nr_tries++) {
|
for (nr_tries = 0; nr_tries < RECOVER_TRIES; nr_tries++) {
|
||||||
/* First update the endpoint, if necessary. */
|
/* First update the endpoint, if necessary. */
|
||||||
|
@ -79,7 +87,8 @@ static int bdev_recover(dev_t dev, int update_endpt)
|
||||||
/* Recovery seems successful. We can now reissue the current
|
/* Recovery seems successful. We can now reissue the current
|
||||||
* synchronous request (if any), and continue normal operation.
|
* synchronous request (if any), and continue normal operation.
|
||||||
*/
|
*/
|
||||||
printf("bdev: recovery successful, new driver is at %d\n", endpt);
|
if (active)
|
||||||
|
printf("bdev: recovery successful, new driver at %d\n", endpt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,3 +118,19 @@ void bdev_minor_del(dev_t dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bdev_minor_is_open(dev_t dev)
|
||||||
|
{
|
||||||
|
/* Return whether any minor is open for the major of the given device.
|
||||||
|
*/
|
||||||
|
int i, major;
|
||||||
|
|
||||||
|
major = major(dev);
|
||||||
|
|
||||||
|
for (i = 0; i < NR_OPEN_DEVS; i++) {
|
||||||
|
if (major(open_dev[i].dev) == major)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -29,5 +29,6 @@ extern int bdev_sendrec(dev_t dev, const message *m_orig);
|
||||||
extern int bdev_minor_reopen(dev_t dev);
|
extern int bdev_minor_reopen(dev_t dev);
|
||||||
extern void bdev_minor_add(dev_t dev, int access);
|
extern void bdev_minor_add(dev_t dev, int access);
|
||||||
extern void bdev_minor_del(dev_t dev);
|
extern void bdev_minor_del(dev_t dev);
|
||||||
|
extern int bdev_minor_is_open(dev_t dev);
|
||||||
|
|
||||||
#endif /* _BDEV_PROTO_H */
|
#endif /* _BDEV_PROTO_H */
|
||||||
|
|
Loading…
Reference in a new issue