#include <linux/nbd.h>
 
+#define NBD_TIMEDOUT                   0
+#define NBD_DISCONNECT_REQUESTED       1
+
 struct nbd_device {
        u32 flags;
+       unsigned long runtime_flags;
        struct socket * sock;   /* If == NULL, device is not ready, yet */
        int magic;
 
        int blksize;
        loff_t bytesize;
        int xmit_timeout;
-       bool timedout;
-       bool disconnect; /* a disconnect has been requested by user */
 
        struct timer_list timeout_timer;
        /* protects initialization and shutdown of the socket */
 
        spin_lock_irqsave(&nbd->sock_lock, flags);
 
-       nbd->timedout = true;
+       set_bit(NBD_TIMEDOUT, &nbd->runtime_flags);
 
        if (nbd->sock) {
                sock = nbd->sock;
 /* Reset all properties of an NBD device */
 static void nbd_reset(struct nbd_device *nbd)
 {
-       nbd->disconnect = false;
-       nbd->timedout = false;
+       nbd->runtime_flags = 0;
        nbd->blksize = 1024;
        nbd->bytesize = 0;
        set_capacity(nbd->disk, 0);
                        return -EINVAL;
                }
 
-               nbd->disconnect = true;
+               set_bit(NBD_DISCONNECT_REQUESTED, &nbd->runtime_flags);
 
                nbd_send_cmd(nbd, blk_mq_rq_to_pdu(sreq));
                blk_mq_free_request(sreq);
                kill_bdev(bdev);
                nbd_bdev_reset(bdev);
 
-               if (nbd->disconnect) /* user requested, ignore socket errors */
+               /* user requested, ignore socket errors */
+               if (test_bit(NBD_DISCONNECT_REQUESTED, &nbd->runtime_flags))
                        error = 0;
-               if (nbd->timedout)
+               if (test_bit(NBD_TIMEDOUT, &nbd->runtime_flags))
                        error = -ETIMEDOUT;
 
                nbd_reset(nbd);