diff options
author | Denis Cheng <crquan@gmail.com> | 2007-10-17 02:26:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:47 -0400 |
commit | 0cbc591bf884a5662b2fbb21b5c09fa1c1c7b579 (patch) | |
tree | 23b5e92aaa2d8c74a4501d39275431b272341cac /drivers/block/nbd.c | |
parent | d2c9740b499f959ed513375b6e35c2ab161921cb (diff) |
nbd: change a parameter's type to remove a memcpy call
This memcpy looks so strange, in fact it's merely a pointer dereference, so I
change the parameter's type to refer it more directly, this could make the
memcpy not needed anymore.
In the function nbd_read_stat where nbd_find_request is only once called, the
parameter served should be transformed accordingly.
Signed-off-by: Denis Cheng <crquan@gmail.com>
Cc: Paul Clements <paul.clements@steeleye.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/nbd.c')
-rw-r--r-- | drivers/block/nbd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index d7a421579908..dc88bcf320e8 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -231,14 +231,12 @@ error_out: | |||
231 | return 1; | 231 | return 1; |
232 | } | 232 | } |
233 | 233 | ||
234 | static struct request *nbd_find_request(struct nbd_device *lo, char *handle) | 234 | static struct request *nbd_find_request(struct nbd_device *lo, |
235 | struct request *xreq) | ||
235 | { | 236 | { |
236 | struct request *req, *tmp; | 237 | struct request *req, *tmp; |
237 | struct request *xreq; | ||
238 | int err; | 238 | int err; |
239 | 239 | ||
240 | memcpy(&xreq, handle, sizeof(xreq)); | ||
241 | |||
242 | err = wait_event_interruptible(lo->active_wq, lo->active_req != xreq); | 240 | err = wait_event_interruptible(lo->active_wq, lo->active_req != xreq); |
243 | if (unlikely(err)) | 241 | if (unlikely(err)) |
244 | goto out; | 242 | goto out; |
@@ -293,7 +291,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
293 | goto harderror; | 291 | goto harderror; |
294 | } | 292 | } |
295 | 293 | ||
296 | req = nbd_find_request(lo, reply.handle); | 294 | req = nbd_find_request(lo, *(struct request **)reply.handle); |
297 | if (unlikely(IS_ERR(req))) { | 295 | if (unlikely(IS_ERR(req))) { |
298 | result = PTR_ERR(req); | 296 | result = PTR_ERR(req); |
299 | if (result != -ENOENT) | 297 | if (result != -ENOENT) |