diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-11 18:30:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-11 18:30:29 -0500 |
commit | f4d544ee5720d336a8c64f9fd33efb888c302309 (patch) | |
tree | 3b4674d46b04fbcfc38677df59c92320f65568dd /fs/xfs/linux-2.6 | |
parent | 0e2f7b837600979d5b6f174a6ff695b85942e985 (diff) | |
parent | 44a743f68705c681439f264deb05f8f38e9048d3 (diff) |
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
* 'for-linus' of git://oss.sgi.com/xfs/xfs:
xfs: Fix error return for fallocate() on XFS
xfs: cleanup dmapi macros in the umount path
xfs: remove incorrect sparse annotation for xfs_iget_cache_miss
xfs: kill the STATIC_INLINE macro
xfs: uninline xfs_get_extsz_hint
xfs: rename xfs_attr_fetch to xfs_attr_get_int
xfs: simplify xfs_buf_get / xfs_buf_read interfaces
xfs: remove IO_ISAIO
xfs: Wrapped journal record corruption on read at recovery
xfs: cleanup data end I/O handlers
xfs: use WRITE_SYNC_PLUG for synchronous writeout
xfs: reset the i_iolock lock class in the reclaim path
xfs: I/O completion handlers must use NOFS allocations
xfs: fix mmap_sem/iolock inversion in xfs_free_eofblocks
xfs: simplify inode teardown
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 114 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 14 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 9 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 4 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 6 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 5 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 71 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 15 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.h | 1 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 1 |
10 files changed, 101 insertions, 139 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 70f989895d15..87813e405cef 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -235,71 +235,36 @@ xfs_setfilesize( | |||
235 | } | 235 | } |
236 | 236 | ||
237 | /* | 237 | /* |
238 | * Buffered IO write completion for delayed allocate extents. | 238 | * IO write completion. |
239 | */ | 239 | */ |
240 | STATIC void | 240 | STATIC void |
241 | xfs_end_bio_delalloc( | 241 | xfs_end_io( |
242 | struct work_struct *work) | ||
243 | { | ||
244 | xfs_ioend_t *ioend = | ||
245 | container_of(work, xfs_ioend_t, io_work); | ||
246 | |||
247 | xfs_setfilesize(ioend); | ||
248 | xfs_destroy_ioend(ioend); | ||
249 | } | ||
250 | |||
251 | /* | ||
252 | * Buffered IO write completion for regular, written extents. | ||
253 | */ | ||
254 | STATIC void | ||
255 | xfs_end_bio_written( | ||
256 | struct work_struct *work) | ||
257 | { | ||
258 | xfs_ioend_t *ioend = | ||
259 | container_of(work, xfs_ioend_t, io_work); | ||
260 | |||
261 | xfs_setfilesize(ioend); | ||
262 | xfs_destroy_ioend(ioend); | ||
263 | } | ||
264 | |||
265 | /* | ||
266 | * IO write completion for unwritten extents. | ||
267 | * | ||
268 | * Issue transactions to convert a buffer range from unwritten | ||
269 | * to written extents. | ||
270 | */ | ||
271 | STATIC void | ||
272 | xfs_end_bio_unwritten( | ||
273 | struct work_struct *work) | 242 | struct work_struct *work) |
274 | { | 243 | { |
275 | xfs_ioend_t *ioend = | 244 | xfs_ioend_t *ioend = |
276 | container_of(work, xfs_ioend_t, io_work); | 245 | container_of(work, xfs_ioend_t, io_work); |
277 | struct xfs_inode *ip = XFS_I(ioend->io_inode); | 246 | struct xfs_inode *ip = XFS_I(ioend->io_inode); |
278 | xfs_off_t offset = ioend->io_offset; | ||
279 | size_t size = ioend->io_size; | ||
280 | |||
281 | if (likely(!ioend->io_error)) { | ||
282 | if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { | ||
283 | int error; | ||
284 | error = xfs_iomap_write_unwritten(ip, offset, size); | ||
285 | if (error) | ||
286 | ioend->io_error = error; | ||
287 | } | ||
288 | xfs_setfilesize(ioend); | ||
289 | } | ||
290 | xfs_destroy_ioend(ioend); | ||
291 | } | ||
292 | 247 | ||
293 | /* | 248 | /* |
294 | * IO read completion for regular, written extents. | 249 | * For unwritten extents we need to issue transactions to convert a |
295 | */ | 250 | * range to normal written extens after the data I/O has finished. |
296 | STATIC void | 251 | */ |
297 | xfs_end_bio_read( | 252 | if (ioend->io_type == IOMAP_UNWRITTEN && |
298 | struct work_struct *work) | 253 | likely(!ioend->io_error && !XFS_FORCED_SHUTDOWN(ip->i_mount))) { |
299 | { | 254 | int error; |
300 | xfs_ioend_t *ioend = | 255 | |
301 | container_of(work, xfs_ioend_t, io_work); | 256 | error = xfs_iomap_write_unwritten(ip, ioend->io_offset, |
257 | ioend->io_size); | ||
258 | if (error) | ||
259 | ioend->io_error = error; | ||
260 | } | ||
302 | 261 | ||
262 | /* | ||
263 | * We might have to update the on-disk file size after extending | ||
264 | * writes. | ||
265 | */ | ||
266 | if (ioend->io_type != IOMAP_READ) | ||
267 | xfs_setfilesize(ioend); | ||
303 | xfs_destroy_ioend(ioend); | 268 | xfs_destroy_ioend(ioend); |
304 | } | 269 | } |
305 | 270 | ||
@@ -314,10 +279,10 @@ xfs_finish_ioend( | |||
314 | int wait) | 279 | int wait) |
315 | { | 280 | { |
316 | if (atomic_dec_and_test(&ioend->io_remaining)) { | 281 | if (atomic_dec_and_test(&ioend->io_remaining)) { |
317 | struct workqueue_struct *wq = xfsdatad_workqueue; | 282 | struct workqueue_struct *wq; |
318 | if (ioend->io_work.func == xfs_end_bio_unwritten) | ||
319 | wq = xfsconvertd_workqueue; | ||
320 | 283 | ||
284 | wq = (ioend->io_type == IOMAP_UNWRITTEN) ? | ||
285 | xfsconvertd_workqueue : xfsdatad_workqueue; | ||
321 | queue_work(wq, &ioend->io_work); | 286 | queue_work(wq, &ioend->io_work); |
322 | if (wait) | 287 | if (wait) |
323 | flush_workqueue(wq); | 288 | flush_workqueue(wq); |
@@ -355,15 +320,7 @@ xfs_alloc_ioend( | |||
355 | ioend->io_offset = 0; | 320 | ioend->io_offset = 0; |
356 | ioend->io_size = 0; | 321 | ioend->io_size = 0; |
357 | 322 | ||
358 | if (type == IOMAP_UNWRITTEN) | 323 | INIT_WORK(&ioend->io_work, xfs_end_io); |
359 | INIT_WORK(&ioend->io_work, xfs_end_bio_unwritten); | ||
360 | else if (type == IOMAP_DELAY) | ||
361 | INIT_WORK(&ioend->io_work, xfs_end_bio_delalloc); | ||
362 | else if (type == IOMAP_READ) | ||
363 | INIT_WORK(&ioend->io_work, xfs_end_bio_read); | ||
364 | else | ||
365 | INIT_WORK(&ioend->io_work, xfs_end_bio_written); | ||
366 | |||
367 | return ioend; | 324 | return ioend; |
368 | } | 325 | } |
369 | 326 | ||
@@ -380,7 +337,7 @@ xfs_map_blocks( | |||
380 | return -xfs_iomap(XFS_I(inode), offset, count, flags, mapp, &nmaps); | 337 | return -xfs_iomap(XFS_I(inode), offset, count, flags, mapp, &nmaps); |
381 | } | 338 | } |
382 | 339 | ||
383 | STATIC_INLINE int | 340 | STATIC int |
384 | xfs_iomap_valid( | 341 | xfs_iomap_valid( |
385 | xfs_iomap_t *iomapp, | 342 | xfs_iomap_t *iomapp, |
386 | loff_t offset) | 343 | loff_t offset) |
@@ -412,8 +369,9 @@ xfs_end_bio( | |||
412 | 369 | ||
413 | STATIC void | 370 | STATIC void |
414 | xfs_submit_ioend_bio( | 371 | xfs_submit_ioend_bio( |
415 | xfs_ioend_t *ioend, | 372 | struct writeback_control *wbc, |
416 | struct bio *bio) | 373 | xfs_ioend_t *ioend, |
374 | struct bio *bio) | ||
417 | { | 375 | { |
418 | atomic_inc(&ioend->io_remaining); | 376 | atomic_inc(&ioend->io_remaining); |
419 | bio->bi_private = ioend; | 377 | bio->bi_private = ioend; |
@@ -426,7 +384,8 @@ xfs_submit_ioend_bio( | |||
426 | if (xfs_ioend_new_eof(ioend)) | 384 | if (xfs_ioend_new_eof(ioend)) |
427 | xfs_mark_inode_dirty_sync(XFS_I(ioend->io_inode)); | 385 | xfs_mark_inode_dirty_sync(XFS_I(ioend->io_inode)); |
428 | 386 | ||
429 | submit_bio(WRITE, bio); | 387 | submit_bio(wbc->sync_mode == WB_SYNC_ALL ? |
388 | WRITE_SYNC_PLUG : WRITE, bio); | ||
430 | ASSERT(!bio_flagged(bio, BIO_EOPNOTSUPP)); | 389 | ASSERT(!bio_flagged(bio, BIO_EOPNOTSUPP)); |
431 | bio_put(bio); | 390 | bio_put(bio); |
432 | } | 391 | } |
@@ -505,6 +464,7 @@ static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh) | |||
505 | */ | 464 | */ |
506 | STATIC void | 465 | STATIC void |
507 | xfs_submit_ioend( | 466 | xfs_submit_ioend( |
467 | struct writeback_control *wbc, | ||
508 | xfs_ioend_t *ioend) | 468 | xfs_ioend_t *ioend) |
509 | { | 469 | { |
510 | xfs_ioend_t *head = ioend; | 470 | xfs_ioend_t *head = ioend; |
@@ -533,19 +493,19 @@ xfs_submit_ioend( | |||
533 | retry: | 493 | retry: |
534 | bio = xfs_alloc_ioend_bio(bh); | 494 | bio = xfs_alloc_ioend_bio(bh); |
535 | } else if (bh->b_blocknr != lastblock + 1) { | 495 | } else if (bh->b_blocknr != lastblock + 1) { |
536 | xfs_submit_ioend_bio(ioend, bio); | 496 | xfs_submit_ioend_bio(wbc, ioend, bio); |
537 | goto retry; | 497 | goto retry; |
538 | } | 498 | } |
539 | 499 | ||
540 | if (bio_add_buffer(bio, bh) != bh->b_size) { | 500 | if (bio_add_buffer(bio, bh) != bh->b_size) { |
541 | xfs_submit_ioend_bio(ioend, bio); | 501 | xfs_submit_ioend_bio(wbc, ioend, bio); |
542 | goto retry; | 502 | goto retry; |
543 | } | 503 | } |
544 | 504 | ||
545 | lastblock = bh->b_blocknr; | 505 | lastblock = bh->b_blocknr; |
546 | } | 506 | } |
547 | if (bio) | 507 | if (bio) |
548 | xfs_submit_ioend_bio(ioend, bio); | 508 | xfs_submit_ioend_bio(wbc, ioend, bio); |
549 | xfs_finish_ioend(ioend, 0); | 509 | xfs_finish_ioend(ioend, 0); |
550 | } while ((ioend = next) != NULL); | 510 | } while ((ioend = next) != NULL); |
551 | } | 511 | } |
@@ -1191,7 +1151,7 @@ xfs_page_state_convert( | |||
1191 | } | 1151 | } |
1192 | 1152 | ||
1193 | if (iohead) | 1153 | if (iohead) |
1194 | xfs_submit_ioend(iohead); | 1154 | xfs_submit_ioend(wbc, iohead); |
1195 | 1155 | ||
1196 | return page_dirty; | 1156 | return page_dirty; |
1197 | 1157 | ||
@@ -1528,7 +1488,7 @@ xfs_end_io_direct( | |||
1528 | * didn't map an unwritten extent so switch it's completion | 1488 | * didn't map an unwritten extent so switch it's completion |
1529 | * handler. | 1489 | * handler. |
1530 | */ | 1490 | */ |
1531 | INIT_WORK(&ioend->io_work, xfs_end_bio_written); | 1491 | ioend->io_type = IOMAP_NEW; |
1532 | xfs_finish_ioend(ioend, 0); | 1492 | xfs_finish_ioend(ioend, 0); |
1533 | } | 1493 | } |
1534 | 1494 | ||
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 965df1227d64..4ddc973aea7a 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -149,7 +149,7 @@ page_region_mask( | |||
149 | return mask; | 149 | return mask; |
150 | } | 150 | } |
151 | 151 | ||
152 | STATIC_INLINE void | 152 | STATIC void |
153 | set_page_region( | 153 | set_page_region( |
154 | struct page *page, | 154 | struct page *page, |
155 | size_t offset, | 155 | size_t offset, |
@@ -161,7 +161,7 @@ set_page_region( | |||
161 | SetPageUptodate(page); | 161 | SetPageUptodate(page); |
162 | } | 162 | } |
163 | 163 | ||
164 | STATIC_INLINE int | 164 | STATIC int |
165 | test_page_region( | 165 | test_page_region( |
166 | struct page *page, | 166 | struct page *page, |
167 | size_t offset, | 167 | size_t offset, |
@@ -582,7 +582,7 @@ found: | |||
582 | * although backing storage may not be. | 582 | * although backing storage may not be. |
583 | */ | 583 | */ |
584 | xfs_buf_t * | 584 | xfs_buf_t * |
585 | xfs_buf_get_flags( | 585 | xfs_buf_get( |
586 | xfs_buftarg_t *target,/* target for buffer */ | 586 | xfs_buftarg_t *target,/* target for buffer */ |
587 | xfs_off_t ioff, /* starting offset of range */ | 587 | xfs_off_t ioff, /* starting offset of range */ |
588 | size_t isize, /* length of range */ | 588 | size_t isize, /* length of range */ |
@@ -661,7 +661,7 @@ _xfs_buf_read( | |||
661 | } | 661 | } |
662 | 662 | ||
663 | xfs_buf_t * | 663 | xfs_buf_t * |
664 | xfs_buf_read_flags( | 664 | xfs_buf_read( |
665 | xfs_buftarg_t *target, | 665 | xfs_buftarg_t *target, |
666 | xfs_off_t ioff, | 666 | xfs_off_t ioff, |
667 | size_t isize, | 667 | size_t isize, |
@@ -671,7 +671,7 @@ xfs_buf_read_flags( | |||
671 | 671 | ||
672 | flags |= XBF_READ; | 672 | flags |= XBF_READ; |
673 | 673 | ||
674 | bp = xfs_buf_get_flags(target, ioff, isize, flags); | 674 | bp = xfs_buf_get(target, ioff, isize, flags); |
675 | if (bp) { | 675 | if (bp) { |
676 | if (!XFS_BUF_ISDONE(bp)) { | 676 | if (!XFS_BUF_ISDONE(bp)) { |
677 | XB_TRACE(bp, "read", (unsigned long)flags); | 677 | XB_TRACE(bp, "read", (unsigned long)flags); |
@@ -718,7 +718,7 @@ xfs_buf_readahead( | |||
718 | return; | 718 | return; |
719 | 719 | ||
720 | flags |= (XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD); | 720 | flags |= (XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD); |
721 | xfs_buf_read_flags(target, ioff, isize, flags); | 721 | xfs_buf_read(target, ioff, isize, flags); |
722 | } | 722 | } |
723 | 723 | ||
724 | xfs_buf_t * | 724 | xfs_buf_t * |
@@ -1113,7 +1113,7 @@ xfs_bdwrite( | |||
1113 | xfs_buf_delwri_queue(bp, 1); | 1113 | xfs_buf_delwri_queue(bp, 1); |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | STATIC_INLINE void | 1116 | STATIC void |
1117 | _xfs_buf_ioend( | 1117 | _xfs_buf_ioend( |
1118 | xfs_buf_t *bp, | 1118 | xfs_buf_t *bp, |
1119 | int schedule) | 1119 | int schedule) |
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 9b4d666ad31f..5f07dd91c5fa 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -186,15 +186,10 @@ extern xfs_buf_t *_xfs_buf_find(xfs_buftarg_t *, xfs_off_t, size_t, | |||
186 | #define xfs_incore(buftarg,blkno,len,lockit) \ | 186 | #define xfs_incore(buftarg,blkno,len,lockit) \ |
187 | _xfs_buf_find(buftarg, blkno ,len, lockit, NULL) | 187 | _xfs_buf_find(buftarg, blkno ,len, lockit, NULL) |
188 | 188 | ||
189 | extern xfs_buf_t *xfs_buf_get_flags(xfs_buftarg_t *, xfs_off_t, size_t, | 189 | extern xfs_buf_t *xfs_buf_get(xfs_buftarg_t *, xfs_off_t, size_t, |
190 | xfs_buf_flags_t); | 190 | xfs_buf_flags_t); |
191 | #define xfs_buf_get(target, blkno, len, flags) \ | 191 | extern xfs_buf_t *xfs_buf_read(xfs_buftarg_t *, xfs_off_t, size_t, |
192 | xfs_buf_get_flags((target), (blkno), (len), XBF_LOCK | XBF_MAPPED) | ||
193 | |||
194 | extern xfs_buf_t *xfs_buf_read_flags(xfs_buftarg_t *, xfs_off_t, size_t, | ||
195 | xfs_buf_flags_t); | 192 | xfs_buf_flags_t); |
196 | #define xfs_buf_read(target, blkno, len, flags) \ | ||
197 | xfs_buf_read_flags((target), (blkno), (len), XBF_LOCK | XBF_MAPPED) | ||
198 | 193 | ||
199 | extern xfs_buf_t *xfs_buf_get_empty(size_t, xfs_buftarg_t *); | 194 | extern xfs_buf_t *xfs_buf_get_empty(size_t, xfs_buftarg_t *); |
200 | extern xfs_buf_t *xfs_buf_get_noaddr(size_t, xfs_buftarg_t *); | 195 | extern xfs_buf_t *xfs_buf_get_noaddr(size_t, xfs_buftarg_t *); |
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index eff61e2732af..e4caeb28ce2e 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -52,7 +52,7 @@ xfs_file_aio_read( | |||
52 | loff_t pos) | 52 | loff_t pos) |
53 | { | 53 | { |
54 | struct file *file = iocb->ki_filp; | 54 | struct file *file = iocb->ki_filp; |
55 | int ioflags = IO_ISAIO; | 55 | int ioflags = 0; |
56 | 56 | ||
57 | BUG_ON(iocb->ki_pos != pos); | 57 | BUG_ON(iocb->ki_pos != pos); |
58 | if (unlikely(file->f_flags & O_DIRECT)) | 58 | if (unlikely(file->f_flags & O_DIRECT)) |
@@ -71,7 +71,7 @@ xfs_file_aio_write( | |||
71 | loff_t pos) | 71 | loff_t pos) |
72 | { | 72 | { |
73 | struct file *file = iocb->ki_filp; | 73 | struct file *file = iocb->ki_filp; |
74 | int ioflags = IO_ISAIO; | 74 | int ioflags = 0; |
75 | 75 | ||
76 | BUG_ON(iocb->ki_pos != pos); | 76 | BUG_ON(iocb->ki_pos != pos); |
77 | if (unlikely(file->f_flags & O_DIRECT)) | 77 | if (unlikely(file->f_flags & O_DIRECT)) |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index cd42ef78f6b5..1f3b4b8f7dd4 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -573,8 +573,8 @@ xfs_vn_fallocate( | |||
573 | bf.l_len = len; | 573 | bf.l_len = len; |
574 | 574 | ||
575 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 575 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
576 | error = xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, | 576 | error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, |
577 | 0, XFS_ATTR_NOLOCK); | 577 | 0, XFS_ATTR_NOLOCK); |
578 | if (!error && !(mode & FALLOC_FL_KEEP_SIZE) && | 578 | if (!error && !(mode & FALLOC_FL_KEEP_SIZE) && |
579 | offset + len > i_size_read(inode)) | 579 | offset + len > i_size_read(inode)) |
580 | new_size = offset + len; | 580 | new_size = offset + len; |
@@ -585,7 +585,7 @@ xfs_vn_fallocate( | |||
585 | 585 | ||
586 | iattr.ia_valid = ATTR_SIZE; | 586 | iattr.ia_valid = ATTR_SIZE; |
587 | iattr.ia_size = new_size; | 587 | iattr.ia_size = new_size; |
588 | error = xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK); | 588 | error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK); |
589 | } | 589 | } |
590 | 590 | ||
591 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 591 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 072050f8d346..78dbfcd5eec2 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -255,8 +255,6 @@ xfs_read( | |||
255 | 255 | ||
256 | iocb->ki_pos = *offset; | 256 | iocb->ki_pos = *offset; |
257 | ret = generic_file_aio_read(iocb, iovp, segs, *offset); | 257 | ret = generic_file_aio_read(iocb, iovp, segs, *offset); |
258 | if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO)) | ||
259 | ret = wait_on_sync_kiocb(iocb); | ||
260 | if (ret > 0) | 258 | if (ret > 0) |
261 | XFS_STATS_ADD(xs_read_bytes, ret); | 259 | XFS_STATS_ADD(xs_read_bytes, ret); |
262 | 260 | ||
@@ -774,9 +772,6 @@ write_retry: | |||
774 | 772 | ||
775 | current->backing_dev_info = NULL; | 773 | current->backing_dev_info = NULL; |
776 | 774 | ||
777 | if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO)) | ||
778 | ret = wait_on_sync_kiocb(iocb); | ||
779 | |||
780 | isize = i_size_read(inode); | 775 | isize = i_size_read(inode); |
781 | if (unlikely(ret < 0 && ret != -EFAULT && *offset > isize)) | 776 | if (unlikely(ret < 0 && ret != -EFAULT && *offset > isize)) |
782 | *offset = isize; | 777 | *offset = isize; |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 18a4b8e11df2..1bfb0e980193 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -930,13 +930,39 @@ xfs_fs_alloc_inode( | |||
930 | */ | 930 | */ |
931 | STATIC void | 931 | STATIC void |
932 | xfs_fs_destroy_inode( | 932 | xfs_fs_destroy_inode( |
933 | struct inode *inode) | 933 | struct inode *inode) |
934 | { | 934 | { |
935 | xfs_inode_t *ip = XFS_I(inode); | 935 | struct xfs_inode *ip = XFS_I(inode); |
936 | |||
937 | xfs_itrace_entry(ip); | ||
936 | 938 | ||
937 | XFS_STATS_INC(vn_reclaim); | 939 | XFS_STATS_INC(vn_reclaim); |
938 | if (xfs_reclaim(ip)) | 940 | |
939 | panic("%s: cannot reclaim 0x%p\n", __func__, inode); | 941 | /* bad inode, get out here ASAP */ |
942 | if (is_bad_inode(inode)) | ||
943 | goto out_reclaim; | ||
944 | |||
945 | xfs_ioend_wait(ip); | ||
946 | |||
947 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); | ||
948 | |||
949 | /* | ||
950 | * We should never get here with one of the reclaim flags already set. | ||
951 | */ | ||
952 | ASSERT_ALWAYS(!xfs_iflags_test(ip, XFS_IRECLAIMABLE)); | ||
953 | ASSERT_ALWAYS(!xfs_iflags_test(ip, XFS_IRECLAIM)); | ||
954 | |||
955 | /* | ||
956 | * If we have nothing to flush with this inode then complete the | ||
957 | * teardown now, otherwise delay the flush operation. | ||
958 | */ | ||
959 | if (!xfs_inode_clean(ip)) { | ||
960 | xfs_inode_set_reclaim_tag(ip); | ||
961 | return; | ||
962 | } | ||
963 | |||
964 | out_reclaim: | ||
965 | xfs_ireclaim(ip); | ||
940 | } | 966 | } |
941 | 967 | ||
942 | /* | 968 | /* |
@@ -973,7 +999,6 @@ xfs_fs_inode_init_once( | |||
973 | 999 | ||
974 | mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER, | 1000 | mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER, |
975 | "xfsino", ip->i_ino); | 1001 | "xfsino", ip->i_ino); |
976 | mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); | ||
977 | } | 1002 | } |
978 | 1003 | ||
979 | /* | 1004 | /* |
@@ -1075,6 +1100,20 @@ xfs_fs_clear_inode( | |||
1075 | XFS_STATS_INC(vn_remove); | 1100 | XFS_STATS_INC(vn_remove); |
1076 | XFS_STATS_DEC(vn_active); | 1101 | XFS_STATS_DEC(vn_active); |
1077 | 1102 | ||
1103 | /* | ||
1104 | * The iolock is used by the file system to coordinate reads, | ||
1105 | * writes, and block truncates. Up to this point the lock | ||
1106 | * protected concurrent accesses by users of the inode. But | ||
1107 | * from here forward we're doing some final processing of the | ||
1108 | * inode because we're done with it, and although we reuse the | ||
1109 | * iolock for protection it is really a distinct lock class | ||
1110 | * (in the lockdep sense) from before. To keep lockdep happy | ||
1111 | * (and basically indicate what we are doing), we explicitly | ||
1112 | * re-init the iolock here. | ||
1113 | */ | ||
1114 | ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock)); | ||
1115 | mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); | ||
1116 | |||
1078 | xfs_inactive(ip); | 1117 | xfs_inactive(ip); |
1079 | } | 1118 | } |
1080 | 1119 | ||
@@ -1092,8 +1131,6 @@ xfs_fs_put_super( | |||
1092 | struct super_block *sb) | 1131 | struct super_block *sb) |
1093 | { | 1132 | { |
1094 | struct xfs_mount *mp = XFS_M(sb); | 1133 | struct xfs_mount *mp = XFS_M(sb); |
1095 | struct xfs_inode *rip = mp->m_rootip; | ||
1096 | int unmount_event_flags = 0; | ||
1097 | 1134 | ||
1098 | xfs_syncd_stop(mp); | 1135 | xfs_syncd_stop(mp); |
1099 | 1136 | ||
@@ -1109,20 +1146,7 @@ xfs_fs_put_super( | |||
1109 | xfs_sync_attr(mp, 0); | 1146 | xfs_sync_attr(mp, 0); |
1110 | } | 1147 | } |
1111 | 1148 | ||
1112 | #ifdef HAVE_DMAPI | 1149 | XFS_SEND_PREUNMOUNT(mp); |
1113 | if (mp->m_flags & XFS_MOUNT_DMAPI) { | ||
1114 | unmount_event_flags = | ||
1115 | (mp->m_dmevmask & (1 << DM_EVENT_UNMOUNT)) ? | ||
1116 | 0 : DM_FLAGS_UNWANTED; | ||
1117 | /* | ||
1118 | * Ignore error from dmapi here, first unmount is not allowed | ||
1119 | * to fail anyway, and second we wouldn't want to fail a | ||
1120 | * unmount because of dmapi. | ||
1121 | */ | ||
1122 | XFS_SEND_PREUNMOUNT(mp, rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL, | ||
1123 | NULL, NULL, 0, 0, unmount_event_flags); | ||
1124 | } | ||
1125 | #endif | ||
1126 | 1150 | ||
1127 | /* | 1151 | /* |
1128 | * Blow away any referenced inode in the filestreams cache. | 1152 | * Blow away any referenced inode in the filestreams cache. |
@@ -1133,10 +1157,7 @@ xfs_fs_put_super( | |||
1133 | 1157 | ||
1134 | XFS_bflush(mp->m_ddev_targp); | 1158 | XFS_bflush(mp->m_ddev_targp); |
1135 | 1159 | ||
1136 | if (mp->m_flags & XFS_MOUNT_DMAPI) { | 1160 | XFS_SEND_UNMOUNT(mp); |
1137 | XFS_SEND_UNMOUNT(mp, rip, DM_RIGHT_NULL, 0, 0, | ||
1138 | unmount_event_flags); | ||
1139 | } | ||
1140 | 1161 | ||
1141 | xfs_unmountfs(mp); | 1162 | xfs_unmountfs(mp); |
1142 | xfs_freesb(mp); | 1163 | xfs_freesb(mp); |
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 961df0a22c78..d895a3a960f5 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -663,10 +663,9 @@ xfs_syncd_stop( | |||
663 | kthread_stop(mp->m_sync_task); | 663 | kthread_stop(mp->m_sync_task); |
664 | } | 664 | } |
665 | 665 | ||
666 | int | 666 | STATIC int |
667 | xfs_reclaim_inode( | 667 | xfs_reclaim_inode( |
668 | xfs_inode_t *ip, | 668 | xfs_inode_t *ip, |
669 | int locked, | ||
670 | int sync_mode) | 669 | int sync_mode) |
671 | { | 670 | { |
672 | xfs_perag_t *pag = xfs_get_perag(ip->i_mount, ip->i_ino); | 671 | xfs_perag_t *pag = xfs_get_perag(ip->i_mount, ip->i_ino); |
@@ -682,10 +681,6 @@ xfs_reclaim_inode( | |||
682 | !__xfs_iflags_test(ip, XFS_IRECLAIMABLE)) { | 681 | !__xfs_iflags_test(ip, XFS_IRECLAIMABLE)) { |
683 | spin_unlock(&ip->i_flags_lock); | 682 | spin_unlock(&ip->i_flags_lock); |
684 | write_unlock(&pag->pag_ici_lock); | 683 | write_unlock(&pag->pag_ici_lock); |
685 | if (locked) { | ||
686 | xfs_ifunlock(ip); | ||
687 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
688 | } | ||
689 | return -EAGAIN; | 684 | return -EAGAIN; |
690 | } | 685 | } |
691 | __xfs_iflags_set(ip, XFS_IRECLAIM); | 686 | __xfs_iflags_set(ip, XFS_IRECLAIM); |
@@ -704,10 +699,8 @@ xfs_reclaim_inode( | |||
704 | * We get the flush lock regardless, though, just to make sure | 699 | * We get the flush lock regardless, though, just to make sure |
705 | * we don't free it while it is being flushed. | 700 | * we don't free it while it is being flushed. |
706 | */ | 701 | */ |
707 | if (!locked) { | 702 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
708 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 703 | xfs_iflock(ip); |
709 | xfs_iflock(ip); | ||
710 | } | ||
711 | 704 | ||
712 | /* | 705 | /* |
713 | * In the case of a forced shutdown we rely on xfs_iflush() to | 706 | * In the case of a forced shutdown we rely on xfs_iflush() to |
@@ -778,7 +771,7 @@ xfs_reclaim_inode_now( | |||
778 | } | 771 | } |
779 | read_unlock(&pag->pag_ici_lock); | 772 | read_unlock(&pag->pag_ici_lock); |
780 | 773 | ||
781 | return xfs_reclaim_inode(ip, 0, flags); | 774 | return xfs_reclaim_inode(ip, flags); |
782 | } | 775 | } |
783 | 776 | ||
784 | int | 777 | int |
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h index 27920eb7a820..a500b4d91835 100644 --- a/fs/xfs/linux-2.6/xfs_sync.h +++ b/fs/xfs/linux-2.6/xfs_sync.h | |||
@@ -44,7 +44,6 @@ void xfs_quiesce_attr(struct xfs_mount *mp); | |||
44 | 44 | ||
45 | void xfs_flush_inodes(struct xfs_inode *ip); | 45 | void xfs_flush_inodes(struct xfs_inode *ip); |
46 | 46 | ||
47 | int xfs_reclaim_inode(struct xfs_inode *ip, int locked, int sync_mode); | ||
48 | int xfs_reclaim_inodes(struct xfs_mount *mp, int mode); | 47 | int xfs_reclaim_inodes(struct xfs_mount *mp, int mode); |
49 | 48 | ||
50 | void xfs_inode_set_reclaim_tag(struct xfs_inode *ip); | 49 | void xfs_inode_set_reclaim_tag(struct xfs_inode *ip); |
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index ad7fbead4c97..00cabf5354d2 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -36,7 +36,6 @@ struct attrlist_cursor_kern; | |||
36 | /* | 36 | /* |
37 | * Flags for read/write calls - same values as IRIX | 37 | * Flags for read/write calls - same values as IRIX |
38 | */ | 38 | */ |
39 | #define IO_ISAIO 0x00001 /* don't wait for completion */ | ||
40 | #define IO_ISDIRECT 0x00004 /* bypass page cache */ | 39 | #define IO_ISDIRECT 0x00004 /* bypass page cache */ |
41 | #define IO_INVIS 0x00020 /* don't update inode timestamps */ | 40 | #define IO_INVIS 0x00020 /* don't update inode timestamps */ |
42 | 41 | ||