diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-10-08 11:27:10 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-10-08 15:11:49 -0400 |
commit | a791e35e12ff672e8a0e140abeeaf900c3b2ea77 (patch) | |
tree | f03b99451619c0425f3c93fbef3940c2b08c1bd3 /fs/btrfs/extent_io.c | |
parent | 1cdda9b81ac0e6ee986f034fa02f221679e1c11a (diff) |
Btrfs: cleanup extent_clear_unlock_delalloc flags
extent_clear_unlock_delalloc has a growing set of ugly parameters
that is very difficult to read and maintain.
This switches to a flag field and well named flag defines.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index de1793ba004a..f9708bd01669 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1401,12 +1401,7 @@ out_failed: | |||
1401 | int extent_clear_unlock_delalloc(struct inode *inode, | 1401 | int extent_clear_unlock_delalloc(struct inode *inode, |
1402 | struct extent_io_tree *tree, | 1402 | struct extent_io_tree *tree, |
1403 | u64 start, u64 end, struct page *locked_page, | 1403 | u64 start, u64 end, struct page *locked_page, |
1404 | int unlock_pages, | 1404 | unsigned long op) |
1405 | int clear_unlock, | ||
1406 | int clear_delalloc, int clear_dirty, | ||
1407 | int set_writeback, | ||
1408 | int end_writeback, | ||
1409 | int set_private2) | ||
1410 | { | 1405 | { |
1411 | int ret; | 1406 | int ret; |
1412 | struct page *pages[16]; | 1407 | struct page *pages[16]; |
@@ -1416,17 +1411,17 @@ int extent_clear_unlock_delalloc(struct inode *inode, | |||
1416 | int i; | 1411 | int i; |
1417 | int clear_bits = 0; | 1412 | int clear_bits = 0; |
1418 | 1413 | ||
1419 | if (clear_unlock) | 1414 | if (op & EXTENT_CLEAR_UNLOCK) |
1420 | clear_bits |= EXTENT_LOCKED; | 1415 | clear_bits |= EXTENT_LOCKED; |
1421 | if (clear_dirty) | 1416 | if (op & EXTENT_CLEAR_DIRTY) |
1422 | clear_bits |= EXTENT_DIRTY; | 1417 | clear_bits |= EXTENT_DIRTY; |
1423 | 1418 | ||
1424 | if (clear_delalloc) | 1419 | if (op & EXTENT_CLEAR_DELALLOC) |
1425 | clear_bits |= EXTENT_DELALLOC; | 1420 | clear_bits |= EXTENT_DELALLOC; |
1426 | 1421 | ||
1427 | clear_extent_bit(tree, start, end, clear_bits, 1, 0, NULL, GFP_NOFS); | 1422 | clear_extent_bit(tree, start, end, clear_bits, 1, 0, NULL, GFP_NOFS); |
1428 | if (!(unlock_pages || clear_dirty || set_writeback || end_writeback || | 1423 | if (!(op & (EXTENT_CLEAR_UNLOCK_PAGE | EXTENT_CLEAR_DIRTY | EXTENT_SET_WRITEBACK | |
1429 | set_private2)) | 1424 | EXTENT_END_WRITEBACK | EXTENT_SET_PRIVATE2))) |
1430 | return 0; | 1425 | return 0; |
1431 | 1426 | ||
1432 | while (nr_pages > 0) { | 1427 | while (nr_pages > 0) { |
@@ -1435,20 +1430,20 @@ int extent_clear_unlock_delalloc(struct inode *inode, | |||
1435 | nr_pages, ARRAY_SIZE(pages)), pages); | 1430 | nr_pages, ARRAY_SIZE(pages)), pages); |
1436 | for (i = 0; i < ret; i++) { | 1431 | for (i = 0; i < ret; i++) { |
1437 | 1432 | ||
1438 | if (set_private2) | 1433 | if (op & EXTENT_SET_PRIVATE2) |
1439 | SetPagePrivate2(pages[i]); | 1434 | SetPagePrivate2(pages[i]); |
1440 | 1435 | ||
1441 | if (pages[i] == locked_page) { | 1436 | if (pages[i] == locked_page) { |
1442 | page_cache_release(pages[i]); | 1437 | page_cache_release(pages[i]); |
1443 | continue; | 1438 | continue; |
1444 | } | 1439 | } |
1445 | if (clear_dirty) | 1440 | if (op & EXTENT_CLEAR_DIRTY) |
1446 | clear_page_dirty_for_io(pages[i]); | 1441 | clear_page_dirty_for_io(pages[i]); |
1447 | if (set_writeback) | 1442 | if (op & EXTENT_SET_WRITEBACK) |
1448 | set_page_writeback(pages[i]); | 1443 | set_page_writeback(pages[i]); |
1449 | if (end_writeback) | 1444 | if (op & EXTENT_END_WRITEBACK) |
1450 | end_page_writeback(pages[i]); | 1445 | end_page_writeback(pages[i]); |
1451 | if (unlock_pages) | 1446 | if (op & EXTENT_CLEAR_UNLOCK_PAGE) |
1452 | unlock_page(pages[i]); | 1447 | unlock_page(pages[i]); |
1453 | page_cache_release(pages[i]); | 1448 | page_cache_release(pages[i]); |
1454 | } | 1449 | } |