From e6c1470c91208857245ee8b4b75b52e76976a6b7 Mon Sep 17 00:00:00 2001 From: Jeff Schroeder Date: Tue, 20 Nov 2007 12:26:25 -0800 Subject: [PATCH 5/5] CodingStyle remove trailing whitespace --- dm-ddsnap.c | 80 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 40 insertions(+), 40 deletions(-) diff --git a/dm-ddsnap.c b/dm-ddsnap.c index 9ab517d..8c00f32 100644 --- a/dm-ddsnap.c +++ b/dm-ddsnap.c @@ -297,9 +297,9 @@ static void ddsnap_stats_display(struct ddsnap_pending_stats *statp, unsigned to printk(KERN_INFO "(%u)\n", total); if (!total) return; - printk(KERN_INFO "pending time max:min:avg "); - printk(KERN_INFO "%u ", jiffies_to_msecs(statp->max_time)); - printk(KERN_INFO "%u ", jiffies_to_msecs(statp->min_time)); + printk(KERN_INFO "pending time max:min:avg "); + printk(KERN_INFO "%u ", jiffies_to_msecs(statp->max_time)) + printk(KERN_INFO "%u ", jiffies_to_msecs(statp->min_time)) printk(KERN_INFO "%u\n", jiffies_to_msecs(statp->avg_time) / total); } @@ -422,7 +422,7 @@ int replied_rw(struct dm_target *target, struct rw_request *body, unsigned lengt trace(warn("id = %u, %u ranges, %s %s", body->id, body->count, rw == READ? "read from": "write to", snap? "snapshot": "origin");) } - + for (i = 0; i < body->count; i++) { // !!! check for length overrun unsigned chunks = p->chunks, id = body->id; struct list_head *list, *bucket = info->pending + hash_pending(id); @@ -531,7 +531,7 @@ found: * patterns to the origin. We just have to grin and deal with it. So * without further ado, here is how the various reply flavors * - * - Origin write replies just have logical ranges, since origin physical + * - Origin write replies just have logical ranges, since origin physical * address is the same as logical. * * - Snapshot read replies come back in two separate messages, one for @@ -604,7 +604,7 @@ connect: trace(warn("%x/%u", message.head.code, length);) if ((err = readpipe(sock, &message.body, length))) goto socket_error; - + switch (message.head.code) { case ORIGIN_WRITE_ERROR: warn("Origin write failure"); @@ -615,7 +615,7 @@ connect: break; case SNAPSHOT_WRITE_ERROR: - warn("Snapshot %u write failure", info->snap); + warn("Snapshot %u write failure", info->snap); failed_io = 1; case SNAPSHOT_WRITE_OK: rw = WRITE; @@ -623,7 +623,7 @@ connect: break; case SNAPSHOT_READ_ORIGIN_ERROR: - warn("Snapshot %u read from origin failure", info->snap); + warn("Snapshot %u read from origin failure", info->snap); failed_io = 1; case SNAPSHOT_READ_ORIGIN_OK: rw = READ; @@ -631,11 +631,11 @@ connect: break; case SNAPSHOT_READ_ERROR: - warn("Snapshot %u read failure", info->snap); + warn("Snapshot %u read failure", info->snap); failed_io = 1; case SNAPSHOT_READ_OK: rw = READ; - to_snap = 1; + to_snap = 1; break; case IDENTIFY_OK: @@ -654,42 +654,42 @@ connect: warn("unable to send CONNECT_SERVER_OK message to agent"); up(&info->identify_sem); continue; - + case IDENTIFY_ERROR: - err = ((struct identify_error *)message.body)->err; + err = ((struct identify_error *)message.body)->err; err_msg = ((struct identify_error *)message.body)->msg; length -= sizeof(err); err_msg[length - 1] = '\0'; - warn("unable to identify snapshot device with id %d, error: %s", + warn("unable to identify snapshot device with id %d, error: %s", info->snap, err_msg); message.head.code = CONNECT_SERVER_ERROR; message.head.length = length + sizeof(err); if (writepipe(info->control_socket, &message.head, sizeof(message.head)) < 0) warn("can't send msg head"); - if (writepipe(info->control_socket, &err, sizeof(err)) < 0) + if (writepipe(info->control_socket, &err, sizeof(err)) < 0) warn("can't send out err"); if (writepipe(info->control_socket, err_msg, length) < 0) warn("unable to send message CONNECT_SERVER_ERROR to agent"); up(&info->identify_sem); continue; - + case PROTOCOL_ERROR: // !!! FIXME with a nice error message warn("caught a protocol error message"); continue; - - default: + + default: { - struct protocol_error pe = { .err = ERROR_UNKNOWN_MESSAGE, + struct protocol_error pe = { .err = ERROR_UNKNOWN_MESSAGE, .culprit = message.head.code }; - err_msg = "Unknown message accepted by client kernel thread"; + err_msg = "Unknown message accepted by client kernel thread"; warn("Unknown message %x, length %u. sending protocol error back to server", message.head.code, message.head.length); message.head.code = PROTOCOL_ERROR; message.head.length = sizeof(struct protocol_error) + strlen(err_msg) + 1; - if (writepipe(sock, &message.head, sizeof(message.head)) < 0 || + if (writepipe(sock, &message.head, sizeof(message.head)) < 0 || writepipe(sock, &pe, sizeof(struct protocol_error)) < 0 || writepipe(sock, err_msg, strlen(err_msg) + 1) < 0) warn("unable to send protocol error message"); @@ -845,7 +845,7 @@ restart: while (!list_empty(&info->queries) && worker_ready(info)) { struct list_head *entry = info->queries.prev; struct pending *pending = list_entry(entry, struct pending, list); - /* Only refer a pending request when we hold pending_lock to + /* Only refer a pending request when we hold pending_lock to * protect against the race in flush_pending_bio */ u64 chunk = pending->chunk; unsigned chunks = pending->chunks; @@ -927,8 +927,8 @@ recover: /* * To handle agent failure, we just turn off our ddsnap "ready" flag and - * fail all queued IOs. The second part is quite a mess because IO can be - * queued in different places in the driver. Sigh. We will just try to + * fail all queued IOs. The second part is quite a mess because IO can be + * queued in different places in the driver. Sigh. We will just try to * do this tidiest job we can on this messy feature. In general, wherever * a bio can wait on a synchronizer before further processing, we need to * unblock the synchronizer (e.g., up the semaphore or ->shutdow a socket) @@ -1021,7 +1021,7 @@ static int control(struct dm_target *target) trace(warn("%x/%u", message.head.code, length);) if ((err = readpipe(sock, &message.body, length))) goto socket_error; - + switch (message.head.code) { case SET_IDENTITY: info->id = ((struct set_id *)message.body)->id; @@ -1049,8 +1049,8 @@ static int control(struct dm_target *target) current->files->fd_array[sock_fd] = NULL; // should we grab file_lock? put_unused_fd(sock_fd); up(&info->server_in_sem); - if (outbead(info->sock, IDENTIFY, struct identify, - .id = info->id, .snap = info->snap, + if (outbead(info->sock, IDENTIFY, struct identify, + .id = info->id, .snap = info->snap, .off = target->begin, .len = target->len) < 0) { warn("unable to send IDENTIFY message"); goto out; @@ -1059,25 +1059,25 @@ static int control(struct dm_target *target) break; } case PROTOCOL_ERROR: - // !!! FIXME: add a new + // !!! FIXME: add a new warn("caught a protocol error message"); - break; - default: + break; + default: { - struct protocol_error pe = { .err = ERROR_UNKNOWN_MESSAGE, + struct protocol_error pe = { .err = ERROR_UNKNOWN_MESSAGE, .culprit = message.head.code }; - err_msg = "Unknown message accepted by control kernel thread"; + err_msg = "Unknown message accepted by control kernel thread"; warn("Unknown message %x, length %u. sending protocol error back to server", message.head.code, message.head.length); message.head.code = PROTOCOL_ERROR; message.head.length = sizeof(struct protocol_error) + strlen(err_msg) + 1; - if (writepipe(sock, &message.head, sizeof(message.head)) < 0 || + if (writepipe(sock, &message.head, sizeof(message.head)) < 0 || writepipe(sock, &pe, sizeof(struct protocol_error)) < 0 || writepipe(sock, err_msg, strlen(err_msg) + 1) < 0) warn("unable to send protocol error message"); continue; } - + } // switch statement } out: @@ -1129,7 +1129,7 @@ static int ddsnap_map(struct dm_target *target, struct bio *bio, union map_info warn("snapshot device with id %d is not ready", info->snap); return -EIO; } - + bio->bi_bdev = info->orgdev->bdev; if (bio_data_dir(bio) == READ && !is_snapshot(info)) return 1; @@ -1141,7 +1141,7 @@ static int ddsnap_map(struct dm_target *target, struct bio *bio, union map_info if (is_snapshot(info)) { // !!! use page cache for both struct page *page; u64 *exception = snap_map_cachep(info->inode->i_mapping, chunk, &page); - + if (!exception) { printk(KERN_ERR "Failed to get a page for sector %ld\n", bio->bi_sector); return -1; @@ -1349,7 +1349,7 @@ static void ddsnap_destroy(struct dm_target *target) up(&info->server_in_sem); // unblock incoming thread up(&info->server_out_sem); // unblock io request threads up(&info->recover_sem); // unblock worker recovery - + warn("closing socket connections"); if (info->sock && (err = shutdown_socket(info->sock))) warn("server socket shutdown error %i", err); @@ -1388,7 +1388,7 @@ static void ddsnap_destroy(struct dm_target *target) dm_put_device(target, info->snapdev); if (info->orgdev) dm_put_device(target, info->orgdev); - snprintf(proc_name, 8, "%d", info->snap); + snprintf(proc_name, 8, "%d", info->snap); ddsnap_remove_proc(proc_name); kfree(info); } @@ -1438,7 +1438,7 @@ static int ddsnap_create(struct dm_target *target, unsigned argc, char **argv) #ifdef CACHE unsigned bm_size; #endif - /* + /* * We are holding the big kernel lock grabbed in do_ioctl * We doubt if BKL is required to prevent any races in device mapper methods * FIXME: get rid of BKL from device mapper ioctls @@ -1459,7 +1459,7 @@ static int ddsnap_create(struct dm_target *target, unsigned argc, char **argv) if (!(info = kmalloc(sizeof(struct devinfo), GFP_NOIO|__GFP_NOFAIL))) goto eek; - *info = (struct devinfo){ + *info = (struct devinfo){ .flags = flags, .snap = snap, .chunksize_bits = chunksize_bits, .chunkshift = chunksize_bits - SECTOR_SHIFT}; @@ -1483,7 +1483,7 @@ static int ddsnap_create(struct dm_target *target, unsigned argc, char **argv) error = "Can't get snapshot device"; if ((err = dm_get_device(target, argv[0], 0, 0, dm_table_get_mode(target->table), &info->snapdev))) goto eek; - + error = "Can't get origin device"; if ((err = dm_get_device(target, argv[1], 0, 0, dm_table_get_mode(target->table), &info->orgdev))) goto eek; -- 1.5.2.5