diff options
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r-- | fs/gfs2/ops_address.c | 66 |
1 files changed, 6 insertions, 60 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 01aa4a9b48c3..3fd8c6ec256c 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -96,59 +96,6 @@ static int get_block_noalloc(struct inode *inode, sector_t lblock, | |||
96 | return error; | 96 | return error; |
97 | } | 97 | } |
98 | 98 | ||
99 | static int get_blocks(struct inode *inode, sector_t lblock, | ||
100 | unsigned long max_blocks, struct buffer_head *bh_result, | ||
101 | int create) | ||
102 | { | ||
103 | struct gfs2_inode *ip = inode->u.generic_ip; | ||
104 | int new = create; | ||
105 | uint64_t dblock; | ||
106 | uint32_t extlen; | ||
107 | int error; | ||
108 | |||
109 | error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen); | ||
110 | if (error) | ||
111 | return error; | ||
112 | |||
113 | if (!dblock) | ||
114 | return 0; | ||
115 | |||
116 | map_bh(bh_result, inode->i_sb, dblock); | ||
117 | if (new) | ||
118 | set_buffer_new(bh_result); | ||
119 | |||
120 | if (extlen > max_blocks) | ||
121 | extlen = max_blocks; | ||
122 | bh_result->b_size = extlen << inode->i_blkbits; | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static int get_blocks_noalloc(struct inode *inode, sector_t lblock, | ||
128 | unsigned long max_blocks, | ||
129 | struct buffer_head *bh_result, int create) | ||
130 | { | ||
131 | struct gfs2_inode *ip = inode->u.generic_ip; | ||
132 | int new = 0; | ||
133 | uint64_t dblock; | ||
134 | uint32_t extlen; | ||
135 | int error; | ||
136 | |||
137 | error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen); | ||
138 | if (error) | ||
139 | return error; | ||
140 | |||
141 | if (dblock) { | ||
142 | map_bh(bh_result, inode->i_sb, dblock); | ||
143 | if (extlen > max_blocks) | ||
144 | extlen = max_blocks; | ||
145 | bh_result->b_size = extlen << inode->i_blkbits; | ||
146 | } else if (gfs2_assert_withdraw(ip->i_sbd, !create)) | ||
147 | error = -EIO; | ||
148 | |||
149 | return error; | ||
150 | } | ||
151 | |||
152 | /** | 99 | /** |
153 | * gfs2_writepage - Write complete page | 100 | * gfs2_writepage - Write complete page |
154 | * @page: Page to write | 101 | * @page: Page to write |
@@ -527,16 +474,15 @@ static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh) | |||
527 | unlock_buffer(bh); | 474 | unlock_buffer(bh); |
528 | } | 475 | } |
529 | 476 | ||
530 | static int gfs2_invalidatepage(struct page *page, unsigned long offset) | 477 | static void gfs2_invalidatepage(struct page *page, unsigned long offset) |
531 | { | 478 | { |
532 | struct gfs2_sbd *sdp = page->mapping->host->i_sb->s_fs_info; | 479 | struct gfs2_sbd *sdp = page->mapping->host->i_sb->s_fs_info; |
533 | struct buffer_head *head, *bh, *next; | 480 | struct buffer_head *head, *bh, *next; |
534 | unsigned int curr_off = 0; | 481 | unsigned int curr_off = 0; |
535 | int ret = 1; | ||
536 | 482 | ||
537 | BUG_ON(!PageLocked(page)); | 483 | BUG_ON(!PageLocked(page)); |
538 | if (!page_has_buffers(page)) | 484 | if (!page_has_buffers(page)) |
539 | return 1; | 485 | return; |
540 | 486 | ||
541 | bh = head = page_buffers(page); | 487 | bh = head = page_buffers(page); |
542 | do { | 488 | do { |
@@ -551,9 +497,9 @@ static int gfs2_invalidatepage(struct page *page, unsigned long offset) | |||
551 | } while (bh != head); | 497 | } while (bh != head); |
552 | 498 | ||
553 | if (!offset) | 499 | if (!offset) |
554 | ret = try_to_release_page(page, 0); | 500 | try_to_release_page(page, 0); |
555 | 501 | ||
556 | return ret; | 502 | return; |
557 | } | 503 | } |
558 | 504 | ||
559 | static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov, | 505 | static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov, |
@@ -587,7 +533,7 @@ static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov, | |||
587 | goto out; | 533 | goto out; |
588 | 534 | ||
589 | rv = __blockdev_direct_IO(WRITE, iocb, inode, inode->i_sb->s_bdev, | 535 | rv = __blockdev_direct_IO(WRITE, iocb, inode, inode->i_sb->s_bdev, |
590 | iov, offset, nr_segs, get_blocks_noalloc, | 536 | iov, offset, nr_segs, gfs2_get_block, |
591 | NULL, DIO_OWN_LOCKING); | 537 | NULL, DIO_OWN_LOCKING); |
592 | out: | 538 | out: |
593 | gfs2_glock_dq_m(1, &gh); | 539 | gfs2_glock_dq_m(1, &gh); |
@@ -619,7 +565,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb, | |||
619 | return -EINVAL; | 565 | return -EINVAL; |
620 | 566 | ||
621 | return __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov, | 567 | return __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov, |
622 | offset, nr_segs, get_blocks, NULL, | 568 | offset, nr_segs, gfs2_get_block, NULL, |
623 | DIO_OWN_LOCKING); | 569 | DIO_OWN_LOCKING); |
624 | } | 570 | } |
625 | 571 | ||