diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 16:48:41 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 16:48:41 -0500 |
commit | 8628de0583504138551a05ad44ca388467f0f552 (patch) | |
tree | 15a0e85dca99d74e54765a71fe2f59c4228d68c1 /fs | |
parent | 86579dd06deecfa6ac88d5e84e4d63c397cd6f6d (diff) |
[GFS2] Update GFS2 for the recent pull from Linus
Some interfaces have changed. In particular one of the posix
locking functions has changed prototype, along with the
address space operation invalidatepage and the block getting
callback to the direct IO function.
In addition add the splice file operations. These will need to
be updated to support AOP_TRUNCATED_PAGE before they will be
of much use to us.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/locking/nolock/main.c | 15 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 66 | ||||
-rw-r--r-- | fs/gfs2/ops_file.c | 19 |
3 files changed, 19 insertions, 81 deletions
diff --git a/fs/gfs2/locking/nolock/main.c b/fs/gfs2/locking/nolock/main.c index 9398309f2810..ecd37371eba5 100644 --- a/fs/gfs2/locking/nolock/main.c +++ b/fs/gfs2/locking/nolock/main.c | |||
@@ -176,14 +176,13 @@ static void nolock_sync_lvb(lm_lock_t *lock, char *lvb) | |||
176 | static int nolock_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name, | 176 | static int nolock_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name, |
177 | struct file *file, struct file_lock *fl) | 177 | struct file *file, struct file_lock *fl) |
178 | { | 178 | { |
179 | struct file_lock *tmp; | 179 | struct file_lock tmp; |
180 | int ret; | ||
180 | 181 | ||
181 | lock_kernel(); | 182 | ret = posix_test_lock(file, fl, &tmp); |
182 | tmp = posix_test_lock(file, fl); | ||
183 | fl->fl_type = F_UNLCK; | 183 | fl->fl_type = F_UNLCK; |
184 | if (tmp) | 184 | if (ret) |
185 | memcpy(fl, tmp, sizeof(struct file_lock)); | 185 | memcpy(fl, &tmp, sizeof(struct file_lock)); |
186 | unlock_kernel(); | ||
187 | 186 | ||
188 | return 0; | 187 | return 0; |
189 | } | 188 | } |
@@ -192,9 +191,7 @@ static int nolock_plock(lm_lockspace_t *lockspace, struct lm_lockname *name, | |||
192 | struct file *file, int cmd, struct file_lock *fl) | 191 | struct file *file, int cmd, struct file_lock *fl) |
193 | { | 192 | { |
194 | int error; | 193 | int error; |
195 | lock_kernel(); | ||
196 | error = posix_lock_file_wait(file, fl); | 194 | error = posix_lock_file_wait(file, fl); |
197 | unlock_kernel(); | ||
198 | return error; | 195 | return error; |
199 | } | 196 | } |
200 | 197 | ||
@@ -202,9 +199,7 @@ static int nolock_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name, | |||
202 | struct file *file, struct file_lock *fl) | 199 | struct file *file, struct file_lock *fl) |
203 | { | 200 | { |
204 | int error; | 201 | int error; |
205 | lock_kernel(); | ||
206 | error = posix_lock_file_wait(file, fl); | 202 | error = posix_lock_file_wait(file, fl); |
207 | unlock_kernel(); | ||
208 | return error; | 203 | return error; |
209 | } | 204 | } |
210 | 205 | ||
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 | ||
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index db4484a3efcc..c44225fa758b 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -833,20 +833,15 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) | |||
833 | 833 | ||
834 | if (sdp->sd_args.ar_localflocks) { | 834 | if (sdp->sd_args.ar_localflocks) { |
835 | if (IS_GETLK(cmd)) { | 835 | if (IS_GETLK(cmd)) { |
836 | struct file_lock *tmp; | 836 | struct file_lock tmp; |
837 | lock_kernel(); | 837 | int ret; |
838 | tmp = posix_test_lock(file, fl); | 838 | ret = posix_test_lock(file, fl, &tmp); |
839 | fl->fl_type = F_UNLCK; | 839 | fl->fl_type = F_UNLCK; |
840 | if (tmp) | 840 | if (ret) |
841 | memcpy(fl, tmp, sizeof(struct file_lock)); | 841 | memcpy(fl, &tmp, sizeof(struct file_lock)); |
842 | unlock_kernel(); | ||
843 | return 0; | 842 | return 0; |
844 | } else { | 843 | } else { |
845 | int error; | 844 | return posix_lock_file_wait(file, fl); |
846 | lock_kernel(); | ||
847 | error = posix_lock_file_wait(file, fl); | ||
848 | unlock_kernel(); | ||
849 | return error; | ||
850 | } | 845 | } |
851 | } | 846 | } |
852 | 847 | ||
@@ -983,6 +978,8 @@ struct file_operations gfs2_file_fops = { | |||
983 | .lock = gfs2_lock, | 978 | .lock = gfs2_lock, |
984 | .sendfile = gfs2_sendfile, | 979 | .sendfile = gfs2_sendfile, |
985 | .flock = gfs2_flock, | 980 | .flock = gfs2_flock, |
981 | .splice_read = generic_file_splice_read, | ||
982 | .splice_write = generic_file_splice_write, | ||
986 | }; | 983 | }; |
987 | 984 | ||
988 | struct file_operations gfs2_dir_fops = { | 985 | struct file_operations gfs2_dir_fops = { |