diff options
author | Manuel Bentele | 2022-10-05 07:46:29 +0200 |
---|---|---|
committer | Manuel Bentele | 2022-10-05 07:46:29 +0200 |
commit | d6a81e580dbfea6d2c88833e8f98d249d865ee3b (patch) | |
tree | b857bfa6ca4839c1eec5e12176e30a8de331fd56 | |
parent | [SERVER] Don't establish uplink when loading image on startup (diff) | |
download | dnbd3-d6a81e580dbfea6d2c88833e8f98d249d865ee3b.tar.gz dnbd3-d6a81e580dbfea6d2c88833e8f98d249d865ee3b.tar.xz dnbd3-d6a81e580dbfea6d2c88833e8f98d249d865ee3b.zip |
Fix linter issues to satisfy Linux kernel code style
-rw-r--r-- | src/kernel/dnbd3_main.h | 6 | ||||
-rw-r--r-- | src/kernel/net.c | 13 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/kernel/dnbd3_main.h b/src/kernel/dnbd3_main.h index 6d91666..5fd56db 100644 --- a/src/kernel/dnbd3_main.h +++ b/src/kernel/dnbd3_main.h @@ -122,8 +122,10 @@ extern int dnbd3_rem_server(dnbd3_device_t *dev, dnbd3_host_t *host); #define dnbd3_flag_reset(x) atomic_set(&(x), 0) #define dnbd3_flag_taken(x) (atomic_read(&(x)) != 0) -/* shims for making older kernels look like the current one, if possible, to avoid too - * much inline #ifdef which makes code harder to read. */ +/* + * shims for making older kernels look like the current one, if possible, to avoid too + * much inline #ifdef which makes code harder to read. + */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) #define BLK_EH_DONE BLK_EH_NOT_HANDLED diff --git a/src/kernel/net.c b/src/kernel/net.c index 94a7ff0..8408954 100644 --- a/src/kernel/net.c +++ b/src/kernel/net.c @@ -271,9 +271,10 @@ static void dnbd3_internal_discover(dnbd3_device_t *dev) (unsigned long)ktime_us_delta(end, start); rtt = 0; - for (k = 0; k < DISCOVER_HISTORY_SIZE; ++k) { + + for (k = 0; k < DISCOVER_HISTORY_SIZE; ++k) rtt += dev->alt_servers[i].rtts[k]; - } + rtt /= DISCOVER_HISTORY_SIZE; dev->alt_servers[i].failures = 0; if (dev->alt_servers[i].best_count > 1) @@ -724,9 +725,9 @@ static bool dnbd3_execute_handshake(dnbd3_device_t *dev, struct socket *sock, if (payload == NULL) goto error; - if (copy_data && device_active(dev)) { + if (copy_data && device_active(dev)) dev_warn(dnbd3_device_to_dev(dev), "Called handshake function with copy_data enabled when reported_size is not zero\n"); - } + // Request filesize request_hdr.cmd = CMD_SELECT_IMAGE; iov[0].iov_base = &request_hdr; @@ -1084,9 +1085,9 @@ static int dnbd3_set_primary_connection(dnbd3_device_t *dev, struct socket *sock dev->discover_interval = TIMER_INTERVAL_PROBE_SWITCH; queue_work(dev->recv_wq, &dev->recv_work); spin_unlock_irqrestore(&dev->blk_lock, irqflags); - if (dev->use_server_provided_alts) { + + if (dev->use_server_provided_alts) dnbd3_send_empty_request(dev, CMD_GET_SERVERS); - } dnbd3_dev_dbg_host_cur(dev, "connection switched\n"); dnbd3_blk_requeue_all_requests(dev); |