diff options
Diffstat (limited to 'fs/xfs/linux-2.6')
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_acl.c | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 231 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 27 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 2 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 2 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 5 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_quotaops.c | 8 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 13 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_super.h | 2 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 91 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_trace.c | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_trace.h | 150 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_xattr.c | 8 |
15 files changed, 358 insertions, 197 deletions
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c index a7bc925c4d60..9f769b5b38fc 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/linux-2.6/xfs_acl.c | |||
| @@ -440,14 +440,14 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name, | |||
| 440 | return error; | 440 | return error; |
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | struct xattr_handler xfs_xattr_acl_access_handler = { | 443 | const struct xattr_handler xfs_xattr_acl_access_handler = { |
| 444 | .prefix = POSIX_ACL_XATTR_ACCESS, | 444 | .prefix = POSIX_ACL_XATTR_ACCESS, |
| 445 | .flags = ACL_TYPE_ACCESS, | 445 | .flags = ACL_TYPE_ACCESS, |
| 446 | .get = xfs_xattr_acl_get, | 446 | .get = xfs_xattr_acl_get, |
| 447 | .set = xfs_xattr_acl_set, | 447 | .set = xfs_xattr_acl_set, |
| 448 | }; | 448 | }; |
| 449 | 449 | ||
| 450 | struct xattr_handler xfs_xattr_acl_default_handler = { | 450 | const struct xattr_handler xfs_xattr_acl_default_handler = { |
| 451 | .prefix = POSIX_ACL_XATTR_DEFAULT, | 451 | .prefix = POSIX_ACL_XATTR_DEFAULT, |
| 452 | .flags = ACL_TYPE_DEFAULT, | 452 | .flags = ACL_TYPE_DEFAULT, |
| 453 | .get = xfs_xattr_acl_get, | 453 | .get = xfs_xattr_acl_get, |
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 0f8b9968a803..089eaca860b4 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
| @@ -45,6 +45,15 @@ | |||
| 45 | #include <linux/pagevec.h> | 45 | #include <linux/pagevec.h> |
| 46 | #include <linux/writeback.h> | 46 | #include <linux/writeback.h> |
| 47 | 47 | ||
| 48 | /* | ||
| 49 | * Types of I/O for bmap clustering and I/O completion tracking. | ||
| 50 | */ | ||
| 51 | enum { | ||
| 52 | IO_READ, /* mapping for a read */ | ||
| 53 | IO_DELAY, /* mapping covers delalloc region */ | ||
| 54 | IO_UNWRITTEN, /* mapping covers allocated but uninitialized data */ | ||
| 55 | IO_NEW /* just allocated */ | ||
| 56 | }; | ||
| 48 | 57 | ||
| 49 | /* | 58 | /* |
| 50 | * Prime number of hash buckets since address is used as the key. | 59 | * Prime number of hash buckets since address is used as the key. |
| @@ -103,8 +112,9 @@ xfs_count_page_state( | |||
| 103 | 112 | ||
| 104 | STATIC struct block_device * | 113 | STATIC struct block_device * |
| 105 | xfs_find_bdev_for_inode( | 114 | xfs_find_bdev_for_inode( |
| 106 | struct xfs_inode *ip) | 115 | struct inode *inode) |
| 107 | { | 116 | { |
| 117 | struct xfs_inode *ip = XFS_I(inode); | ||
| 108 | struct xfs_mount *mp = ip->i_mount; | 118 | struct xfs_mount *mp = ip->i_mount; |
| 109 | 119 | ||
| 110 | if (XFS_IS_REALTIME_INODE(ip)) | 120 | if (XFS_IS_REALTIME_INODE(ip)) |
| @@ -183,7 +193,7 @@ xfs_setfilesize( | |||
| 183 | xfs_fsize_t isize; | 193 | xfs_fsize_t isize; |
| 184 | 194 | ||
| 185 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); | 195 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); |
| 186 | ASSERT(ioend->io_type != IOMAP_READ); | 196 | ASSERT(ioend->io_type != IO_READ); |
| 187 | 197 | ||
| 188 | if (unlikely(ioend->io_error)) | 198 | if (unlikely(ioend->io_error)) |
| 189 | return 0; | 199 | return 0; |
| @@ -214,7 +224,7 @@ xfs_finish_ioend( | |||
| 214 | if (atomic_dec_and_test(&ioend->io_remaining)) { | 224 | if (atomic_dec_and_test(&ioend->io_remaining)) { |
| 215 | struct workqueue_struct *wq; | 225 | struct workqueue_struct *wq; |
| 216 | 226 | ||
| 217 | wq = (ioend->io_type == IOMAP_UNWRITTEN) ? | 227 | wq = (ioend->io_type == IO_UNWRITTEN) ? |
| 218 | xfsconvertd_workqueue : xfsdatad_workqueue; | 228 | xfsconvertd_workqueue : xfsdatad_workqueue; |
| 219 | queue_work(wq, &ioend->io_work); | 229 | queue_work(wq, &ioend->io_work); |
| 220 | if (wait) | 230 | if (wait) |
| @@ -237,7 +247,7 @@ xfs_end_io( | |||
| 237 | * For unwritten extents we need to issue transactions to convert a | 247 | * For unwritten extents we need to issue transactions to convert a |
| 238 | * range to normal written extens after the data I/O has finished. | 248 | * range to normal written extens after the data I/O has finished. |
| 239 | */ | 249 | */ |
| 240 | if (ioend->io_type == IOMAP_UNWRITTEN && | 250 | if (ioend->io_type == IO_UNWRITTEN && |
| 241 | likely(!ioend->io_error && !XFS_FORCED_SHUTDOWN(ip->i_mount))) { | 251 | likely(!ioend->io_error && !XFS_FORCED_SHUTDOWN(ip->i_mount))) { |
| 242 | 252 | ||
| 243 | error = xfs_iomap_write_unwritten(ip, ioend->io_offset, | 253 | error = xfs_iomap_write_unwritten(ip, ioend->io_offset, |
| @@ -250,7 +260,7 @@ xfs_end_io( | |||
| 250 | * We might have to update the on-disk file size after extending | 260 | * We might have to update the on-disk file size after extending |
| 251 | * writes. | 261 | * writes. |
| 252 | */ | 262 | */ |
| 253 | if (ioend->io_type != IOMAP_READ) { | 263 | if (ioend->io_type != IO_READ) { |
| 254 | error = xfs_setfilesize(ioend); | 264 | error = xfs_setfilesize(ioend); |
| 255 | ASSERT(!error || error == EAGAIN); | 265 | ASSERT(!error || error == EAGAIN); |
| 256 | } | 266 | } |
| @@ -309,21 +319,25 @@ xfs_map_blocks( | |||
| 309 | struct inode *inode, | 319 | struct inode *inode, |
| 310 | loff_t offset, | 320 | loff_t offset, |
| 311 | ssize_t count, | 321 | ssize_t count, |
| 312 | xfs_iomap_t *mapp, | 322 | struct xfs_bmbt_irec *imap, |
| 313 | int flags) | 323 | int flags) |
| 314 | { | 324 | { |
| 315 | int nmaps = 1; | 325 | int nmaps = 1; |
| 326 | int new = 0; | ||
| 316 | 327 | ||
| 317 | return -xfs_iomap(XFS_I(inode), offset, count, flags, mapp, &nmaps); | 328 | return -xfs_iomap(XFS_I(inode), offset, count, flags, imap, &nmaps, &new); |
| 318 | } | 329 | } |
| 319 | 330 | ||
| 320 | STATIC int | 331 | STATIC int |
| 321 | xfs_iomap_valid( | 332 | xfs_imap_valid( |
| 322 | xfs_iomap_t *iomapp, | 333 | struct inode *inode, |
| 323 | loff_t offset) | 334 | struct xfs_bmbt_irec *imap, |
| 335 | xfs_off_t offset) | ||
| 324 | { | 336 | { |
| 325 | return offset >= iomapp->iomap_offset && | 337 | offset >>= inode->i_blkbits; |
| 326 | offset < iomapp->iomap_offset + iomapp->iomap_bsize; | 338 | |
| 339 | return offset >= imap->br_startoff && | ||
| 340 | offset < imap->br_startoff + imap->br_blockcount; | ||
| 327 | } | 341 | } |
| 328 | 342 | ||
| 329 | /* | 343 | /* |
| @@ -554,19 +568,23 @@ xfs_add_to_ioend( | |||
| 554 | 568 | ||
| 555 | STATIC void | 569 | STATIC void |
| 556 | xfs_map_buffer( | 570 | xfs_map_buffer( |
| 571 | struct inode *inode, | ||
| 557 | struct buffer_head *bh, | 572 | struct buffer_head *bh, |
| 558 | xfs_iomap_t *mp, | 573 | struct xfs_bmbt_irec *imap, |
| 559 | xfs_off_t offset, | 574 | xfs_off_t offset) |
| 560 | uint block_bits) | ||
| 561 | { | 575 | { |
| 562 | sector_t bn; | 576 | sector_t bn; |
| 577 | struct xfs_mount *m = XFS_I(inode)->i_mount; | ||
| 578 | xfs_off_t iomap_offset = XFS_FSB_TO_B(m, imap->br_startoff); | ||
| 579 | xfs_daddr_t iomap_bn = xfs_fsb_to_db(XFS_I(inode), imap->br_startblock); | ||
| 563 | 580 | ||
| 564 | ASSERT(mp->iomap_bn != IOMAP_DADDR_NULL); | 581 | ASSERT(imap->br_startblock != HOLESTARTBLOCK); |
| 582 | ASSERT(imap->br_startblock != DELAYSTARTBLOCK); | ||
| 565 | 583 | ||
| 566 | bn = (mp->iomap_bn >> (block_bits - BBSHIFT)) + | 584 | bn = (iomap_bn >> (inode->i_blkbits - BBSHIFT)) + |
| 567 | ((offset - mp->iomap_offset) >> block_bits); | 585 | ((offset - iomap_offset) >> inode->i_blkbits); |
| 568 | 586 | ||
| 569 | ASSERT(bn || (mp->iomap_flags & IOMAP_REALTIME)); | 587 | ASSERT(bn || XFS_IS_REALTIME_INODE(XFS_I(inode))); |
| 570 | 588 | ||
| 571 | bh->b_blocknr = bn; | 589 | bh->b_blocknr = bn; |
| 572 | set_buffer_mapped(bh); | 590 | set_buffer_mapped(bh); |
| @@ -574,17 +592,17 @@ xfs_map_buffer( | |||
| 574 | 592 | ||
| 575 | STATIC void | 593 | STATIC void |
| 576 | xfs_map_at_offset( | 594 | xfs_map_at_offset( |
| 595 | struct inode *inode, | ||
| 577 | struct buffer_head *bh, | 596 | struct buffer_head *bh, |
| 578 | loff_t offset, | 597 | struct xfs_bmbt_irec *imap, |
| 579 | int block_bits, | 598 | xfs_off_t offset) |
| 580 | xfs_iomap_t *iomapp) | ||
| 581 | { | 599 | { |
| 582 | ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE)); | 600 | ASSERT(imap->br_startblock != HOLESTARTBLOCK); |
| 583 | ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY)); | 601 | ASSERT(imap->br_startblock != DELAYSTARTBLOCK); |
| 584 | 602 | ||
| 585 | lock_buffer(bh); | 603 | lock_buffer(bh); |
| 586 | xfs_map_buffer(bh, iomapp, offset, block_bits); | 604 | xfs_map_buffer(inode, bh, imap, offset); |
| 587 | bh->b_bdev = iomapp->iomap_target->bt_bdev; | 605 | bh->b_bdev = xfs_find_bdev_for_inode(inode); |
| 588 | set_buffer_mapped(bh); | 606 | set_buffer_mapped(bh); |
| 589 | clear_buffer_delay(bh); | 607 | clear_buffer_delay(bh); |
| 590 | clear_buffer_unwritten(bh); | 608 | clear_buffer_unwritten(bh); |
| @@ -713,11 +731,11 @@ xfs_is_delayed_page( | |||
| 713 | bh = head = page_buffers(page); | 731 | bh = head = page_buffers(page); |
| 714 | do { | 732 | do { |
| 715 | if (buffer_unwritten(bh)) | 733 | if (buffer_unwritten(bh)) |
| 716 | acceptable = (type == IOMAP_UNWRITTEN); | 734 | acceptable = (type == IO_UNWRITTEN); |
| 717 | else if (buffer_delay(bh)) | 735 | else if (buffer_delay(bh)) |
| 718 | acceptable = (type == IOMAP_DELAY); | 736 | acceptable = (type == IO_DELAY); |
| 719 | else if (buffer_dirty(bh) && buffer_mapped(bh)) | 737 | else if (buffer_dirty(bh) && buffer_mapped(bh)) |
| 720 | acceptable = (type == IOMAP_NEW); | 738 | acceptable = (type == IO_NEW); |
| 721 | else | 739 | else |
| 722 | break; | 740 | break; |
| 723 | } while ((bh = bh->b_this_page) != head); | 741 | } while ((bh = bh->b_this_page) != head); |
| @@ -740,7 +758,7 @@ xfs_convert_page( | |||
| 740 | struct inode *inode, | 758 | struct inode *inode, |
| 741 | struct page *page, | 759 | struct page *page, |
| 742 | loff_t tindex, | 760 | loff_t tindex, |
| 743 | xfs_iomap_t *mp, | 761 | struct xfs_bmbt_irec *imap, |
| 744 | xfs_ioend_t **ioendp, | 762 | xfs_ioend_t **ioendp, |
| 745 | struct writeback_control *wbc, | 763 | struct writeback_control *wbc, |
| 746 | int startio, | 764 | int startio, |
| @@ -750,7 +768,6 @@ xfs_convert_page( | |||
| 750 | xfs_off_t end_offset; | 768 | xfs_off_t end_offset; |
| 751 | unsigned long p_offset; | 769 | unsigned long p_offset; |
| 752 | unsigned int type; | 770 | unsigned int type; |
| 753 | int bbits = inode->i_blkbits; | ||
| 754 | int len, page_dirty; | 771 | int len, page_dirty; |
| 755 | int count = 0, done = 0, uptodate = 1; | 772 | int count = 0, done = 0, uptodate = 1; |
| 756 | xfs_off_t offset = page_offset(page); | 773 | xfs_off_t offset = page_offset(page); |
| @@ -802,19 +819,19 @@ xfs_convert_page( | |||
| 802 | 819 | ||
| 803 | if (buffer_unwritten(bh) || buffer_delay(bh)) { | 820 | if (buffer_unwritten(bh) || buffer_delay(bh)) { |
| 804 | if (buffer_unwritten(bh)) | 821 | if (buffer_unwritten(bh)) |
| 805 | type = IOMAP_UNWRITTEN; | 822 | type = IO_UNWRITTEN; |
| 806 | else | 823 | else |
| 807 | type = IOMAP_DELAY; | 824 | type = IO_DELAY; |
| 808 | 825 | ||
| 809 | if (!xfs_iomap_valid(mp, offset)) { | 826 | if (!xfs_imap_valid(inode, imap, offset)) { |
| 810 | done = 1; | 827 | done = 1; |
| 811 | continue; | 828 | continue; |
| 812 | } | 829 | } |
| 813 | 830 | ||
| 814 | ASSERT(!(mp->iomap_flags & IOMAP_HOLE)); | 831 | ASSERT(imap->br_startblock != HOLESTARTBLOCK); |
| 815 | ASSERT(!(mp->iomap_flags & IOMAP_DELAY)); | 832 | ASSERT(imap->br_startblock != DELAYSTARTBLOCK); |
| 816 | 833 | ||
| 817 | xfs_map_at_offset(bh, offset, bbits, mp); | 834 | xfs_map_at_offset(inode, bh, imap, offset); |
| 818 | if (startio) { | 835 | if (startio) { |
| 819 | xfs_add_to_ioend(inode, bh, offset, | 836 | xfs_add_to_ioend(inode, bh, offset, |
| 820 | type, ioendp, done); | 837 | type, ioendp, done); |
| @@ -826,7 +843,7 @@ xfs_convert_page( | |||
| 826 | page_dirty--; | 843 | page_dirty--; |
| 827 | count++; | 844 | count++; |
| 828 | } else { | 845 | } else { |
| 829 | type = IOMAP_NEW; | 846 | type = IO_NEW; |
| 830 | if (buffer_mapped(bh) && all_bh && startio) { | 847 | if (buffer_mapped(bh) && all_bh && startio) { |
| 831 | lock_buffer(bh); | 848 | lock_buffer(bh); |
| 832 | xfs_add_to_ioend(inode, bh, offset, | 849 | xfs_add_to_ioend(inode, bh, offset, |
| @@ -866,7 +883,7 @@ STATIC void | |||
| 866 | xfs_cluster_write( | 883 | xfs_cluster_write( |
| 867 | struct inode *inode, | 884 | struct inode *inode, |
| 868 | pgoff_t tindex, | 885 | pgoff_t tindex, |
| 869 | xfs_iomap_t *iomapp, | 886 | struct xfs_bmbt_irec *imap, |
| 870 | xfs_ioend_t **ioendp, | 887 | xfs_ioend_t **ioendp, |
| 871 | struct writeback_control *wbc, | 888 | struct writeback_control *wbc, |
| 872 | int startio, | 889 | int startio, |
| @@ -885,7 +902,7 @@ xfs_cluster_write( | |||
| 885 | 902 | ||
| 886 | for (i = 0; i < pagevec_count(&pvec); i++) { | 903 | for (i = 0; i < pagevec_count(&pvec); i++) { |
| 887 | done = xfs_convert_page(inode, pvec.pages[i], tindex++, | 904 | done = xfs_convert_page(inode, pvec.pages[i], tindex++, |
| 888 | iomapp, ioendp, wbc, startio, all_bh); | 905 | imap, ioendp, wbc, startio, all_bh); |
| 889 | if (done) | 906 | if (done) |
| 890 | break; | 907 | break; |
| 891 | } | 908 | } |
| @@ -930,7 +947,7 @@ xfs_aops_discard_page( | |||
| 930 | loff_t offset = page_offset(page); | 947 | loff_t offset = page_offset(page); |
| 931 | ssize_t len = 1 << inode->i_blkbits; | 948 | ssize_t len = 1 << inode->i_blkbits; |
| 932 | 949 | ||
| 933 | if (!xfs_is_delayed_page(page, IOMAP_DELAY)) | 950 | if (!xfs_is_delayed_page(page, IO_DELAY)) |
| 934 | goto out_invalidate; | 951 | goto out_invalidate; |
| 935 | 952 | ||
| 936 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) | 953 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) |
| @@ -1042,15 +1059,15 @@ xfs_page_state_convert( | |||
| 1042 | int unmapped) /* also implies page uptodate */ | 1059 | int unmapped) /* also implies page uptodate */ |
| 1043 | { | 1060 | { |
| 1044 | struct buffer_head *bh, *head; | 1061 | struct buffer_head *bh, *head; |
| 1045 | xfs_iomap_t iomap; | 1062 | struct xfs_bmbt_irec imap; |
| 1046 | xfs_ioend_t *ioend = NULL, *iohead = NULL; | 1063 | xfs_ioend_t *ioend = NULL, *iohead = NULL; |
| 1047 | loff_t offset; | 1064 | loff_t offset; |
| 1048 | unsigned long p_offset = 0; | 1065 | unsigned long p_offset = 0; |
| 1049 | unsigned int type; | 1066 | unsigned int type; |
| 1050 | __uint64_t end_offset; | 1067 | __uint64_t end_offset; |
| 1051 | pgoff_t end_index, last_index, tlast; | 1068 | pgoff_t end_index, last_index; |
| 1052 | ssize_t size, len; | 1069 | ssize_t size, len; |
| 1053 | int flags, err, iomap_valid = 0, uptodate = 1; | 1070 | int flags, err, imap_valid = 0, uptodate = 1; |
| 1054 | int page_dirty, count = 0; | 1071 | int page_dirty, count = 0; |
| 1055 | int trylock = 0; | 1072 | int trylock = 0; |
| 1056 | int all_bh = unmapped; | 1073 | int all_bh = unmapped; |
| @@ -1097,7 +1114,7 @@ xfs_page_state_convert( | |||
| 1097 | bh = head = page_buffers(page); | 1114 | bh = head = page_buffers(page); |
| 1098 | offset = page_offset(page); | 1115 | offset = page_offset(page); |
| 1099 | flags = BMAPI_READ; | 1116 | flags = BMAPI_READ; |
| 1100 | type = IOMAP_NEW; | 1117 | type = IO_NEW; |
| 1101 | 1118 | ||
| 1102 | /* TODO: cleanup count and page_dirty */ | 1119 | /* TODO: cleanup count and page_dirty */ |
| 1103 | 1120 | ||
| @@ -1111,12 +1128,12 @@ xfs_page_state_convert( | |||
| 1111 | * the iomap is actually still valid, but the ioend | 1128 | * the iomap is actually still valid, but the ioend |
| 1112 | * isn't. shouldn't happen too often. | 1129 | * isn't. shouldn't happen too often. |
| 1113 | */ | 1130 | */ |
| 1114 | iomap_valid = 0; | 1131 | imap_valid = 0; |
| 1115 | continue; | 1132 | continue; |
| 1116 | } | 1133 | } |
| 1117 | 1134 | ||
| 1118 | if (iomap_valid) | 1135 | if (imap_valid) |
| 1119 | iomap_valid = xfs_iomap_valid(&iomap, offset); | 1136 | imap_valid = xfs_imap_valid(inode, &imap, offset); |
| 1120 | 1137 | ||
| 1121 | /* | 1138 | /* |
| 1122 | * First case, map an unwritten extent and prepare for | 1139 | * First case, map an unwritten extent and prepare for |
| @@ -1137,20 +1154,20 @@ xfs_page_state_convert( | |||
| 1137 | * Make sure we don't use a read-only iomap | 1154 | * Make sure we don't use a read-only iomap |
| 1138 | */ | 1155 | */ |
| 1139 | if (flags == BMAPI_READ) | 1156 | if (flags == BMAPI_READ) |
| 1140 | iomap_valid = 0; | 1157 | imap_valid = 0; |
| 1141 | 1158 | ||
| 1142 | if (buffer_unwritten(bh)) { | 1159 | if (buffer_unwritten(bh)) { |
| 1143 | type = IOMAP_UNWRITTEN; | 1160 | type = IO_UNWRITTEN; |
| 1144 | flags = BMAPI_WRITE | BMAPI_IGNSTATE; | 1161 | flags = BMAPI_WRITE | BMAPI_IGNSTATE; |
| 1145 | } else if (buffer_delay(bh)) { | 1162 | } else if (buffer_delay(bh)) { |
| 1146 | type = IOMAP_DELAY; | 1163 | type = IO_DELAY; |
| 1147 | flags = BMAPI_ALLOCATE | trylock; | 1164 | flags = BMAPI_ALLOCATE | trylock; |
| 1148 | } else { | 1165 | } else { |
| 1149 | type = IOMAP_NEW; | 1166 | type = IO_NEW; |
| 1150 | flags = BMAPI_WRITE | BMAPI_MMAP; | 1167 | flags = BMAPI_WRITE | BMAPI_MMAP; |
| 1151 | } | 1168 | } |
| 1152 | 1169 | ||
| 1153 | if (!iomap_valid) { | 1170 | if (!imap_valid) { |
| 1154 | /* | 1171 | /* |
| 1155 | * if we didn't have a valid mapping then we | 1172 | * if we didn't have a valid mapping then we |
| 1156 | * need to ensure that we put the new mapping | 1173 | * need to ensure that we put the new mapping |
| @@ -1160,7 +1177,7 @@ xfs_page_state_convert( | |||
| 1160 | * for unwritten extent conversion. | 1177 | * for unwritten extent conversion. |
| 1161 | */ | 1178 | */ |
| 1162 | new_ioend = 1; | 1179 | new_ioend = 1; |
| 1163 | if (type == IOMAP_NEW) { | 1180 | if (type == IO_NEW) { |
| 1164 | size = xfs_probe_cluster(inode, | 1181 | size = xfs_probe_cluster(inode, |
| 1165 | page, bh, head, 0); | 1182 | page, bh, head, 0); |
| 1166 | } else { | 1183 | } else { |
| @@ -1168,14 +1185,14 @@ xfs_page_state_convert( | |||
| 1168 | } | 1185 | } |
| 1169 | 1186 | ||
| 1170 | err = xfs_map_blocks(inode, offset, size, | 1187 | err = xfs_map_blocks(inode, offset, size, |
| 1171 | &iomap, flags); | 1188 | &imap, flags); |
| 1172 | if (err) | 1189 | if (err) |
| 1173 | goto error; | 1190 | goto error; |
| 1174 | iomap_valid = xfs_iomap_valid(&iomap, offset); | 1191 | imap_valid = xfs_imap_valid(inode, &imap, |
| 1192 | offset); | ||
| 1175 | } | 1193 | } |
| 1176 | if (iomap_valid) { | 1194 | if (imap_valid) { |
| 1177 | xfs_map_at_offset(bh, offset, | 1195 | xfs_map_at_offset(inode, bh, &imap, offset); |
| 1178 | inode->i_blkbits, &iomap); | ||
| 1179 | if (startio) { | 1196 | if (startio) { |
| 1180 | xfs_add_to_ioend(inode, bh, offset, | 1197 | xfs_add_to_ioend(inode, bh, offset, |
| 1181 | type, &ioend, | 1198 | type, &ioend, |
| @@ -1194,40 +1211,41 @@ xfs_page_state_convert( | |||
| 1194 | * That means it must already have extents allocated | 1211 | * That means it must already have extents allocated |
| 1195 | * underneath it. Map the extent by reading it. | 1212 | * underneath it. Map the extent by reading it. |
| 1196 | */ | 1213 | */ |
| 1197 | if (!iomap_valid || flags != BMAPI_READ) { | 1214 | if (!imap_valid || flags != BMAPI_READ) { |
| 1198 | flags = BMAPI_READ; | 1215 | flags = BMAPI_READ; |
| 1199 | size = xfs_probe_cluster(inode, page, bh, | 1216 | size = xfs_probe_cluster(inode, page, bh, |
| 1200 | head, 1); | 1217 | head, 1); |
| 1201 | err = xfs_map_blocks(inode, offset, size, | 1218 | err = xfs_map_blocks(inode, offset, size, |
| 1202 | &iomap, flags); | 1219 | &imap, flags); |
| 1203 | if (err) | 1220 | if (err) |
| 1204 | goto error; | 1221 | goto error; |
| 1205 | iomap_valid = xfs_iomap_valid(&iomap, offset); | 1222 | imap_valid = xfs_imap_valid(inode, &imap, |
| 1223 | offset); | ||
| 1206 | } | 1224 | } |
| 1207 | 1225 | ||
| 1208 | /* | 1226 | /* |
| 1209 | * We set the type to IOMAP_NEW in case we are doing a | 1227 | * We set the type to IO_NEW in case we are doing a |
| 1210 | * small write at EOF that is extending the file but | 1228 | * small write at EOF that is extending the file but |
| 1211 | * without needing an allocation. We need to update the | 1229 | * without needing an allocation. We need to update the |
| 1212 | * file size on I/O completion in this case so it is | 1230 | * file size on I/O completion in this case so it is |
| 1213 | * the same case as having just allocated a new extent | 1231 | * the same case as having just allocated a new extent |
| 1214 | * that we are writing into for the first time. | 1232 | * that we are writing into for the first time. |
| 1215 | */ | 1233 | */ |
| 1216 | type = IOMAP_NEW; | 1234 | type = IO_NEW; |
| 1217 | if (trylock_buffer(bh)) { | 1235 | if (trylock_buffer(bh)) { |
| 1218 | ASSERT(buffer_mapped(bh)); | 1236 | ASSERT(buffer_mapped(bh)); |
| 1219 | if (iomap_valid) | 1237 | if (imap_valid) |
| 1220 | all_bh = 1; | 1238 | all_bh = 1; |
| 1221 | xfs_add_to_ioend(inode, bh, offset, type, | 1239 | xfs_add_to_ioend(inode, bh, offset, type, |
| 1222 | &ioend, !iomap_valid); | 1240 | &ioend, !imap_valid); |
| 1223 | page_dirty--; | 1241 | page_dirty--; |
| 1224 | count++; | 1242 | count++; |
| 1225 | } else { | 1243 | } else { |
| 1226 | iomap_valid = 0; | 1244 | imap_valid = 0; |
| 1227 | } | 1245 | } |
| 1228 | } else if ((buffer_uptodate(bh) || PageUptodate(page)) && | 1246 | } else if ((buffer_uptodate(bh) || PageUptodate(page)) && |
| 1229 | (unmapped || startio)) { | 1247 | (unmapped || startio)) { |
| 1230 | iomap_valid = 0; | 1248 | imap_valid = 0; |
| 1231 | } | 1249 | } |
| 1232 | 1250 | ||
| 1233 | if (!iohead) | 1251 | if (!iohead) |
| @@ -1241,12 +1259,23 @@ xfs_page_state_convert( | |||
| 1241 | if (startio) | 1259 | if (startio) |
| 1242 | xfs_start_page_writeback(page, 1, count); | 1260 | xfs_start_page_writeback(page, 1, count); |
| 1243 | 1261 | ||
| 1244 | if (ioend && iomap_valid) { | 1262 | if (ioend && imap_valid) { |
| 1245 | offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >> | 1263 | xfs_off_t end_index; |
| 1246 | PAGE_CACHE_SHIFT; | 1264 | |
| 1247 | tlast = min_t(pgoff_t, offset, last_index); | 1265 | end_index = imap.br_startoff + imap.br_blockcount; |
| 1248 | xfs_cluster_write(inode, page->index + 1, &iomap, &ioend, | 1266 | |
| 1249 | wbc, startio, all_bh, tlast); | 1267 | /* to bytes */ |
| 1268 | end_index <<= inode->i_blkbits; | ||
| 1269 | |||
| 1270 | /* to pages */ | ||
| 1271 | end_index = (end_index - 1) >> PAGE_CACHE_SHIFT; | ||
| 1272 | |||
| 1273 | /* check against file size */ | ||
| 1274 | if (end_index > last_index) | ||
| 1275 | end_index = last_index; | ||
| 1276 | |||
| 1277 | xfs_cluster_write(inode, page->index + 1, &imap, &ioend, | ||
| 1278 | wbc, startio, all_bh, end_index); | ||
| 1250 | } | 1279 | } |
| 1251 | 1280 | ||
| 1252 | if (iohead) | 1281 | if (iohead) |
| @@ -1448,10 +1477,11 @@ __xfs_get_blocks( | |||
| 1448 | int direct, | 1477 | int direct, |
| 1449 | bmapi_flags_t flags) | 1478 | bmapi_flags_t flags) |
| 1450 | { | 1479 | { |
| 1451 | xfs_iomap_t iomap; | 1480 | struct xfs_bmbt_irec imap; |
| 1452 | xfs_off_t offset; | 1481 | xfs_off_t offset; |
| 1453 | ssize_t size; | 1482 | ssize_t size; |
| 1454 | int niomap = 1; | 1483 | int nimap = 1; |
| 1484 | int new = 0; | ||
| 1455 | int error; | 1485 | int error; |
| 1456 | 1486 | ||
| 1457 | offset = (xfs_off_t)iblock << inode->i_blkbits; | 1487 | offset = (xfs_off_t)iblock << inode->i_blkbits; |
| @@ -1462,22 +1492,21 @@ __xfs_get_blocks( | |||
| 1462 | return 0; | 1492 | return 0; |
| 1463 | 1493 | ||
| 1464 | error = xfs_iomap(XFS_I(inode), offset, size, | 1494 | error = xfs_iomap(XFS_I(inode), offset, size, |
| 1465 | create ? flags : BMAPI_READ, &iomap, &niomap); | 1495 | create ? flags : BMAPI_READ, &imap, &nimap, &new); |
| 1466 | if (error) | 1496 | if (error) |
| 1467 | return -error; | 1497 | return -error; |
| 1468 | if (niomap == 0) | 1498 | if (nimap == 0) |
| 1469 | return 0; | 1499 | return 0; |
| 1470 | 1500 | ||
| 1471 | if (iomap.iomap_bn != IOMAP_DADDR_NULL) { | 1501 | if (imap.br_startblock != HOLESTARTBLOCK && |
| 1502 | imap.br_startblock != DELAYSTARTBLOCK) { | ||
| 1472 | /* | 1503 | /* |
| 1473 | * For unwritten extents do not report a disk address on | 1504 | * For unwritten extents do not report a disk address on |
| 1474 | * the read case (treat as if we're reading into a hole). | 1505 | * the read case (treat as if we're reading into a hole). |
| 1475 | */ | 1506 | */ |
| 1476 | if (create || !(iomap.iomap_flags & IOMAP_UNWRITTEN)) { | 1507 | if (create || !ISUNWRITTEN(&imap)) |
| 1477 | xfs_map_buffer(bh_result, &iomap, offset, | 1508 | xfs_map_buffer(inode, bh_result, &imap, offset); |
| 1478 | inode->i_blkbits); | 1509 | if (create && ISUNWRITTEN(&imap)) { |
| 1479 | } | ||
| 1480 | if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) { | ||
| 1481 | if (direct) | 1510 | if (direct) |
| 1482 | bh_result->b_private = inode; | 1511 | bh_result->b_private = inode; |
| 1483 | set_buffer_unwritten(bh_result); | 1512 | set_buffer_unwritten(bh_result); |
| @@ -1488,7 +1517,7 @@ __xfs_get_blocks( | |||
| 1488 | * If this is a realtime file, data may be on a different device. | 1517 | * If this is a realtime file, data may be on a different device. |
| 1489 | * to that pointed to from the buffer_head b_bdev currently. | 1518 | * to that pointed to from the buffer_head b_bdev currently. |
| 1490 | */ | 1519 | */ |
| 1491 | bh_result->b_bdev = iomap.iomap_target->bt_bdev; | 1520 | bh_result->b_bdev = xfs_find_bdev_for_inode(inode); |
| 1492 | 1521 | ||
| 1493 | /* | 1522 | /* |
| 1494 | * If we previously allocated a block out beyond eof and we are now | 1523 | * If we previously allocated a block out beyond eof and we are now |
| @@ -1502,10 +1531,10 @@ __xfs_get_blocks( | |||
| 1502 | if (create && | 1531 | if (create && |
| 1503 | ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) || | 1532 | ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) || |
| 1504 | (offset >= i_size_read(inode)) || | 1533 | (offset >= i_size_read(inode)) || |
| 1505 | (iomap.iomap_flags & (IOMAP_NEW|IOMAP_UNWRITTEN)))) | 1534 | (new || ISUNWRITTEN(&imap)))) |
| 1506 | set_buffer_new(bh_result); | 1535 | set_buffer_new(bh_result); |
| 1507 | 1536 | ||
| 1508 | if (iomap.iomap_flags & IOMAP_DELAY) { | 1537 | if (imap.br_startblock == DELAYSTARTBLOCK) { |
| 1509 | BUG_ON(direct); | 1538 | BUG_ON(direct); |
| 1510 | if (create) { | 1539 | if (create) { |
| 1511 | set_buffer_uptodate(bh_result); | 1540 | set_buffer_uptodate(bh_result); |
| @@ -1514,11 +1543,23 @@ __xfs_get_blocks( | |||
| 1514 | } | 1543 | } |
| 1515 | } | 1544 | } |
| 1516 | 1545 | ||
| 1546 | /* | ||
| 1547 | * If this is O_DIRECT or the mpage code calling tell them how large | ||
| 1548 | * the mapping is, so that we can avoid repeated get_blocks calls. | ||
| 1549 | */ | ||
| 1517 | if (direct || size > (1 << inode->i_blkbits)) { | 1550 | if (direct || size > (1 << inode->i_blkbits)) { |
| 1518 | ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0); | 1551 | xfs_off_t mapping_size; |
| 1519 | offset = min_t(xfs_off_t, | 1552 | |
| 1520 | iomap.iomap_bsize - iomap.iomap_delta, size); | 1553 | mapping_size = imap.br_startoff + imap.br_blockcount - iblock; |
| 1521 | bh_result->b_size = (ssize_t)min_t(xfs_off_t, LONG_MAX, offset); | 1554 | mapping_size <<= inode->i_blkbits; |
| 1555 | |||
| 1556 | ASSERT(mapping_size > 0); | ||
| 1557 | if (mapping_size > size) | ||
| 1558 | mapping_size = size; | ||
| 1559 | if (mapping_size > LONG_MAX) | ||
| 1560 | mapping_size = LONG_MAX; | ||
| 1561 | |||
| 1562 | bh_result->b_size = mapping_size; | ||
| 1522 | } | 1563 | } |
| 1523 | 1564 | ||
| 1524 | return 0; | 1565 | return 0; |
| @@ -1576,7 +1617,7 @@ xfs_end_io_direct( | |||
| 1576 | */ | 1617 | */ |
| 1577 | ioend->io_offset = offset; | 1618 | ioend->io_offset = offset; |
| 1578 | ioend->io_size = size; | 1619 | ioend->io_size = size; |
| 1579 | if (ioend->io_type == IOMAP_READ) { | 1620 | if (ioend->io_type == IO_READ) { |
| 1580 | xfs_finish_ioend(ioend, 0); | 1621 | xfs_finish_ioend(ioend, 0); |
| 1581 | } else if (private && size > 0) { | 1622 | } else if (private && size > 0) { |
| 1582 | xfs_finish_ioend(ioend, is_sync_kiocb(iocb)); | 1623 | xfs_finish_ioend(ioend, is_sync_kiocb(iocb)); |
| @@ -1587,7 +1628,7 @@ xfs_end_io_direct( | |||
| 1587 | * didn't map an unwritten extent so switch it's completion | 1628 | * didn't map an unwritten extent so switch it's completion |
| 1588 | * handler. | 1629 | * handler. |
| 1589 | */ | 1630 | */ |
| 1590 | ioend->io_type = IOMAP_NEW; | 1631 | ioend->io_type = IO_NEW; |
| 1591 | xfs_finish_ioend(ioend, 0); | 1632 | xfs_finish_ioend(ioend, 0); |
| 1592 | } | 1633 | } |
| 1593 | 1634 | ||
| @@ -1612,10 +1653,10 @@ xfs_vm_direct_IO( | |||
| 1612 | struct block_device *bdev; | 1653 | struct block_device *bdev; |
| 1613 | ssize_t ret; | 1654 | ssize_t ret; |
| 1614 | 1655 | ||
| 1615 | bdev = xfs_find_bdev_for_inode(XFS_I(inode)); | 1656 | bdev = xfs_find_bdev_for_inode(inode); |
| 1616 | 1657 | ||
| 1617 | iocb->private = xfs_alloc_ioend(inode, rw == WRITE ? | 1658 | iocb->private = xfs_alloc_ioend(inode, rw == WRITE ? |
| 1618 | IOMAP_UNWRITTEN : IOMAP_READ); | 1659 | IO_UNWRITTEN : IO_READ); |
| 1619 | 1660 | ||
| 1620 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, bdev, iov, | 1661 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, bdev, iov, |
| 1621 | offset, nr_segs, | 1662 | offset, nr_segs, |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 44c2b0ef9a41..f01de3c55c43 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
| @@ -1007,25 +1007,20 @@ xfs_bwrite( | |||
| 1007 | struct xfs_mount *mp, | 1007 | struct xfs_mount *mp, |
| 1008 | struct xfs_buf *bp) | 1008 | struct xfs_buf *bp) |
| 1009 | { | 1009 | { |
| 1010 | int iowait = (bp->b_flags & XBF_ASYNC) == 0; | 1010 | int error; |
| 1011 | int error = 0; | ||
| 1012 | 1011 | ||
| 1013 | bp->b_strat = xfs_bdstrat_cb; | 1012 | bp->b_strat = xfs_bdstrat_cb; |
| 1014 | bp->b_mount = mp; | 1013 | bp->b_mount = mp; |
| 1015 | bp->b_flags |= XBF_WRITE; | 1014 | bp->b_flags |= XBF_WRITE; |
| 1016 | if (!iowait) | 1015 | bp->b_flags &= ~(XBF_ASYNC | XBF_READ); |
| 1017 | bp->b_flags |= _XBF_RUN_QUEUES; | ||
| 1018 | 1016 | ||
| 1019 | xfs_buf_delwri_dequeue(bp); | 1017 | xfs_buf_delwri_dequeue(bp); |
| 1020 | xfs_buf_iostrategy(bp); | 1018 | xfs_buf_iostrategy(bp); |
| 1021 | 1019 | ||
| 1022 | if (iowait) { | 1020 | error = xfs_buf_iowait(bp); |
| 1023 | error = xfs_buf_iowait(bp); | 1021 | if (error) |
| 1024 | if (error) | 1022 | xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); |
| 1025 | xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); | 1023 | xfs_buf_relse(bp); |
| 1026 | xfs_buf_relse(bp); | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | return error; | 1024 | return error; |
| 1030 | } | 1025 | } |
| 1031 | 1026 | ||
| @@ -1614,7 +1609,8 @@ xfs_mapping_buftarg( | |||
| 1614 | 1609 | ||
| 1615 | STATIC int | 1610 | STATIC int |
| 1616 | xfs_alloc_delwrite_queue( | 1611 | xfs_alloc_delwrite_queue( |
| 1617 | xfs_buftarg_t *btp) | 1612 | xfs_buftarg_t *btp, |
| 1613 | const char *fsname) | ||
| 1618 | { | 1614 | { |
| 1619 | int error = 0; | 1615 | int error = 0; |
| 1620 | 1616 | ||
| @@ -1622,7 +1618,7 @@ xfs_alloc_delwrite_queue( | |||
| 1622 | INIT_LIST_HEAD(&btp->bt_delwrite_queue); | 1618 | INIT_LIST_HEAD(&btp->bt_delwrite_queue); |
| 1623 | spin_lock_init(&btp->bt_delwrite_lock); | 1619 | spin_lock_init(&btp->bt_delwrite_lock); |
| 1624 | btp->bt_flags = 0; | 1620 | btp->bt_flags = 0; |
| 1625 | btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd"); | 1621 | btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd/%s", fsname); |
| 1626 | if (IS_ERR(btp->bt_task)) { | 1622 | if (IS_ERR(btp->bt_task)) { |
| 1627 | error = PTR_ERR(btp->bt_task); | 1623 | error = PTR_ERR(btp->bt_task); |
| 1628 | goto out_error; | 1624 | goto out_error; |
| @@ -1635,7 +1631,8 @@ out_error: | |||
| 1635 | xfs_buftarg_t * | 1631 | xfs_buftarg_t * |
| 1636 | xfs_alloc_buftarg( | 1632 | xfs_alloc_buftarg( |
| 1637 | struct block_device *bdev, | 1633 | struct block_device *bdev, |
| 1638 | int external) | 1634 | int external, |
| 1635 | const char *fsname) | ||
| 1639 | { | 1636 | { |
| 1640 | xfs_buftarg_t *btp; | 1637 | xfs_buftarg_t *btp; |
| 1641 | 1638 | ||
| @@ -1647,7 +1644,7 @@ xfs_alloc_buftarg( | |||
| 1647 | goto error; | 1644 | goto error; |
| 1648 | if (xfs_mapping_buftarg(btp, bdev)) | 1645 | if (xfs_mapping_buftarg(btp, bdev)) |
| 1649 | goto error; | 1646 | goto error; |
| 1650 | if (xfs_alloc_delwrite_queue(btp)) | 1647 | if (xfs_alloc_delwrite_queue(btp, fsname)) |
| 1651 | goto error; | 1648 | goto error; |
| 1652 | xfs_alloc_bufhash(btp, external); | 1649 | xfs_alloc_bufhash(btp, external); |
| 1653 | return btp; | 1650 | return btp; |
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 386e7361e50e..5fbecefa5dfd 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
| @@ -390,7 +390,7 @@ static inline void xfs_buf_relse(xfs_buf_t *bp) | |||
| 390 | /* | 390 | /* |
| 391 | * Handling of buftargs. | 391 | * Handling of buftargs. |
| 392 | */ | 392 | */ |
| 393 | extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int); | 393 | extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int, const char *); |
| 394 | extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *); | 394 | extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *); |
| 395 | extern void xfs_wait_buftarg(xfs_buftarg_t *); | 395 | extern void xfs_wait_buftarg(xfs_buftarg_t *); |
| 396 | extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int); | 396 | extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int); |
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 42dd3bcfba6b..d8fb1b5d6cb5 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
| @@ -115,6 +115,8 @@ xfs_file_fsync( | |||
| 115 | 115 | ||
| 116 | xfs_iflags_clear(ip, XFS_ITRUNCATED); | 116 | xfs_iflags_clear(ip, XFS_ITRUNCATED); |
| 117 | 117 | ||
| 118 | xfs_ioend_wait(ip); | ||
| 119 | |||
| 118 | /* | 120 | /* |
| 119 | * We always need to make sure that the required inode state is safe on | 121 | * We always need to make sure that the required inode state is safe on |
| 120 | * disk. The inode might be clean but we still might need to force the | 122 | * disk. The inode might be clean but we still might need to force the |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index 7b26cc2fd284..699b60cbab9c 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
| @@ -527,6 +527,10 @@ xfs_attrmulti_by_handle( | |||
| 527 | if (copy_from_user(&am_hreq, arg, sizeof(xfs_fsop_attrmulti_handlereq_t))) | 527 | if (copy_from_user(&am_hreq, arg, sizeof(xfs_fsop_attrmulti_handlereq_t))) |
| 528 | return -XFS_ERROR(EFAULT); | 528 | return -XFS_ERROR(EFAULT); |
| 529 | 529 | ||
| 530 | /* overflow check */ | ||
| 531 | if (am_hreq.opcount >= INT_MAX / sizeof(xfs_attr_multiop_t)) | ||
| 532 | return -E2BIG; | ||
| 533 | |||
| 530 | dentry = xfs_handlereq_to_dentry(parfilp, &am_hreq.hreq); | 534 | dentry = xfs_handlereq_to_dentry(parfilp, &am_hreq.hreq); |
| 531 | if (IS_ERR(dentry)) | 535 | if (IS_ERR(dentry)) |
| 532 | return PTR_ERR(dentry); | 536 | return PTR_ERR(dentry); |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index 593c05b4df8d..9287135e9bfc 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
| @@ -420,6 +420,10 @@ xfs_compat_attrmulti_by_handle( | |||
| 420 | sizeof(compat_xfs_fsop_attrmulti_handlereq_t))) | 420 | sizeof(compat_xfs_fsop_attrmulti_handlereq_t))) |
| 421 | return -XFS_ERROR(EFAULT); | 421 | return -XFS_ERROR(EFAULT); |
| 422 | 422 | ||
| 423 | /* overflow check */ | ||
| 424 | if (am_hreq.opcount >= INT_MAX / sizeof(compat_xfs_attr_multiop_t)) | ||
| 425 | return -E2BIG; | ||
| 426 | |||
| 423 | dentry = xfs_compat_handlereq_to_dentry(parfilp, &am_hreq.hreq); | 427 | dentry = xfs_compat_handlereq_to_dentry(parfilp, &am_hreq.hreq); |
| 424 | if (IS_ERR(dentry)) | 428 | if (IS_ERR(dentry)) |
| 425 | return PTR_ERR(dentry); | 429 | return PTR_ERR(dentry); |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index e65a7937f3a4..9c8019c78c92 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
| @@ -673,7 +673,10 @@ xfs_vn_fiemap( | |||
| 673 | bm.bmv_length = BTOBB(length); | 673 | bm.bmv_length = BTOBB(length); |
| 674 | 674 | ||
| 675 | /* We add one because in getbmap world count includes the header */ | 675 | /* We add one because in getbmap world count includes the header */ |
| 676 | bm.bmv_count = fieinfo->fi_extents_max + 1; | 676 | bm.bmv_count = !fieinfo->fi_extents_max ? MAXEXTNUM : |
| 677 | fieinfo->fi_extents_max + 1; | ||
| 678 | bm.bmv_count = min_t(__s32, bm.bmv_count, | ||
| 679 | (PAGE_SIZE * 16 / sizeof(struct getbmapx))); | ||
| 677 | bm.bmv_iflags = BMV_IF_PREALLOC; | 680 | bm.bmv_iflags = BMV_IF_PREALLOC; |
| 678 | if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) | 681 | if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) |
| 679 | bm.bmv_iflags |= BMV_IF_ATTRFORK; | 682 | bm.bmv_iflags |= BMV_IF_ATTRFORK; |
diff --git a/fs/xfs/linux-2.6/xfs_quotaops.c b/fs/xfs/linux-2.6/xfs_quotaops.c index 1947514ce1ad..e31bf21fe5d3 100644 --- a/fs/xfs/linux-2.6/xfs_quotaops.c +++ b/fs/xfs/linux-2.6/xfs_quotaops.c | |||
| @@ -97,7 +97,7 @@ xfs_fs_set_xstate( | |||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | STATIC int | 99 | STATIC int |
| 100 | xfs_fs_get_xquota( | 100 | xfs_fs_get_dqblk( |
| 101 | struct super_block *sb, | 101 | struct super_block *sb, |
| 102 | int type, | 102 | int type, |
| 103 | qid_t id, | 103 | qid_t id, |
| @@ -114,7 +114,7 @@ xfs_fs_get_xquota( | |||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | STATIC int | 116 | STATIC int |
| 117 | xfs_fs_set_xquota( | 117 | xfs_fs_set_dqblk( |
| 118 | struct super_block *sb, | 118 | struct super_block *sb, |
| 119 | int type, | 119 | int type, |
| 120 | qid_t id, | 120 | qid_t id, |
| @@ -135,6 +135,6 @@ xfs_fs_set_xquota( | |||
| 135 | const struct quotactl_ops xfs_quotactl_operations = { | 135 | const struct quotactl_ops xfs_quotactl_operations = { |
| 136 | .get_xstate = xfs_fs_get_xstate, | 136 | .get_xstate = xfs_fs_get_xstate, |
| 137 | .set_xstate = xfs_fs_set_xstate, | 137 | .set_xstate = xfs_fs_set_xstate, |
| 138 | .get_xquota = xfs_fs_get_xquota, | 138 | .get_dqblk = xfs_fs_get_dqblk, |
| 139 | .set_xquota = xfs_fs_set_xquota, | 139 | .set_dqblk = xfs_fs_set_dqblk, |
| 140 | }; | 140 | }; |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 29f1edca76de..f24dbe5efde3 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
| @@ -725,7 +725,8 @@ void | |||
| 725 | xfs_blkdev_issue_flush( | 725 | xfs_blkdev_issue_flush( |
| 726 | xfs_buftarg_t *buftarg) | 726 | xfs_buftarg_t *buftarg) |
| 727 | { | 727 | { |
| 728 | blkdev_issue_flush(buftarg->bt_bdev, NULL); | 728 | blkdev_issue_flush(buftarg->bt_bdev, GFP_KERNEL, NULL, |
| 729 | BLKDEV_IFL_WAIT); | ||
| 729 | } | 730 | } |
| 730 | 731 | ||
| 731 | STATIC void | 732 | STATIC void |
| @@ -789,18 +790,18 @@ xfs_open_devices( | |||
| 789 | * Setup xfs_mount buffer target pointers | 790 | * Setup xfs_mount buffer target pointers |
| 790 | */ | 791 | */ |
| 791 | error = ENOMEM; | 792 | error = ENOMEM; |
| 792 | mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0); | 793 | mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0, mp->m_fsname); |
| 793 | if (!mp->m_ddev_targp) | 794 | if (!mp->m_ddev_targp) |
| 794 | goto out_close_rtdev; | 795 | goto out_close_rtdev; |
| 795 | 796 | ||
| 796 | if (rtdev) { | 797 | if (rtdev) { |
| 797 | mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1); | 798 | mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1, mp->m_fsname); |
| 798 | if (!mp->m_rtdev_targp) | 799 | if (!mp->m_rtdev_targp) |
| 799 | goto out_free_ddev_targ; | 800 | goto out_free_ddev_targ; |
| 800 | } | 801 | } |
| 801 | 802 | ||
| 802 | if (logdev && logdev != ddev) { | 803 | if (logdev && logdev != ddev) { |
| 803 | mp->m_logdev_targp = xfs_alloc_buftarg(logdev, 1); | 804 | mp->m_logdev_targp = xfs_alloc_buftarg(logdev, 1, mp->m_fsname); |
| 804 | if (!mp->m_logdev_targp) | 805 | if (!mp->m_logdev_targp) |
| 805 | goto out_free_rtdev_targ; | 806 | goto out_free_rtdev_targ; |
| 806 | } else { | 807 | } else { |
| @@ -902,7 +903,8 @@ xfsaild_start( | |||
| 902 | struct xfs_ail *ailp) | 903 | struct xfs_ail *ailp) |
| 903 | { | 904 | { |
| 904 | ailp->xa_target = 0; | 905 | ailp->xa_target = 0; |
| 905 | ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild"); | 906 | ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s", |
| 907 | ailp->xa_mount->m_fsname); | ||
| 906 | if (IS_ERR(ailp->xa_task)) | 908 | if (IS_ERR(ailp->xa_task)) |
| 907 | return -PTR_ERR(ailp->xa_task); | 909 | return -PTR_ERR(ailp->xa_task); |
| 908 | return 0; | 910 | return 0; |
| @@ -1092,6 +1094,7 @@ xfs_fs_write_inode( | |||
| 1092 | * the code will only flush the inode if it isn't already | 1094 | * the code will only flush the inode if it isn't already |
| 1093 | * being flushed. | 1095 | * being flushed. |
| 1094 | */ | 1096 | */ |
| 1097 | xfs_ioend_wait(ip); | ||
| 1095 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 1098 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
| 1096 | if (ip->i_update_core) { | 1099 | if (ip->i_update_core) { |
| 1097 | error = xfs_log_inode(ip); | 1100 | error = xfs_log_inode(ip); |
diff --git a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/linux-2.6/xfs_super.h index 233d4b9881b1..519618e9279e 100644 --- a/fs/xfs/linux-2.6/xfs_super.h +++ b/fs/xfs/linux-2.6/xfs_super.h | |||
| @@ -85,7 +85,7 @@ extern __uint64_t xfs_max_file_offset(unsigned int); | |||
| 85 | extern void xfs_blkdev_issue_flush(struct xfs_buftarg *); | 85 | extern void xfs_blkdev_issue_flush(struct xfs_buftarg *); |
| 86 | 86 | ||
| 87 | extern const struct export_operations xfs_export_operations; | 87 | extern const struct export_operations xfs_export_operations; |
| 88 | extern struct xattr_handler *xfs_xattr_handlers[]; | 88 | extern const struct xattr_handler *xfs_xattr_handlers[]; |
| 89 | extern const struct quotactl_ops xfs_quotactl_operations; | 89 | extern const struct quotactl_ops xfs_quotactl_operations; |
| 90 | 90 | ||
| 91 | #define XFS_M(sb) ((struct xfs_mount *)((sb)->s_fs_info)) | 91 | #define XFS_M(sb) ((struct xfs_mount *)((sb)->s_fs_info)) |
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index a427c638d909..3884e20bc14e 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
| @@ -356,68 +356,23 @@ xfs_commit_dummy_trans( | |||
| 356 | 356 | ||
| 357 | STATIC int | 357 | STATIC int |
| 358 | xfs_sync_fsdata( | 358 | xfs_sync_fsdata( |
| 359 | struct xfs_mount *mp, | 359 | struct xfs_mount *mp) |
| 360 | int flags) | ||
| 361 | { | 360 | { |
| 362 | struct xfs_buf *bp; | 361 | struct xfs_buf *bp; |
| 363 | struct xfs_buf_log_item *bip; | ||
| 364 | int error = 0; | ||
| 365 | 362 | ||
| 366 | /* | 363 | /* |
| 367 | * If this is xfssyncd() then only sync the superblock if we can | 364 | * If the buffer is pinned then push on the log so we won't get stuck |
| 368 | * lock it without sleeping and it is not pinned. | 365 | * waiting in the write for someone, maybe ourselves, to flush the log. |
| 366 | * | ||
| 367 | * Even though we just pushed the log above, we did not have the | ||
| 368 | * superblock buffer locked at that point so it can become pinned in | ||
| 369 | * between there and here. | ||
| 369 | */ | 370 | */ |
| 370 | if (flags & SYNC_TRYLOCK) { | 371 | bp = xfs_getsb(mp, 0); |
| 371 | ASSERT(!(flags & SYNC_WAIT)); | 372 | if (XFS_BUF_ISPINNED(bp)) |
| 372 | 373 | xfs_log_force(mp, 0); | |
| 373 | bp = xfs_getsb(mp, XBF_TRYLOCK); | ||
| 374 | if (!bp) | ||
| 375 | goto out; | ||
| 376 | |||
| 377 | bip = XFS_BUF_FSPRIVATE(bp, struct xfs_buf_log_item *); | ||
| 378 | if (!bip || !xfs_buf_item_dirty(bip) || XFS_BUF_ISPINNED(bp)) | ||
| 379 | goto out_brelse; | ||
| 380 | } else { | ||
| 381 | bp = xfs_getsb(mp, 0); | ||
| 382 | |||
| 383 | /* | ||
| 384 | * If the buffer is pinned then push on the log so we won't | ||
| 385 | * get stuck waiting in the write for someone, maybe | ||
| 386 | * ourselves, to flush the log. | ||
| 387 | * | ||
| 388 | * Even though we just pushed the log above, we did not have | ||
| 389 | * the superblock buffer locked at that point so it can | ||
| 390 | * become pinned in between there and here. | ||
| 391 | */ | ||
| 392 | if (XFS_BUF_ISPINNED(bp)) | ||
| 393 | xfs_log_force(mp, 0); | ||
| 394 | } | ||
| 395 | |||
| 396 | |||
| 397 | if (flags & SYNC_WAIT) | ||
| 398 | XFS_BUF_UNASYNC(bp); | ||
| 399 | else | ||
| 400 | XFS_BUF_ASYNC(bp); | ||
| 401 | |||
| 402 | error = xfs_bwrite(mp, bp); | ||
| 403 | if (error) | ||
| 404 | return error; | ||
| 405 | |||
| 406 | /* | ||
| 407 | * If this is a data integrity sync make sure all pending buffers | ||
| 408 | * are flushed out for the log coverage check below. | ||
| 409 | */ | ||
| 410 | if (flags & SYNC_WAIT) | ||
| 411 | xfs_flush_buftarg(mp->m_ddev_targp, 1); | ||
| 412 | |||
| 413 | if (xfs_log_need_covered(mp)) | ||
| 414 | error = xfs_commit_dummy_trans(mp, flags); | ||
| 415 | return error; | ||
| 416 | 374 | ||
| 417 | out_brelse: | 375 | return xfs_bwrite(mp, bp); |
| 418 | xfs_buf_relse(bp); | ||
| 419 | out: | ||
| 420 | return error; | ||
| 421 | } | 376 | } |
| 422 | 377 | ||
| 423 | /* | 378 | /* |
| @@ -441,7 +396,7 @@ int | |||
| 441 | xfs_quiesce_data( | 396 | xfs_quiesce_data( |
| 442 | struct xfs_mount *mp) | 397 | struct xfs_mount *mp) |
| 443 | { | 398 | { |
| 444 | int error; | 399 | int error, error2 = 0; |
| 445 | 400 | ||
| 446 | /* push non-blocking */ | 401 | /* push non-blocking */ |
| 447 | xfs_sync_data(mp, 0); | 402 | xfs_sync_data(mp, 0); |
| @@ -452,13 +407,20 @@ xfs_quiesce_data( | |||
| 452 | xfs_qm_sync(mp, SYNC_WAIT); | 407 | xfs_qm_sync(mp, SYNC_WAIT); |
| 453 | 408 | ||
| 454 | /* write superblock and hoover up shutdown errors */ | 409 | /* write superblock and hoover up shutdown errors */ |
| 455 | error = xfs_sync_fsdata(mp, SYNC_WAIT); | 410 | error = xfs_sync_fsdata(mp); |
| 411 | |||
| 412 | /* make sure all delwri buffers are written out */ | ||
| 413 | xfs_flush_buftarg(mp->m_ddev_targp, 1); | ||
| 414 | |||
| 415 | /* mark the log as covered if needed */ | ||
| 416 | if (xfs_log_need_covered(mp)) | ||
| 417 | error2 = xfs_commit_dummy_trans(mp, SYNC_WAIT); | ||
| 456 | 418 | ||
| 457 | /* flush data-only devices */ | 419 | /* flush data-only devices */ |
| 458 | if (mp->m_rtdev_targp) | 420 | if (mp->m_rtdev_targp) |
| 459 | XFS_bflush(mp->m_rtdev_targp); | 421 | XFS_bflush(mp->m_rtdev_targp); |
| 460 | 422 | ||
| 461 | return error; | 423 | return error ? error : error2; |
| 462 | } | 424 | } |
| 463 | 425 | ||
| 464 | STATIC void | 426 | STATIC void |
| @@ -581,9 +543,9 @@ xfs_flush_inodes( | |||
| 581 | } | 543 | } |
| 582 | 544 | ||
| 583 | /* | 545 | /* |
| 584 | * Every sync period we need to unpin all items, reclaim inodes, sync | 546 | * Every sync period we need to unpin all items, reclaim inodes and sync |
| 585 | * quota and write out the superblock. We might need to cover the log | 547 | * disk quotas. We might need to cover the log to indicate that the |
| 586 | * to indicate it is idle. | 548 | * filesystem is idle. |
| 587 | */ | 549 | */ |
| 588 | STATIC void | 550 | STATIC void |
| 589 | xfs_sync_worker( | 551 | xfs_sync_worker( |
| @@ -597,7 +559,8 @@ xfs_sync_worker( | |||
| 597 | xfs_reclaim_inodes(mp, 0); | 559 | xfs_reclaim_inodes(mp, 0); |
| 598 | /* dgc: errors ignored here */ | 560 | /* dgc: errors ignored here */ |
| 599 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); | 561 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); |
| 600 | error = xfs_sync_fsdata(mp, SYNC_TRYLOCK); | 562 | if (xfs_log_need_covered(mp)) |
| 563 | error = xfs_commit_dummy_trans(mp, 0); | ||
| 601 | } | 564 | } |
| 602 | mp->m_sync_seq++; | 565 | mp->m_sync_seq++; |
| 603 | wake_up(&mp->m_wait_single_sync_task); | 566 | wake_up(&mp->m_wait_single_sync_task); |
| @@ -660,7 +623,7 @@ xfs_syncd_init( | |||
| 660 | mp->m_sync_work.w_syncer = xfs_sync_worker; | 623 | mp->m_sync_work.w_syncer = xfs_sync_worker; |
| 661 | mp->m_sync_work.w_mount = mp; | 624 | mp->m_sync_work.w_mount = mp; |
| 662 | mp->m_sync_work.w_completion = NULL; | 625 | mp->m_sync_work.w_completion = NULL; |
| 663 | mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd"); | 626 | mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd/%s", mp->m_fsname); |
| 664 | if (IS_ERR(mp->m_sync_task)) | 627 | if (IS_ERR(mp->m_sync_task)) |
| 665 | return -PTR_ERR(mp->m_sync_task); | 628 | return -PTR_ERR(mp->m_sync_task); |
| 666 | return 0; | 629 | return 0; |
diff --git a/fs/xfs/linux-2.6/xfs_trace.c b/fs/xfs/linux-2.6/xfs_trace.c index 5a107601e969..207fa77f63ae 100644 --- a/fs/xfs/linux-2.6/xfs_trace.c +++ b/fs/xfs/linux-2.6/xfs_trace.c | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | #include "xfs_alloc.h" | 41 | #include "xfs_alloc.h" |
| 42 | #include "xfs_bmap.h" | 42 | #include "xfs_bmap.h" |
| 43 | #include "xfs_attr.h" | 43 | #include "xfs_attr.h" |
| 44 | #include "xfs_attr_sf.h" | ||
| 45 | #include "xfs_attr_leaf.h" | 44 | #include "xfs_attr_leaf.h" |
| 46 | #include "xfs_log_priv.h" | 45 | #include "xfs_log_priv.h" |
| 47 | #include "xfs_buf_item.h" | 46 | #include "xfs_buf_item.h" |
| @@ -50,6 +49,9 @@ | |||
| 50 | #include "xfs_aops.h" | 49 | #include "xfs_aops.h" |
| 51 | #include "quota/xfs_dquot_item.h" | 50 | #include "quota/xfs_dquot_item.h" |
| 52 | #include "quota/xfs_dquot.h" | 51 | #include "quota/xfs_dquot.h" |
| 52 | #include "xfs_log_recover.h" | ||
| 53 | #include "xfs_buf_item.h" | ||
| 54 | #include "xfs_inode_item.h" | ||
| 53 | 55 | ||
| 54 | /* | 56 | /* |
| 55 | * We include this last to have the helpers above available for the trace | 57 | * We include this last to have the helpers above available for the trace |
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h index fcaa62f0799e..8a319cfd2901 100644 --- a/fs/xfs/linux-2.6/xfs_trace.h +++ b/fs/xfs/linux-2.6/xfs_trace.h | |||
| @@ -32,6 +32,10 @@ struct xfs_da_node_entry; | |||
| 32 | struct xfs_dquot; | 32 | struct xfs_dquot; |
| 33 | struct xlog_ticket; | 33 | struct xlog_ticket; |
| 34 | struct log; | 34 | struct log; |
| 35 | struct xlog_recover; | ||
| 36 | struct xlog_recover_item; | ||
| 37 | struct xfs_buf_log_format; | ||
| 38 | struct xfs_inode_log_format; | ||
| 35 | 39 | ||
| 36 | DECLARE_EVENT_CLASS(xfs_attr_list_class, | 40 | DECLARE_EVENT_CLASS(xfs_attr_list_class, |
| 37 | TP_PROTO(struct xfs_attr_list_context *ctx), | 41 | TP_PROTO(struct xfs_attr_list_context *ctx), |
| @@ -562,18 +566,21 @@ DECLARE_EVENT_CLASS(xfs_inode_class, | |||
| 562 | __field(dev_t, dev) | 566 | __field(dev_t, dev) |
| 563 | __field(xfs_ino_t, ino) | 567 | __field(xfs_ino_t, ino) |
| 564 | __field(int, count) | 568 | __field(int, count) |
| 569 | __field(int, pincount) | ||
| 565 | __field(unsigned long, caller_ip) | 570 | __field(unsigned long, caller_ip) |
| 566 | ), | 571 | ), |
| 567 | TP_fast_assign( | 572 | TP_fast_assign( |
| 568 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | 573 | __entry->dev = VFS_I(ip)->i_sb->s_dev; |
| 569 | __entry->ino = ip->i_ino; | 574 | __entry->ino = ip->i_ino; |
| 570 | __entry->count = atomic_read(&VFS_I(ip)->i_count); | 575 | __entry->count = atomic_read(&VFS_I(ip)->i_count); |
| 576 | __entry->pincount = atomic_read(&ip->i_pincount); | ||
| 571 | __entry->caller_ip = caller_ip; | 577 | __entry->caller_ip = caller_ip; |
| 572 | ), | 578 | ), |
| 573 | TP_printk("dev %d:%d ino 0x%llx count %d caller %pf", | 579 | TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf", |
| 574 | MAJOR(__entry->dev), MINOR(__entry->dev), | 580 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 575 | __entry->ino, | 581 | __entry->ino, |
| 576 | __entry->count, | 582 | __entry->count, |
| 583 | __entry->pincount, | ||
| 577 | (char *)__entry->caller_ip) | 584 | (char *)__entry->caller_ip) |
| 578 | ) | 585 | ) |
| 579 | 586 | ||
| @@ -583,6 +590,10 @@ DEFINE_EVENT(xfs_inode_class, name, \ | |||
| 583 | TP_ARGS(ip, caller_ip)) | 590 | TP_ARGS(ip, caller_ip)) |
| 584 | DEFINE_INODE_EVENT(xfs_ihold); | 591 | DEFINE_INODE_EVENT(xfs_ihold); |
| 585 | DEFINE_INODE_EVENT(xfs_irele); | 592 | DEFINE_INODE_EVENT(xfs_irele); |
| 593 | DEFINE_INODE_EVENT(xfs_inode_pin); | ||
| 594 | DEFINE_INODE_EVENT(xfs_inode_unpin); | ||
| 595 | DEFINE_INODE_EVENT(xfs_inode_unpin_nowait); | ||
| 596 | |||
| 586 | /* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */ | 597 | /* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */ |
| 587 | DEFINE_INODE_EVENT(xfs_inode); | 598 | DEFINE_INODE_EVENT(xfs_inode); |
| 588 | #define xfs_itrace_entry(ip) \ | 599 | #define xfs_itrace_entry(ip) \ |
| @@ -642,8 +653,6 @@ DEFINE_EVENT(xfs_dquot_class, name, \ | |||
| 642 | TP_PROTO(struct xfs_dquot *dqp), \ | 653 | TP_PROTO(struct xfs_dquot *dqp), \ |
| 643 | TP_ARGS(dqp)) | 654 | TP_ARGS(dqp)) |
| 644 | DEFINE_DQUOT_EVENT(xfs_dqadjust); | 655 | DEFINE_DQUOT_EVENT(xfs_dqadjust); |
| 645 | DEFINE_DQUOT_EVENT(xfs_dqshake_dirty); | ||
| 646 | DEFINE_DQUOT_EVENT(xfs_dqshake_unlink); | ||
| 647 | DEFINE_DQUOT_EVENT(xfs_dqreclaim_want); | 656 | DEFINE_DQUOT_EVENT(xfs_dqreclaim_want); |
| 648 | DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty); | 657 | DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty); |
| 649 | DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink); | 658 | DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink); |
| @@ -658,7 +667,6 @@ DEFINE_DQUOT_EVENT(xfs_dqread_fail); | |||
| 658 | DEFINE_DQUOT_EVENT(xfs_dqlookup_found); | 667 | DEFINE_DQUOT_EVENT(xfs_dqlookup_found); |
| 659 | DEFINE_DQUOT_EVENT(xfs_dqlookup_want); | 668 | DEFINE_DQUOT_EVENT(xfs_dqlookup_want); |
| 660 | DEFINE_DQUOT_EVENT(xfs_dqlookup_freelist); | 669 | DEFINE_DQUOT_EVENT(xfs_dqlookup_freelist); |
| 661 | DEFINE_DQUOT_EVENT(xfs_dqlookup_move); | ||
| 662 | DEFINE_DQUOT_EVENT(xfs_dqlookup_done); | 670 | DEFINE_DQUOT_EVENT(xfs_dqlookup_done); |
| 663 | DEFINE_DQUOT_EVENT(xfs_dqget_hit); | 671 | DEFINE_DQUOT_EVENT(xfs_dqget_hit); |
| 664 | DEFINE_DQUOT_EVENT(xfs_dqget_miss); | 672 | DEFINE_DQUOT_EVENT(xfs_dqget_miss); |
| @@ -1495,6 +1503,140 @@ DEFINE_EVENT(xfs_swap_extent_class, name, \ | |||
| 1495 | DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before); | 1503 | DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before); |
| 1496 | DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after); | 1504 | DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after); |
| 1497 | 1505 | ||
| 1506 | DECLARE_EVENT_CLASS(xfs_log_recover_item_class, | ||
| 1507 | TP_PROTO(struct log *log, struct xlog_recover *trans, | ||
| 1508 | struct xlog_recover_item *item, int pass), | ||
| 1509 | TP_ARGS(log, trans, item, pass), | ||
| 1510 | TP_STRUCT__entry( | ||
| 1511 | __field(dev_t, dev) | ||
| 1512 | __field(unsigned long, item) | ||
| 1513 | __field(xlog_tid_t, tid) | ||
| 1514 | __field(int, type) | ||
| 1515 | __field(int, pass) | ||
| 1516 | __field(int, count) | ||
| 1517 | __field(int, total) | ||
| 1518 | ), | ||
| 1519 | TP_fast_assign( | ||
| 1520 | __entry->dev = log->l_mp->m_super->s_dev; | ||
| 1521 | __entry->item = (unsigned long)item; | ||
| 1522 | __entry->tid = trans->r_log_tid; | ||
| 1523 | __entry->type = ITEM_TYPE(item); | ||
| 1524 | __entry->pass = pass; | ||
| 1525 | __entry->count = item->ri_cnt; | ||
| 1526 | __entry->total = item->ri_total; | ||
| 1527 | ), | ||
| 1528 | TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s " | ||
| 1529 | "item region count/total %d/%d", | ||
| 1530 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 1531 | __entry->tid, | ||
| 1532 | __entry->pass, | ||
| 1533 | (void *)__entry->item, | ||
| 1534 | __print_symbolic(__entry->type, XFS_LI_TYPE_DESC), | ||
| 1535 | __entry->count, | ||
| 1536 | __entry->total) | ||
| 1537 | ) | ||
| 1538 | |||
| 1539 | #define DEFINE_LOG_RECOVER_ITEM(name) \ | ||
| 1540 | DEFINE_EVENT(xfs_log_recover_item_class, name, \ | ||
| 1541 | TP_PROTO(struct log *log, struct xlog_recover *trans, \ | ||
| 1542 | struct xlog_recover_item *item, int pass), \ | ||
| 1543 | TP_ARGS(log, trans, item, pass)) | ||
| 1544 | |||
| 1545 | DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add); | ||
| 1546 | DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont); | ||
| 1547 | DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head); | ||
| 1548 | DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail); | ||
| 1549 | DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover); | ||
| 1550 | |||
| 1551 | DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class, | ||
| 1552 | TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), | ||
| 1553 | TP_ARGS(log, buf_f), | ||
| 1554 | TP_STRUCT__entry( | ||
| 1555 | __field(dev_t, dev) | ||
| 1556 | __field(__int64_t, blkno) | ||
| 1557 | __field(unsigned short, len) | ||
| 1558 | __field(unsigned short, flags) | ||
| 1559 | __field(unsigned short, size) | ||
| 1560 | __field(unsigned int, map_size) | ||
| 1561 | ), | ||
| 1562 | TP_fast_assign( | ||
| 1563 | __entry->dev = log->l_mp->m_super->s_dev; | ||
| 1564 | __entry->blkno = buf_f->blf_blkno; | ||
| 1565 | __entry->len = buf_f->blf_len; | ||
| 1566 | __entry->flags = buf_f->blf_flags; | ||
| 1567 | __entry->size = buf_f->blf_size; | ||
| 1568 | __entry->map_size = buf_f->blf_map_size; | ||
| 1569 | ), | ||
| 1570 | TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, " | ||
| 1571 | "map_size %d", | ||
| 1572 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 1573 | __entry->blkno, | ||
| 1574 | __entry->len, | ||
| 1575 | __entry->flags, | ||
| 1576 | __entry->size, | ||
| 1577 | __entry->map_size) | ||
| 1578 | ) | ||
| 1579 | |||
| 1580 | #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \ | ||
| 1581 | DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \ | ||
| 1582 | TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), \ | ||
| 1583 | TP_ARGS(log, buf_f)) | ||
| 1584 | |||
| 1585 | DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel); | ||
| 1586 | DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel); | ||
| 1587 | DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add); | ||
| 1588 | DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc); | ||
| 1589 | DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover); | ||
| 1590 | DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf); | ||
| 1591 | DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf); | ||
| 1592 | DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf); | ||
| 1593 | |||
| 1594 | DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class, | ||
| 1595 | TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), | ||
| 1596 | TP_ARGS(log, in_f), | ||
| 1597 | TP_STRUCT__entry( | ||
| 1598 | __field(dev_t, dev) | ||
| 1599 | __field(xfs_ino_t, ino) | ||
| 1600 | __field(unsigned short, size) | ||
| 1601 | __field(int, fields) | ||
| 1602 | __field(unsigned short, asize) | ||
| 1603 | __field(unsigned short, dsize) | ||
| 1604 | __field(__int64_t, blkno) | ||
| 1605 | __field(int, len) | ||
| 1606 | __field(int, boffset) | ||
| 1607 | ), | ||
| 1608 | TP_fast_assign( | ||
| 1609 | __entry->dev = log->l_mp->m_super->s_dev; | ||
| 1610 | __entry->ino = in_f->ilf_ino; | ||
| 1611 | __entry->size = in_f->ilf_size; | ||
| 1612 | __entry->fields = in_f->ilf_fields; | ||
| 1613 | __entry->asize = in_f->ilf_asize; | ||
| 1614 | __entry->dsize = in_f->ilf_dsize; | ||
| 1615 | __entry->blkno = in_f->ilf_blkno; | ||
| 1616 | __entry->len = in_f->ilf_len; | ||
| 1617 | __entry->boffset = in_f->ilf_boffset; | ||
| 1618 | ), | ||
| 1619 | TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, " | ||
| 1620 | "dsize %d, blkno 0x%llx, len %d, boffset %d", | ||
| 1621 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 1622 | __entry->ino, | ||
| 1623 | __entry->size, | ||
| 1624 | __entry->fields, | ||
| 1625 | __entry->asize, | ||
| 1626 | __entry->dsize, | ||
| 1627 | __entry->blkno, | ||
| 1628 | __entry->len, | ||
| 1629 | __entry->boffset) | ||
| 1630 | ) | ||
| 1631 | #define DEFINE_LOG_RECOVER_INO_ITEM(name) \ | ||
| 1632 | DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \ | ||
| 1633 | TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), \ | ||
| 1634 | TP_ARGS(log, in_f)) | ||
| 1635 | |||
| 1636 | DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover); | ||
| 1637 | DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel); | ||
| 1638 | DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip); | ||
| 1639 | |||
| 1498 | #endif /* _TRACE_XFS_H */ | 1640 | #endif /* _TRACE_XFS_H */ |
| 1499 | 1641 | ||
| 1500 | #undef TRACE_INCLUDE_PATH | 1642 | #undef TRACE_INCLUDE_PATH |
diff --git a/fs/xfs/linux-2.6/xfs_xattr.c b/fs/xfs/linux-2.6/xfs_xattr.c index fa01b9daba6b..87d3e03878c8 100644 --- a/fs/xfs/linux-2.6/xfs_xattr.c +++ b/fs/xfs/linux-2.6/xfs_xattr.c | |||
| @@ -72,28 +72,28 @@ xfs_xattr_set(struct dentry *dentry, const char *name, const void *value, | |||
| 72 | (void *)value, size, xflags); | 72 | (void *)value, size, xflags); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static struct xattr_handler xfs_xattr_user_handler = { | 75 | static const struct xattr_handler xfs_xattr_user_handler = { |
| 76 | .prefix = XATTR_USER_PREFIX, | 76 | .prefix = XATTR_USER_PREFIX, |
| 77 | .flags = 0, /* no flags implies user namespace */ | 77 | .flags = 0, /* no flags implies user namespace */ |
| 78 | .get = xfs_xattr_get, | 78 | .get = xfs_xattr_get, |
| 79 | .set = xfs_xattr_set, | 79 | .set = xfs_xattr_set, |
| 80 | }; | 80 | }; |
| 81 | 81 | ||
| 82 | static struct xattr_handler xfs_xattr_trusted_handler = { | 82 | static const struct xattr_handler xfs_xattr_trusted_handler = { |
| 83 | .prefix = XATTR_TRUSTED_PREFIX, | 83 | .prefix = XATTR_TRUSTED_PREFIX, |
| 84 | .flags = ATTR_ROOT, | 84 | .flags = ATTR_ROOT, |
| 85 | .get = xfs_xattr_get, | 85 | .get = xfs_xattr_get, |
| 86 | .set = xfs_xattr_set, | 86 | .set = xfs_xattr_set, |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | static struct xattr_handler xfs_xattr_security_handler = { | 89 | static const struct xattr_handler xfs_xattr_security_handler = { |
| 90 | .prefix = XATTR_SECURITY_PREFIX, | 90 | .prefix = XATTR_SECURITY_PREFIX, |
| 91 | .flags = ATTR_SECURE, | 91 | .flags = ATTR_SECURE, |
| 92 | .get = xfs_xattr_get, | 92 | .get = xfs_xattr_get, |
| 93 | .set = xfs_xattr_set, | 93 | .set = xfs_xattr_set, |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | struct xattr_handler *xfs_xattr_handlers[] = { | 96 | const struct xattr_handler *xfs_xattr_handlers[] = { |
| 97 | &xfs_xattr_user_handler, | 97 | &xfs_xattr_user_handler, |
| 98 | &xfs_xattr_trusted_handler, | 98 | &xfs_xattr_trusted_handler, |
| 99 | &xfs_xattr_security_handler, | 99 | &xfs_xattr_security_handler, |
