mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Simplify issig().
We always call it twice with JUSTLOOKING and then FORREAL. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net> Closes #16225
This commit is contained in:
parent
6b95031f56
commit
01c8efdd59
@ -39,20 +39,14 @@
|
|||||||
#include <sys/signalvar.h>
|
#include <sys/signalvar.h>
|
||||||
#include <sys/debug.h>
|
#include <sys/debug.h>
|
||||||
|
|
||||||
#define FORREAL 0
|
|
||||||
#define JUSTLOOKING 1
|
|
||||||
|
|
||||||
static __inline int
|
static __inline int
|
||||||
issig(int why)
|
issig(void)
|
||||||
{
|
{
|
||||||
struct thread *td = curthread;
|
struct thread *td = curthread;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
int sig;
|
int sig;
|
||||||
|
|
||||||
ASSERT(why == FORREAL || why == JUSTLOOKING);
|
|
||||||
if (SIGPENDING(td)) {
|
if (SIGPENDING(td)) {
|
||||||
if (why == JUSTLOOKING)
|
|
||||||
return (1);
|
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
mtx_lock(&p->p_sigacts->ps_mtx);
|
mtx_lock(&p->p_sigacts->ps_mtx);
|
||||||
|
@ -30,9 +30,6 @@
|
|||||||
#include <linux/sched/signal.h>
|
#include <linux/sched/signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FORREAL 0 /* Usual side-effects */
|
extern int issig(void);
|
||||||
#define JUSTLOOKING 1 /* Don't stop the process */
|
|
||||||
|
|
||||||
extern int issig(int why);
|
|
||||||
|
|
||||||
#endif /* SPL_SIGNAL_H */
|
#endif /* SPL_SIGNAL_H */
|
||||||
|
@ -249,8 +249,7 @@ extern struct proc p0;
|
|||||||
extern kthread_t *zk_thread_create(const char *name, void (*func)(void *),
|
extern kthread_t *zk_thread_create(const char *name, void (*func)(void *),
|
||||||
void *arg, size_t stksize, int state);
|
void *arg, size_t stksize, int state);
|
||||||
|
|
||||||
#define issig(why) (FALSE)
|
#define issig() (FALSE)
|
||||||
#define ISSIG(thr, why) (FALSE)
|
|
||||||
|
|
||||||
#define KPREEMPT_SYNC (-1)
|
#define KPREEMPT_SYNC (-1)
|
||||||
|
|
||||||
|
@ -152,26 +152,16 @@ spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...)
|
|||||||
EXPORT_SYMBOL(spl_kthread_create);
|
EXPORT_SYMBOL(spl_kthread_create);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The "why" argument indicates the allowable side-effects of the call:
|
* Extract the next pending signal from p_sig into p_cursig; stop the process
|
||||||
*
|
* if a stop has been requested or if a traced signal is pending.
|
||||||
* FORREAL: Extract the next pending signal from p_sig into p_cursig;
|
|
||||||
* stop the process if a stop has been requested or if a traced signal
|
|
||||||
* is pending.
|
|
||||||
*
|
|
||||||
* JUSTLOOKING: Don't stop the process, just indicate whether or not
|
|
||||||
* a signal might be pending (FORREAL is needed to tell for sure).
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
issig(int why)
|
issig(void)
|
||||||
{
|
{
|
||||||
ASSERT(why == FORREAL || why == JUSTLOOKING);
|
|
||||||
|
|
||||||
if (!signal_pending(current))
|
if (!signal_pending(current))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
if (why != FORREAL)
|
|
||||||
return (1);
|
|
||||||
|
|
||||||
struct task_struct *task = current;
|
struct task_struct *task = current;
|
||||||
spl_kernel_siginfo_t __info;
|
spl_kernel_siginfo_t __info;
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
|
@ -116,7 +116,7 @@ diff_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
|||||||
dmu_diffarg_t *da = arg;
|
dmu_diffarg_t *da = arg;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (issig(JUSTLOOKING) && issig(FORREAL))
|
if (issig())
|
||||||
return (SET_ERROR(EINTR));
|
return (SET_ERROR(EINTR));
|
||||||
|
|
||||||
if (zb->zb_level == ZB_DNODE_LEVEL ||
|
if (zb->zb_level == ZB_DNODE_LEVEL ||
|
||||||
|
@ -2437,7 +2437,7 @@ dmu_objset_space_upgrade(objset_t *os)
|
|||||||
if (err != 0)
|
if (err != 0)
|
||||||
return (err);
|
return (err);
|
||||||
|
|
||||||
if (issig(JUSTLOOKING) && issig(FORREAL))
|
if (issig())
|
||||||
return (SET_ERROR(EINTR));
|
return (SET_ERROR(EINTR));
|
||||||
|
|
||||||
objerr = dmu_bonus_hold(os, obj, FTAG, &db);
|
objerr = dmu_bonus_hold(os, obj, FTAG, &db);
|
||||||
|
@ -3389,7 +3389,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, offset_t *voffp)
|
|||||||
* stream, then we free drc->drc_rrd and exit.
|
* stream, then we free drc->drc_rrd and exit.
|
||||||
*/
|
*/
|
||||||
while (rwa->err == 0) {
|
while (rwa->err == 0) {
|
||||||
if (issig(JUSTLOOKING) && issig(FORREAL)) {
|
if (issig()) {
|
||||||
err = SET_ERROR(EINTR);
|
err = SET_ERROR(EINTR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -912,7 +912,7 @@ perform_redaction(objset_t *os, redaction_list_t *rl,
|
|||||||
object = prev_obj;
|
object = prev_obj;
|
||||||
}
|
}
|
||||||
while (err == 0 && object <= rec->end_object) {
|
while (err == 0 && object <= rec->end_object) {
|
||||||
if (issig(JUSTLOOKING) && issig(FORREAL)) {
|
if (issig()) {
|
||||||
err = EINTR;
|
err = EINTR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2552,7 +2552,7 @@ dmu_send_impl(struct dmu_send_params *dspp)
|
|||||||
while (err == 0 && !range->eos_marker) {
|
while (err == 0 && !range->eos_marker) {
|
||||||
err = do_dump(&dsc, range);
|
err = do_dump(&dsc, range);
|
||||||
range = get_next_range(&srt_arg->q, range);
|
range = get_next_range(&srt_arg->q, range);
|
||||||
if (issig(JUSTLOOKING) && issig(FORREAL))
|
if (issig())
|
||||||
err = SET_ERROR(EINTR);
|
err = SET_ERROR(EINTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,8 +780,7 @@ zcp_lua_counthook(lua_State *state, lua_Debug *ar)
|
|||||||
* Check if we were canceled while waiting for the
|
* Check if we were canceled while waiting for the
|
||||||
* txg to sync or from our open context thread
|
* txg to sync or from our open context thread
|
||||||
*/
|
*/
|
||||||
if (ri->zri_canceled ||
|
if (ri->zri_canceled || (!ri->zri_sync && issig())) {
|
||||||
(!ri->zri_sync && issig(JUSTLOOKING) && issig(FORREAL))) {
|
|
||||||
ri->zri_canceled = B_TRUE;
|
ri->zri_canceled = B_TRUE;
|
||||||
(void) lua_pushstring(state, "Channel program was canceled.");
|
(void) lua_pushstring(state, "Channel program was canceled.");
|
||||||
(void) lua_error(state);
|
(void) lua_error(state);
|
||||||
|
@ -2336,7 +2336,7 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (error == 0) {
|
while (error == 0) {
|
||||||
if (issig(JUSTLOOKING) && issig(FORREAL)) {
|
if (issig()) {
|
||||||
error = SET_ERROR(EINTR);
|
error = SET_ERROR(EINTR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1413,7 +1413,7 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
|
|||||||
len -= size;
|
len -= size;
|
||||||
done += size;
|
done += size;
|
||||||
|
|
||||||
if (issig(JUSTLOOKING) && issig(FORREAL)) {
|
if (issig()) {
|
||||||
error = SET_ERROR(EINTR);
|
error = SET_ERROR(EINTR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user