diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-01-05 21:25:51 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-01-05 21:25:51 -0500 |
commit | d397712bcc6a759a560fd247e6053ecae091f958 (patch) | |
tree | 9da8daebb870d8b8b1843507c4621715e23dd31a /fs/btrfs/zlib.c | |
parent | 1f3c79a28c8837e8572b98f6d14142d9a6133c56 (diff) |
Btrfs: Fix checkpatch.pl warnings
There were many, most are fixed now. struct-funcs.c generates some warnings
but these are bogus.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/zlib.c')
-rw-r--r-- | fs/btrfs/zlib.c | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index c4617cde6c73..ecfbce836d32 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c | |||
@@ -152,7 +152,7 @@ static int free_workspace(struct workspace *workspace) | |||
152 | static void free_workspaces(void) | 152 | static void free_workspaces(void) |
153 | { | 153 | { |
154 | struct workspace *workspace; | 154 | struct workspace *workspace; |
155 | while(!list_empty(&idle_workspace)) { | 155 | while (!list_empty(&idle_workspace)) { |
156 | workspace = list_entry(idle_workspace.next, struct workspace, | 156 | workspace = list_entry(idle_workspace.next, struct workspace, |
157 | list); | 157 | list); |
158 | list_del(&workspace->list); | 158 | list_del(&workspace->list); |
@@ -397,12 +397,10 @@ int btrfs_zlib_decompress_biovec(struct page **pages_in, | |||
397 | ret = -1; | 397 | ret = -1; |
398 | goto out; | 398 | goto out; |
399 | } | 399 | } |
400 | while(workspace->inf_strm.total_in < srclen) { | 400 | while (workspace->inf_strm.total_in < srclen) { |
401 | ret = zlib_inflate(&workspace->inf_strm, Z_NO_FLUSH); | 401 | ret = zlib_inflate(&workspace->inf_strm, Z_NO_FLUSH); |
402 | if (ret != Z_OK && ret != Z_STREAM_END) { | 402 | if (ret != Z_OK && ret != Z_STREAM_END) |
403 | break; | 403 | break; |
404 | } | ||
405 | |||
406 | /* | 404 | /* |
407 | * buf start is the byte offset we're of the start of | 405 | * buf start is the byte offset we're of the start of |
408 | * our workspace buffer | 406 | * our workspace buffer |
@@ -424,16 +422,14 @@ int btrfs_zlib_decompress_biovec(struct page **pages_in, | |||
424 | /* we didn't make progress in this inflate | 422 | /* we didn't make progress in this inflate |
425 | * call, we're done | 423 | * call, we're done |
426 | */ | 424 | */ |
427 | if (ret != Z_STREAM_END) { | 425 | if (ret != Z_STREAM_END) |
428 | ret = -1; | 426 | ret = -1; |
429 | } | ||
430 | break; | 427 | break; |
431 | } | 428 | } |
432 | 429 | ||
433 | /* we haven't yet hit data corresponding to this page */ | 430 | /* we haven't yet hit data corresponding to this page */ |
434 | if (total_out <= start_byte) { | 431 | if (total_out <= start_byte) |
435 | goto next; | 432 | goto next; |
436 | } | ||
437 | 433 | ||
438 | /* | 434 | /* |
439 | * the start of the data we care about is offset into | 435 | * the start of the data we care about is offset into |
@@ -448,7 +444,7 @@ int btrfs_zlib_decompress_biovec(struct page **pages_in, | |||
448 | current_buf_start = buf_start; | 444 | current_buf_start = buf_start; |
449 | 445 | ||
450 | /* copy bytes from the working buffer into the pages */ | 446 | /* copy bytes from the working buffer into the pages */ |
451 | while(working_bytes > 0) { | 447 | while (working_bytes > 0) { |
452 | bytes = min(PAGE_CACHE_SIZE - pg_offset, | 448 | bytes = min(PAGE_CACHE_SIZE - pg_offset, |
453 | PAGE_CACHE_SIZE - buf_offset); | 449 | PAGE_CACHE_SIZE - buf_offset); |
454 | bytes = min(bytes, working_bytes); | 450 | bytes = min(bytes, working_bytes); |
@@ -471,6 +467,7 @@ int btrfs_zlib_decompress_biovec(struct page **pages_in, | |||
471 | ret = 0; | 467 | ret = 0; |
472 | goto done; | 468 | goto done; |
473 | } | 469 | } |
470 | |||
474 | page_out = bvec[page_out_index].bv_page; | 471 | page_out = bvec[page_out_index].bv_page; |
475 | pg_offset = 0; | 472 | pg_offset = 0; |
476 | page_bytes_left = PAGE_CACHE_SIZE; | 473 | page_bytes_left = PAGE_CACHE_SIZE; |
@@ -480,9 +477,8 @@ int btrfs_zlib_decompress_biovec(struct page **pages_in, | |||
480 | * make sure our new page is covered by this | 477 | * make sure our new page is covered by this |
481 | * working buffer | 478 | * working buffer |
482 | */ | 479 | */ |
483 | if (total_out <= start_byte) { | 480 | if (total_out <= start_byte) |
484 | goto next; | 481 | goto next; |
485 | } | ||
486 | 482 | ||
487 | /* the next page in the biovec might not | 483 | /* the next page in the biovec might not |
488 | * be adjacent to the last page, but it | 484 | * be adjacent to the last page, but it |
@@ -517,11 +513,10 @@ next: | |||
517 | PAGE_CACHE_SIZE); | 513 | PAGE_CACHE_SIZE); |
518 | } | 514 | } |
519 | } | 515 | } |
520 | if (ret != Z_STREAM_END) { | 516 | if (ret != Z_STREAM_END) |
521 | ret = -1; | 517 | ret = -1; |
522 | } else { | 518 | else |
523 | ret = 0; | 519 | ret = 0; |
524 | } | ||
525 | done: | 520 | done: |
526 | zlib_inflateEnd(&workspace->inf_strm); | 521 | zlib_inflateEnd(&workspace->inf_strm); |
527 | if (data_in) | 522 | if (data_in) |
@@ -579,16 +574,15 @@ int btrfs_zlib_decompress(unsigned char *data_in, | |||
579 | goto out; | 574 | goto out; |
580 | } | 575 | } |
581 | 576 | ||
582 | while(bytes_left > 0) { | 577 | while (bytes_left > 0) { |
583 | unsigned long buf_start; | 578 | unsigned long buf_start; |
584 | unsigned long buf_offset; | 579 | unsigned long buf_offset; |
585 | unsigned long bytes; | 580 | unsigned long bytes; |
586 | unsigned long pg_offset = 0; | 581 | unsigned long pg_offset = 0; |
587 | 582 | ||
588 | ret = zlib_inflate(&workspace->inf_strm, Z_NO_FLUSH); | 583 | ret = zlib_inflate(&workspace->inf_strm, Z_NO_FLUSH); |
589 | if (ret != Z_OK && ret != Z_STREAM_END) { | 584 | if (ret != Z_OK && ret != Z_STREAM_END) |
590 | break; | 585 | break; |
591 | } | ||
592 | 586 | ||
593 | buf_start = total_out; | 587 | buf_start = total_out; |
594 | total_out = workspace->inf_strm.total_out; | 588 | total_out = workspace->inf_strm.total_out; |
@@ -598,15 +592,13 @@ int btrfs_zlib_decompress(unsigned char *data_in, | |||
598 | break; | 592 | break; |
599 | } | 593 | } |
600 | 594 | ||
601 | if (total_out <= start_byte) { | 595 | if (total_out <= start_byte) |
602 | goto next; | 596 | goto next; |
603 | } | ||
604 | 597 | ||
605 | if (total_out > start_byte && buf_start < start_byte) { | 598 | if (total_out > start_byte && buf_start < start_byte) |
606 | buf_offset = start_byte - buf_start; | 599 | buf_offset = start_byte - buf_start; |
607 | } else { | 600 | else |
608 | buf_offset = 0; | 601 | buf_offset = 0; |
609 | } | ||
610 | 602 | ||
611 | bytes = min(PAGE_CACHE_SIZE - pg_offset, | 603 | bytes = min(PAGE_CACHE_SIZE - pg_offset, |
612 | PAGE_CACHE_SIZE - buf_offset); | 604 | PAGE_CACHE_SIZE - buf_offset); |
@@ -622,11 +614,12 @@ next: | |||
622 | workspace->inf_strm.next_out = workspace->buf; | 614 | workspace->inf_strm.next_out = workspace->buf; |
623 | workspace->inf_strm.avail_out = PAGE_CACHE_SIZE; | 615 | workspace->inf_strm.avail_out = PAGE_CACHE_SIZE; |
624 | } | 616 | } |
625 | if (ret != Z_STREAM_END && bytes_left != 0) { | 617 | |
618 | if (ret != Z_STREAM_END && bytes_left != 0) | ||
626 | ret = -1; | 619 | ret = -1; |
627 | } else { | 620 | else |
628 | ret = 0; | 621 | ret = 0; |
629 | } | 622 | |
630 | zlib_inflateEnd(&workspace->inf_strm); | 623 | zlib_inflateEnd(&workspace->inf_strm); |
631 | out: | 624 | out: |
632 | free_workspace(workspace); | 625 | free_workspace(workspace); |