diff options
-rw-r--r-- | fs/ocfs2/file.c | 190 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2_trace.h | 237 | ||||
-rw-r--r-- | fs/ocfs2/sysfile.c | 1 |
3 files changed, 330 insertions, 98 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 1e1a93aa0526..41565ae52856 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/quotaops.h> | 38 | #include <linux/quotaops.h> |
39 | #include <linux/blkdev.h> | 39 | #include <linux/blkdev.h> |
40 | 40 | ||
41 | #define MLOG_MASK_PREFIX ML_INODE | ||
42 | #include <cluster/masklog.h> | 41 | #include <cluster/masklog.h> |
43 | 42 | ||
44 | #include "ocfs2.h" | 43 | #include "ocfs2.h" |
@@ -61,6 +60,7 @@ | |||
61 | #include "acl.h" | 60 | #include "acl.h" |
62 | #include "quota.h" | 61 | #include "quota.h" |
63 | #include "refcounttree.h" | 62 | #include "refcounttree.h" |
63 | #include "ocfs2_trace.h" | ||
64 | 64 | ||
65 | #include "buffer_head_io.h" | 65 | #include "buffer_head_io.h" |
66 | 66 | ||
@@ -99,8 +99,10 @@ static int ocfs2_file_open(struct inode *inode, struct file *file) | |||
99 | int mode = file->f_flags; | 99 | int mode = file->f_flags; |
100 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 100 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
101 | 101 | ||
102 | mlog(0, "(0x%p, 0x%p, '%.*s')\n", inode, file, | 102 | trace_ocfs2_file_open(inode, file, file->f_path.dentry, |
103 | file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); | 103 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
104 | file->f_path.dentry->d_name.len, | ||
105 | file->f_path.dentry->d_name.name, mode); | ||
104 | 106 | ||
105 | if (file->f_mode & FMODE_WRITE) | 107 | if (file->f_mode & FMODE_WRITE) |
106 | dquot_initialize(inode); | 108 | dquot_initialize(inode); |
@@ -142,13 +144,15 @@ static int ocfs2_file_release(struct inode *inode, struct file *file) | |||
142 | { | 144 | { |
143 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 145 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
144 | 146 | ||
145 | mlog(0, "(0x%p, 0x%p, '%.*s')\n", inode, file, | ||
146 | file->f_path.dentry->d_name.len, | ||
147 | file->f_path.dentry->d_name.name); | ||
148 | |||
149 | spin_lock(&oi->ip_lock); | 147 | spin_lock(&oi->ip_lock); |
150 | if (!--oi->ip_open_count) | 148 | if (!--oi->ip_open_count) |
151 | oi->ip_flags &= ~OCFS2_INODE_OPEN_DIRECT; | 149 | oi->ip_flags &= ~OCFS2_INODE_OPEN_DIRECT; |
150 | |||
151 | trace_ocfs2_file_release(inode, file, file->f_path.dentry, | ||
152 | oi->ip_blkno, | ||
153 | file->f_path.dentry->d_name.len, | ||
154 | file->f_path.dentry->d_name.name, | ||
155 | oi->ip_open_count); | ||
152 | spin_unlock(&oi->ip_lock); | 156 | spin_unlock(&oi->ip_lock); |
153 | 157 | ||
154 | ocfs2_free_file_private(inode, file); | 158 | ocfs2_free_file_private(inode, file); |
@@ -174,9 +178,11 @@ static int ocfs2_sync_file(struct file *file, int datasync) | |||
174 | struct inode *inode = file->f_mapping->host; | 178 | struct inode *inode = file->f_mapping->host; |
175 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 179 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
176 | 180 | ||
177 | mlog(0, "(0x%p, %d, 0x%p, '%.*s')\n", file, datasync, | 181 | trace_ocfs2_sync_file(inode, file, file->f_path.dentry, |
178 | file->f_path.dentry, file->f_path.dentry->d_name.len, | 182 | OCFS2_I(inode)->ip_blkno, |
179 | file->f_path.dentry->d_name.name); | 183 | file->f_path.dentry->d_name.len, |
184 | file->f_path.dentry->d_name.name, | ||
185 | (unsigned long long)datasync); | ||
180 | 186 | ||
181 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) { | 187 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) { |
182 | /* | 188 | /* |
@@ -431,14 +437,14 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
431 | struct ocfs2_dinode *fe = NULL; | 437 | struct ocfs2_dinode *fe = NULL; |
432 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 438 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
433 | 439 | ||
434 | mlog(0, "(inode = %llu, new_i_size = %llu\n", | ||
435 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
436 | (unsigned long long)new_i_size); | ||
437 | |||
438 | /* We trust di_bh because it comes from ocfs2_inode_lock(), which | 440 | /* We trust di_bh because it comes from ocfs2_inode_lock(), which |
439 | * already validated it */ | 441 | * already validated it */ |
440 | fe = (struct ocfs2_dinode *) di_bh->b_data; | 442 | fe = (struct ocfs2_dinode *) di_bh->b_data; |
441 | 443 | ||
444 | trace_ocfs2_truncate_file((unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
445 | (unsigned long long)le64_to_cpu(fe->i_size), | ||
446 | (unsigned long long)new_i_size); | ||
447 | |||
442 | mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode), | 448 | mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode), |
443 | "Inode %llu, inode i_size = %lld != di " | 449 | "Inode %llu, inode i_size = %lld != di " |
444 | "i_size = %llu, i_flags = 0x%x\n", | 450 | "i_size = %llu, i_flags = 0x%x\n", |
@@ -448,19 +454,14 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
448 | le32_to_cpu(fe->i_flags)); | 454 | le32_to_cpu(fe->i_flags)); |
449 | 455 | ||
450 | if (new_i_size > le64_to_cpu(fe->i_size)) { | 456 | if (new_i_size > le64_to_cpu(fe->i_size)) { |
451 | mlog(0, "asked to truncate file with size (%llu) to size (%llu)!\n", | 457 | trace_ocfs2_truncate_file_error( |
452 | (unsigned long long)le64_to_cpu(fe->i_size), | 458 | (unsigned long long)le64_to_cpu(fe->i_size), |
453 | (unsigned long long)new_i_size); | 459 | (unsigned long long)new_i_size); |
454 | status = -EINVAL; | 460 | status = -EINVAL; |
455 | mlog_errno(status); | 461 | mlog_errno(status); |
456 | goto bail; | 462 | goto bail; |
457 | } | 463 | } |
458 | 464 | ||
459 | mlog(0, "inode %llu, i_size = %llu, new_i_size = %llu\n", | ||
460 | (unsigned long long)le64_to_cpu(fe->i_blkno), | ||
461 | (unsigned long long)le64_to_cpu(fe->i_size), | ||
462 | (unsigned long long)new_i_size); | ||
463 | |||
464 | /* lets handle the simple truncate cases before doing any more | 465 | /* lets handle the simple truncate cases before doing any more |
465 | * cluster locking. */ | 466 | * cluster locking. */ |
466 | if (new_i_size == le64_to_cpu(fe->i_size)) | 467 | if (new_i_size == le64_to_cpu(fe->i_size)) |
@@ -566,8 +567,6 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, | |||
566 | struct ocfs2_extent_tree et; | 567 | struct ocfs2_extent_tree et; |
567 | int did_quota = 0; | 568 | int did_quota = 0; |
568 | 569 | ||
569 | mlog(0, "(clusters_to_add = %u)\n", clusters_to_add); | ||
570 | |||
571 | /* | 570 | /* |
572 | * This function only exists for file systems which don't | 571 | * This function only exists for file systems which don't |
573 | * support holes. | 572 | * support holes. |
@@ -584,11 +583,6 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, | |||
584 | restart_all: | 583 | restart_all: |
585 | BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters); | 584 | BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters); |
586 | 585 | ||
587 | mlog(0, "extend inode %llu, i_size = %lld, di->i_clusters = %u, " | ||
588 | "clusters_to_add = %u\n", | ||
589 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
590 | (long long)i_size_read(inode), le32_to_cpu(fe->i_clusters), | ||
591 | clusters_to_add); | ||
592 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), bh); | 586 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), bh); |
593 | status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0, | 587 | status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0, |
594 | &data_ac, &meta_ac); | 588 | &data_ac, &meta_ac); |
@@ -608,6 +602,12 @@ restart_all: | |||
608 | } | 602 | } |
609 | 603 | ||
610 | restarted_transaction: | 604 | restarted_transaction: |
605 | trace_ocfs2_extend_allocation( | ||
606 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
607 | (unsigned long long)i_size_read(inode), | ||
608 | le32_to_cpu(fe->i_clusters), clusters_to_add, | ||
609 | why, restart_func); | ||
610 | |||
611 | status = dquot_alloc_space_nodirty(inode, | 611 | status = dquot_alloc_space_nodirty(inode, |
612 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); | 612 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); |
613 | if (status) | 613 | if (status) |
@@ -654,13 +654,11 @@ restarted_transaction: | |||
654 | 654 | ||
655 | if (why != RESTART_NONE && clusters_to_add) { | 655 | if (why != RESTART_NONE && clusters_to_add) { |
656 | if (why == RESTART_META) { | 656 | if (why == RESTART_META) { |
657 | mlog(0, "restarting function.\n"); | ||
658 | restart_func = 1; | 657 | restart_func = 1; |
659 | status = 0; | 658 | status = 0; |
660 | } else { | 659 | } else { |
661 | BUG_ON(why != RESTART_TRANS); | 660 | BUG_ON(why != RESTART_TRANS); |
662 | 661 | ||
663 | mlog(0, "restarting transaction.\n"); | ||
664 | /* TODO: This can be more intelligent. */ | 662 | /* TODO: This can be more intelligent. */ |
665 | credits = ocfs2_calc_extend_credits(osb->sb, | 663 | credits = ocfs2_calc_extend_credits(osb->sb, |
666 | &fe->id2.i_list, | 664 | &fe->id2.i_list, |
@@ -677,11 +675,11 @@ restarted_transaction: | |||
677 | } | 675 | } |
678 | } | 676 | } |
679 | 677 | ||
680 | mlog(0, "fe: i_clusters = %u, i_size=%llu\n", | 678 | trace_ocfs2_extend_allocation_end(OCFS2_I(inode)->ip_blkno, |
681 | le32_to_cpu(fe->i_clusters), | 679 | le32_to_cpu(fe->i_clusters), |
682 | (unsigned long long)le64_to_cpu(fe->i_size)); | 680 | (unsigned long long)le64_to_cpu(fe->i_size), |
683 | mlog(0, "inode: ip_clusters=%u, i_size=%lld\n", | 681 | OCFS2_I(inode)->ip_clusters, |
684 | OCFS2_I(inode)->ip_clusters, (long long)i_size_read(inode)); | 682 | (unsigned long long)i_size_read(inode)); |
685 | 683 | ||
686 | leave: | 684 | leave: |
687 | if (status < 0 && did_quota) | 685 | if (status < 0 && did_quota) |
@@ -772,10 +770,11 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, | |||
772 | if (!zero_to) | 770 | if (!zero_to) |
773 | zero_to = PAGE_CACHE_SIZE; | 771 | zero_to = PAGE_CACHE_SIZE; |
774 | 772 | ||
775 | mlog(0, | 773 | trace_ocfs2_write_zero_page( |
776 | "abs_from = %llu, abs_to = %llu, index = %lu, zero_from = %u, zero_to = %u\n", | 774 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
777 | (unsigned long long)abs_from, (unsigned long long)abs_to, | 775 | (unsigned long long)abs_from, |
778 | index, zero_from, zero_to); | 776 | (unsigned long long)abs_to, |
777 | index, zero_from, zero_to); | ||
779 | 778 | ||
780 | /* We know that zero_from is block aligned */ | 779 | /* We know that zero_from is block aligned */ |
781 | for (block_start = zero_from; block_start < zero_to; | 780 | for (block_start = zero_from; block_start < zero_to; |
@@ -915,9 +914,10 @@ static int ocfs2_zero_extend_range(struct inode *inode, u64 range_start, | |||
915 | u64 next_pos; | 914 | u64 next_pos; |
916 | u64 zero_pos = range_start; | 915 | u64 zero_pos = range_start; |
917 | 916 | ||
918 | mlog(0, "range_start = %llu, range_end = %llu\n", | 917 | trace_ocfs2_zero_extend_range( |
919 | (unsigned long long)range_start, | 918 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
920 | (unsigned long long)range_end); | 919 | (unsigned long long)range_start, |
920 | (unsigned long long)range_end); | ||
921 | BUG_ON(range_start >= range_end); | 921 | BUG_ON(range_start >= range_end); |
922 | 922 | ||
923 | while (zero_pos < range_end) { | 923 | while (zero_pos < range_end) { |
@@ -949,9 +949,9 @@ int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh, | |||
949 | struct super_block *sb = inode->i_sb; | 949 | struct super_block *sb = inode->i_sb; |
950 | 950 | ||
951 | zero_start = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode)); | 951 | zero_start = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode)); |
952 | mlog(0, "zero_start %llu for i_size %llu\n", | 952 | trace_ocfs2_zero_extend((unsigned long long)OCFS2_I(inode)->ip_blkno, |
953 | (unsigned long long)zero_start, | 953 | (unsigned long long)zero_start, |
954 | (unsigned long long)i_size_read(inode)); | 954 | (unsigned long long)i_size_read(inode)); |
955 | while (zero_start < zero_to_size) { | 955 | while (zero_start < zero_to_size) { |
956 | ret = ocfs2_zero_extend_get_range(inode, di_bh, zero_start, | 956 | ret = ocfs2_zero_extend_get_range(inode, di_bh, zero_start, |
957 | zero_to_size, | 957 | zero_to_size, |
@@ -1100,30 +1100,20 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1100 | struct dquot *transfer_to[MAXQUOTAS] = { }; | 1100 | struct dquot *transfer_to[MAXQUOTAS] = { }; |
1101 | int qtype; | 1101 | int qtype; |
1102 | 1102 | ||
1103 | mlog(0, "(0x%p, '%.*s')\n", dentry, | 1103 | trace_ocfs2_setattr(inode, dentry, |
1104 | dentry->d_name.len, dentry->d_name.name); | 1104 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1105 | dentry->d_name.len, dentry->d_name.name, | ||
1106 | attr->ia_valid, attr->ia_mode, | ||
1107 | attr->ia_uid, attr->ia_gid); | ||
1105 | 1108 | ||
1106 | /* ensuring we don't even attempt to truncate a symlink */ | 1109 | /* ensuring we don't even attempt to truncate a symlink */ |
1107 | if (S_ISLNK(inode->i_mode)) | 1110 | if (S_ISLNK(inode->i_mode)) |
1108 | attr->ia_valid &= ~ATTR_SIZE; | 1111 | attr->ia_valid &= ~ATTR_SIZE; |
1109 | 1112 | ||
1110 | if (attr->ia_valid & ATTR_MODE) | ||
1111 | mlog(0, "mode change: %d\n", attr->ia_mode); | ||
1112 | if (attr->ia_valid & ATTR_UID) | ||
1113 | mlog(0, "uid change: %d\n", attr->ia_uid); | ||
1114 | if (attr->ia_valid & ATTR_GID) | ||
1115 | mlog(0, "gid change: %d\n", attr->ia_gid); | ||
1116 | if (attr->ia_valid & ATTR_SIZE) | ||
1117 | mlog(0, "size change...\n"); | ||
1118 | if (attr->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME)) | ||
1119 | mlog(0, "time change...\n"); | ||
1120 | |||
1121 | #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \ | 1113 | #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \ |
1122 | | ATTR_GID | ATTR_UID | ATTR_MODE) | 1114 | | ATTR_GID | ATTR_UID | ATTR_MODE) |
1123 | if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) { | 1115 | if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) |
1124 | mlog(0, "can't handle attrs: 0x%x\n", attr->ia_valid); | ||
1125 | return 0; | 1116 | return 0; |
1126 | } | ||
1127 | 1117 | ||
1128 | status = inode_change_ok(inode, attr); | 1118 | status = inode_change_ok(inode, attr); |
1129 | if (status) | 1119 | if (status) |
@@ -1318,8 +1308,9 @@ static int __ocfs2_write_remove_suid(struct inode *inode, | |||
1318 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1308 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1319 | struct ocfs2_dinode *di; | 1309 | struct ocfs2_dinode *di; |
1320 | 1310 | ||
1321 | mlog(0, "(Inode %llu, mode 0%o)\n", | 1311 | trace_ocfs2_write_remove_suid( |
1322 | (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_mode); | 1312 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1313 | inode->i_mode); | ||
1323 | 1314 | ||
1324 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | 1315 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); |
1325 | if (IS_ERR(handle)) { | 1316 | if (IS_ERR(handle)) { |
@@ -1525,8 +1516,9 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1525 | * partial clusters here. There's no need to worry about | 1516 | * partial clusters here. There's no need to worry about |
1526 | * physical allocation - the zeroing code knows to skip holes. | 1517 | * physical allocation - the zeroing code knows to skip holes. |
1527 | */ | 1518 | */ |
1528 | mlog(0, "byte start: %llu, end: %llu\n", | 1519 | trace_ocfs2_zero_partial_clusters( |
1529 | (unsigned long long)start, (unsigned long long)end); | 1520 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1521 | (unsigned long long)start, (unsigned long long)end); | ||
1530 | 1522 | ||
1531 | /* | 1523 | /* |
1532 | * If both edges are on a cluster boundary then there's no | 1524 | * If both edges are on a cluster boundary then there's no |
@@ -1550,8 +1542,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1550 | if (tmpend > end) | 1542 | if (tmpend > end) |
1551 | tmpend = end; | 1543 | tmpend = end; |
1552 | 1544 | ||
1553 | mlog(0, "1st range: start: %llu, tmpend: %llu\n", | 1545 | trace_ocfs2_zero_partial_clusters_range1((unsigned long long)start, |
1554 | (unsigned long long)start, (unsigned long long)tmpend); | 1546 | (unsigned long long)tmpend); |
1555 | 1547 | ||
1556 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend); | 1548 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend); |
1557 | if (ret) | 1549 | if (ret) |
@@ -1565,8 +1557,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1565 | */ | 1557 | */ |
1566 | start = end & ~(osb->s_clustersize - 1); | 1558 | start = end & ~(osb->s_clustersize - 1); |
1567 | 1559 | ||
1568 | mlog(0, "2nd range: start: %llu, end: %llu\n", | 1560 | trace_ocfs2_zero_partial_clusters_range2( |
1569 | (unsigned long long)start, (unsigned long long)end); | 1561 | (unsigned long long)start, (unsigned long long)end); |
1570 | 1562 | ||
1571 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, end); | 1563 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, end); |
1572 | if (ret) | 1564 | if (ret) |
@@ -1666,6 +1658,11 @@ static int ocfs2_remove_inode_range(struct inode *inode, | |||
1666 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh); | 1658 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh); |
1667 | ocfs2_init_dealloc_ctxt(&dealloc); | 1659 | ocfs2_init_dealloc_ctxt(&dealloc); |
1668 | 1660 | ||
1661 | trace_ocfs2_remove_inode_range( | ||
1662 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
1663 | (unsigned long long)byte_start, | ||
1664 | (unsigned long long)byte_len); | ||
1665 | |||
1669 | if (byte_len == 0) | 1666 | if (byte_len == 0) |
1670 | return 0; | 1667 | return 0; |
1671 | 1668 | ||
@@ -1712,11 +1709,6 @@ static int ocfs2_remove_inode_range(struct inode *inode, | |||
1712 | trunc_end = (byte_start + byte_len) >> osb->s_clustersize_bits; | 1709 | trunc_end = (byte_start + byte_len) >> osb->s_clustersize_bits; |
1713 | cluster_in_el = trunc_end; | 1710 | cluster_in_el = trunc_end; |
1714 | 1711 | ||
1715 | mlog(0, "Inode: %llu, start: %llu, len: %llu, cstart: %u, cend: %u\n", | ||
1716 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
1717 | (unsigned long long)byte_start, | ||
1718 | (unsigned long long)byte_len, trunc_start, trunc_end); | ||
1719 | |||
1720 | ret = ocfs2_zero_partial_clusters(inode, byte_start, byte_len); | 1712 | ret = ocfs2_zero_partial_clusters(inode, byte_start, byte_len); |
1721 | if (ret) { | 1713 | if (ret) { |
1722 | mlog_errno(ret); | 1714 | mlog_errno(ret); |
@@ -2071,7 +2063,7 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2071 | int ret = 0, meta_level = 0; | 2063 | int ret = 0, meta_level = 0; |
2072 | struct dentry *dentry = file->f_path.dentry; | 2064 | struct dentry *dentry = file->f_path.dentry; |
2073 | struct inode *inode = dentry->d_inode; | 2065 | struct inode *inode = dentry->d_inode; |
2074 | loff_t saved_pos, end; | 2066 | loff_t saved_pos = 0, end; |
2075 | 2067 | ||
2076 | /* | 2068 | /* |
2077 | * We start with a read level meta lock and only jump to an ex | 2069 | * We start with a read level meta lock and only jump to an ex |
@@ -2110,12 +2102,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2110 | 2102 | ||
2111 | /* work on a copy of ppos until we're sure that we won't have | 2103 | /* work on a copy of ppos until we're sure that we won't have |
2112 | * to recalculate it due to relocking. */ | 2104 | * to recalculate it due to relocking. */ |
2113 | if (appending) { | 2105 | if (appending) |
2114 | saved_pos = i_size_read(inode); | 2106 | saved_pos = i_size_read(inode); |
2115 | mlog(0, "O_APPEND: inode->i_size=%llu\n", saved_pos); | 2107 | else |
2116 | } else { | ||
2117 | saved_pos = *ppos; | 2108 | saved_pos = *ppos; |
2118 | } | ||
2119 | 2109 | ||
2120 | end = saved_pos + count; | 2110 | end = saved_pos + count; |
2121 | 2111 | ||
@@ -2186,6 +2176,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2186 | *ppos = saved_pos; | 2176 | *ppos = saved_pos; |
2187 | 2177 | ||
2188 | out_unlock: | 2178 | out_unlock: |
2179 | trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno, | ||
2180 | saved_pos, appending, count, | ||
2181 | direct_io, has_refcount); | ||
2182 | |||
2189 | if (meta_level >= 0) | 2183 | if (meta_level >= 0) |
2190 | ocfs2_inode_unlock(inode, meta_level); | 2184 | ocfs2_inode_unlock(inode, meta_level); |
2191 | 2185 | ||
@@ -2211,10 +2205,11 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2211 | int full_coherency = !(osb->s_mount_opt & | 2205 | int full_coherency = !(osb->s_mount_opt & |
2212 | OCFS2_MOUNT_COHERENCY_BUFFERED); | 2206 | OCFS2_MOUNT_COHERENCY_BUFFERED); |
2213 | 2207 | ||
2214 | mlog(0, "(0x%p, %u, '%.*s')\n", file, | 2208 | trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry, |
2215 | (unsigned int)nr_segs, | 2209 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2216 | file->f_path.dentry->d_name.len, | 2210 | file->f_path.dentry->d_name.len, |
2217 | file->f_path.dentry->d_name.name); | 2211 | file->f_path.dentry->d_name.name, |
2212 | (unsigned int)nr_segs); | ||
2218 | 2213 | ||
2219 | if (iocb->ki_left == 0) | 2214 | if (iocb->ki_left == 0) |
2220 | return 0; | 2215 | return 0; |
@@ -2415,10 +2410,11 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, | |||
2415 | .u.file = out, | 2410 | .u.file = out, |
2416 | }; | 2411 | }; |
2417 | 2412 | ||
2418 | mlog(0, "(0x%p, 0x%p, %u, '%.*s')\n", out, pipe, | 2413 | |
2419 | (unsigned int)len, | 2414 | trace_ocfs2_file_splice_write(inode, out, out->f_path.dentry, |
2420 | out->f_path.dentry->d_name.len, | 2415 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2421 | out->f_path.dentry->d_name.name); | 2416 | out->f_path.dentry->d_name.len, |
2417 | out->f_path.dentry->d_name.name, len); | ||
2422 | 2418 | ||
2423 | if (pipe->inode) | 2419 | if (pipe->inode) |
2424 | mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT); | 2420 | mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT); |
@@ -2474,10 +2470,10 @@ static ssize_t ocfs2_file_splice_read(struct file *in, | |||
2474 | int ret = 0, lock_level = 0; | 2470 | int ret = 0, lock_level = 0; |
2475 | struct inode *inode = in->f_path.dentry->d_inode; | 2471 | struct inode *inode = in->f_path.dentry->d_inode; |
2476 | 2472 | ||
2477 | mlog(0, "(0x%p, 0x%p, %u, '%.*s')\n", in, pipe, | 2473 | trace_ocfs2_file_splice_read(inode, in, in->f_path.dentry, |
2478 | (unsigned int)len, | 2474 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2479 | in->f_path.dentry->d_name.len, | 2475 | in->f_path.dentry->d_name.len, |
2480 | in->f_path.dentry->d_name.name); | 2476 | in->f_path.dentry->d_name.name, len); |
2481 | 2477 | ||
2482 | /* | 2478 | /* |
2483 | * See the comment in ocfs2_file_aio_read() | 2479 | * See the comment in ocfs2_file_aio_read() |
@@ -2504,10 +2500,11 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2504 | struct file *filp = iocb->ki_filp; | 2500 | struct file *filp = iocb->ki_filp; |
2505 | struct inode *inode = filp->f_path.dentry->d_inode; | 2501 | struct inode *inode = filp->f_path.dentry->d_inode; |
2506 | 2502 | ||
2507 | mlog(0, "(0x%p, %u, '%.*s')\n", filp, | 2503 | trace_ocfs2_file_aio_read(inode, filp, filp->f_path.dentry, |
2508 | (unsigned int)nr_segs, | 2504 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2509 | filp->f_path.dentry->d_name.len, | 2505 | filp->f_path.dentry->d_name.len, |
2510 | filp->f_path.dentry->d_name.name); | 2506 | filp->f_path.dentry->d_name.name, nr_segs); |
2507 | |||
2511 | 2508 | ||
2512 | if (!inode) { | 2509 | if (!inode) { |
2513 | ret = -EINVAL; | 2510 | ret = -EINVAL; |
@@ -2553,8 +2550,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2553 | ocfs2_inode_unlock(inode, lock_level); | 2550 | ocfs2_inode_unlock(inode, lock_level); |
2554 | 2551 | ||
2555 | ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); | 2552 | ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); |
2556 | if (ret == -EINVAL) | 2553 | trace_generic_file_aio_read_ret(ret); |
2557 | mlog(0, "generic_file_aio_read returned -EINVAL\n"); | ||
2558 | 2554 | ||
2559 | /* buffered aio wouldn't have proper lock coverage today */ | 2555 | /* buffered aio wouldn't have proper lock coverage today */ |
2560 | BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT)); | 2556 | BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT)); |
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h index 77148e7a14f8..16013b5588c6 100644 --- a/fs/ocfs2/ocfs2_trace.h +++ b/fs/ocfs2/ocfs2_trace.h | |||
@@ -204,6 +204,30 @@ DEFINE_EVENT(ocfs2__uint_uint_uint, name, \ | |||
204 | unsigned int value3), \ | 204 | unsigned int value3), \ |
205 | TP_ARGS(value1, value2, value3)) | 205 | TP_ARGS(value1, value2, value3)) |
206 | 206 | ||
207 | DECLARE_EVENT_CLASS(ocfs2__ull_ull_ull, | ||
208 | TP_PROTO(unsigned long long value1, | ||
209 | unsigned long long value2, unsigned long long value3), | ||
210 | TP_ARGS(value1, value2, value3), | ||
211 | TP_STRUCT__entry( | ||
212 | __field(unsigned long long, value1) | ||
213 | __field(unsigned long long, value2) | ||
214 | __field(unsigned long long, value3) | ||
215 | ), | ||
216 | TP_fast_assign( | ||
217 | __entry->value1 = value1; | ||
218 | __entry->value2 = value2; | ||
219 | __entry->value3 = value3; | ||
220 | ), | ||
221 | TP_printk("%llu %llu %llu", | ||
222 | __entry->value1, __entry->value2, __entry->value3) | ||
223 | ); | ||
224 | |||
225 | #define DEFINE_OCFS2_ULL_ULL_ULL_EVENT(name) \ | ||
226 | DEFINE_EVENT(ocfs2__ull_ull_ull, name, \ | ||
227 | TP_PROTO(unsigned long long value1, unsigned long long value2, \ | ||
228 | unsigned long long value3), \ | ||
229 | TP_ARGS(value1, value2, value3)) | ||
230 | |||
207 | DECLARE_EVENT_CLASS(ocfs2__ull_int_int_int, | 231 | DECLARE_EVENT_CLASS(ocfs2__ull_int_int_int, |
208 | TP_PROTO(unsigned long long ull, int value1, int value2, int value3), | 232 | TP_PROTO(unsigned long long ull, int value1, int value2, int value3), |
209 | TP_ARGS(ull, value1, value2, value3), | 233 | TP_ARGS(ull, value1, value2, value3), |
@@ -1117,6 +1141,219 @@ TRACE_EVENT(ocfs2_fault, | |||
1117 | 1141 | ||
1118 | /* End of trace events for fs/ocfs2/mmap.c. */ | 1142 | /* End of trace events for fs/ocfs2/mmap.c. */ |
1119 | 1143 | ||
1144 | /* Trace events for fs/ocfs2/file.c. */ | ||
1145 | |||
1146 | DECLARE_EVENT_CLASS(ocfs2__file_ops, | ||
1147 | TP_PROTO(void *inode, void *file, void *dentry, | ||
1148 | unsigned long long ino, | ||
1149 | unsigned int d_len, const unsigned char *d_name, | ||
1150 | unsigned long long para), | ||
1151 | TP_ARGS(inode, file, dentry, ino, d_len, d_name, para), | ||
1152 | TP_STRUCT__entry( | ||
1153 | __field(void *, inode) | ||
1154 | __field(void *, file) | ||
1155 | __field(void *, dentry) | ||
1156 | __field(unsigned long long, ino) | ||
1157 | __field(unsigned int, d_len) | ||
1158 | __string(d_name, d_name) | ||
1159 | __field(unsigned long long, para) | ||
1160 | ), | ||
1161 | TP_fast_assign( | ||
1162 | __entry->inode = inode; | ||
1163 | __entry->file = file; | ||
1164 | __entry->dentry = dentry; | ||
1165 | __entry->ino = ino; | ||
1166 | __entry->d_len = d_len; | ||
1167 | __assign_str(d_name, d_name); | ||
1168 | __entry->para = para; | ||
1169 | ), | ||
1170 | TP_printk("%p %p %p %llu %llu %.*s", __entry->inode, __entry->file, | ||
1171 | __entry->dentry, __entry->ino, __entry->para, | ||
1172 | __entry->d_len, __get_str(d_name)) | ||
1173 | ); | ||
1174 | |||
1175 | #define DEFINE_OCFS2_FILE_OPS(name) \ | ||
1176 | DEFINE_EVENT(ocfs2__file_ops, name, \ | ||
1177 | TP_PROTO(void *inode, void *file, void *dentry, \ | ||
1178 | unsigned long long ino, \ | ||
1179 | unsigned int d_len, const unsigned char *d_name, \ | ||
1180 | unsigned long long mode), \ | ||
1181 | TP_ARGS(inode, file, dentry, ino, d_len, d_name, mode)) | ||
1182 | |||
1183 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_open); | ||
1184 | |||
1185 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_release); | ||
1186 | |||
1187 | DEFINE_OCFS2_FILE_OPS(ocfs2_sync_file); | ||
1188 | |||
1189 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_aio_write); | ||
1190 | |||
1191 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_splice_write); | ||
1192 | |||
1193 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_splice_read); | ||
1194 | |||
1195 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_aio_read); | ||
1196 | |||
1197 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_truncate_file); | ||
1198 | |||
1199 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_truncate_file_error); | ||
1200 | |||
1201 | TRACE_EVENT(ocfs2_extend_allocation, | ||
1202 | TP_PROTO(unsigned long long ip_blkno, unsigned long long size, | ||
1203 | unsigned int clusters, unsigned int clusters_to_add, | ||
1204 | int why, int restart_func), | ||
1205 | TP_ARGS(ip_blkno, size, clusters, clusters_to_add, why, restart_func), | ||
1206 | TP_STRUCT__entry( | ||
1207 | __field(unsigned long long, ip_blkno) | ||
1208 | __field(unsigned long long, size) | ||
1209 | __field(unsigned int, clusters) | ||
1210 | __field(unsigned int, clusters_to_add) | ||
1211 | __field(int, why) | ||
1212 | __field(int, restart_func) | ||
1213 | ), | ||
1214 | TP_fast_assign( | ||
1215 | __entry->ip_blkno = ip_blkno; | ||
1216 | __entry->size = size; | ||
1217 | __entry->clusters = clusters; | ||
1218 | __entry->clusters_to_add = clusters_to_add; | ||
1219 | __entry->why = why; | ||
1220 | __entry->restart_func = restart_func; | ||
1221 | ), | ||
1222 | TP_printk("%llu %llu %u %u %d %d", | ||
1223 | __entry->ip_blkno, __entry->size, __entry->clusters, | ||
1224 | __entry->clusters_to_add, __entry->why, __entry->restart_func) | ||
1225 | ); | ||
1226 | |||
1227 | TRACE_EVENT(ocfs2_extend_allocation_end, | ||
1228 | TP_PROTO(unsigned long long ino, | ||
1229 | unsigned int di_clusters, unsigned long long di_size, | ||
1230 | unsigned int ip_clusters, unsigned long long i_size), | ||
1231 | TP_ARGS(ino, di_clusters, di_size, ip_clusters, i_size), | ||
1232 | TP_STRUCT__entry( | ||
1233 | __field(unsigned long long, ino) | ||
1234 | __field(unsigned int, di_clusters) | ||
1235 | __field(unsigned long long, di_size) | ||
1236 | __field(unsigned int, ip_clusters) | ||
1237 | __field(unsigned long long, i_size) | ||
1238 | ), | ||
1239 | TP_fast_assign( | ||
1240 | __entry->ino = ino; | ||
1241 | __entry->di_clusters = di_clusters; | ||
1242 | __entry->di_size = di_size; | ||
1243 | __entry->ip_clusters = ip_clusters; | ||
1244 | __entry->i_size = i_size; | ||
1245 | ), | ||
1246 | TP_printk("%llu %u %llu %u %llu", __entry->ino, __entry->di_clusters, | ||
1247 | __entry->di_size, __entry->ip_clusters, __entry->i_size) | ||
1248 | ); | ||
1249 | |||
1250 | TRACE_EVENT(ocfs2_write_zero_page, | ||
1251 | TP_PROTO(unsigned long long ino, | ||
1252 | unsigned long long abs_from, unsigned long long abs_to, | ||
1253 | unsigned long index, unsigned int zero_from, | ||
1254 | unsigned int zero_to), | ||
1255 | TP_ARGS(ino, abs_from, abs_to, index, zero_from, zero_to), | ||
1256 | TP_STRUCT__entry( | ||
1257 | __field(unsigned long long, ino) | ||
1258 | __field(unsigned long long, abs_from) | ||
1259 | __field(unsigned long long, abs_to) | ||
1260 | __field(unsigned long, index) | ||
1261 | __field(unsigned int, zero_from) | ||
1262 | __field(unsigned int, zero_to) | ||
1263 | ), | ||
1264 | TP_fast_assign( | ||
1265 | __entry->ino = ino; | ||
1266 | __entry->abs_from = abs_from; | ||
1267 | __entry->abs_to = abs_to; | ||
1268 | __entry->index = index; | ||
1269 | __entry->zero_from = zero_from; | ||
1270 | __entry->zero_to = zero_to; | ||
1271 | ), | ||
1272 | TP_printk("%llu %llu %llu %lu %u %u", __entry->ino, | ||
1273 | __entry->abs_from, __entry->abs_to, | ||
1274 | __entry->index, __entry->zero_from, __entry->zero_to) | ||
1275 | ); | ||
1276 | |||
1277 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_zero_extend_range); | ||
1278 | |||
1279 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_zero_extend); | ||
1280 | |||
1281 | TRACE_EVENT(ocfs2_setattr, | ||
1282 | TP_PROTO(void *inode, void *dentry, | ||
1283 | unsigned long long ino, | ||
1284 | unsigned int d_len, const unsigned char *d_name, | ||
1285 | unsigned int ia_valid, unsigned int ia_mode, | ||
1286 | unsigned int ia_uid, unsigned int ia_gid), | ||
1287 | TP_ARGS(inode, dentry, ino, d_len, d_name, | ||
1288 | ia_valid, ia_mode, ia_uid, ia_gid), | ||
1289 | TP_STRUCT__entry( | ||
1290 | __field(void *, inode) | ||
1291 | __field(void *, dentry) | ||
1292 | __field(unsigned long long, ino) | ||
1293 | __field(unsigned int, d_len) | ||
1294 | __string(d_name, d_name) | ||
1295 | __field(unsigned int, ia_valid) | ||
1296 | __field(unsigned int, ia_mode) | ||
1297 | __field(unsigned int, ia_uid) | ||
1298 | __field(unsigned int, ia_gid) | ||
1299 | ), | ||
1300 | TP_fast_assign( | ||
1301 | __entry->inode = inode; | ||
1302 | __entry->dentry = dentry; | ||
1303 | __entry->ino = ino; | ||
1304 | __entry->d_len = d_len; | ||
1305 | __assign_str(d_name, d_name); | ||
1306 | __entry->ia_valid = ia_valid; | ||
1307 | __entry->ia_mode = ia_mode; | ||
1308 | __entry->ia_uid = ia_uid; | ||
1309 | __entry->ia_gid = ia_gid; | ||
1310 | ), | ||
1311 | TP_printk("%p %p %llu %.*s %u %u %u %u", __entry->inode, | ||
1312 | __entry->dentry, __entry->ino, __entry->d_len, | ||
1313 | __get_str(d_name), __entry->ia_valid, __entry->ia_mode, | ||
1314 | __entry->ia_uid, __entry->ia_gid) | ||
1315 | ); | ||
1316 | |||
1317 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_write_remove_suid); | ||
1318 | |||
1319 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_zero_partial_clusters); | ||
1320 | |||
1321 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_zero_partial_clusters_range1); | ||
1322 | |||
1323 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_zero_partial_clusters_range2); | ||
1324 | |||
1325 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_remove_inode_range); | ||
1326 | |||
1327 | TRACE_EVENT(ocfs2_prepare_inode_for_write, | ||
1328 | TP_PROTO(unsigned long long ino, unsigned long long saved_pos, | ||
1329 | int appending, unsigned long count, | ||
1330 | int *direct_io, int *has_refcount), | ||
1331 | TP_ARGS(ino, saved_pos, appending, count, direct_io, has_refcount), | ||
1332 | TP_STRUCT__entry( | ||
1333 | __field(unsigned long long, ino) | ||
1334 | __field(unsigned long long, saved_pos) | ||
1335 | __field(int, appending) | ||
1336 | __field(unsigned long, count) | ||
1337 | __field(int, direct_io) | ||
1338 | __field(int, has_refcount) | ||
1339 | ), | ||
1340 | TP_fast_assign( | ||
1341 | __entry->ino = ino; | ||
1342 | __entry->saved_pos = saved_pos; | ||
1343 | __entry->appending = appending; | ||
1344 | __entry->count = count; | ||
1345 | __entry->direct_io = direct_io ? *direct_io : -1; | ||
1346 | __entry->has_refcount = has_refcount ? *has_refcount : -1; | ||
1347 | ), | ||
1348 | TP_printk("%llu %llu %d %lu %d %d", __entry->ino, | ||
1349 | __entry->saved_pos, __entry->appending, __entry->count, | ||
1350 | __entry->direct_io, __entry->has_refcount) | ||
1351 | ); | ||
1352 | |||
1353 | DEFINE_OCFS2_INT_EVENT(generic_file_aio_read_ret); | ||
1354 | |||
1355 | /* End of trace events for fs/ocfs2/file.c. */ | ||
1356 | |||
1120 | #endif /* _TRACE_OCFS2_H */ | 1357 | #endif /* _TRACE_OCFS2_H */ |
1121 | 1358 | ||
1122 | /* This part must be outside protection */ | 1359 | /* This part must be outside protection */ |
diff --git a/fs/ocfs2/sysfile.c b/fs/ocfs2/sysfile.c index 902efb23b6a6..3d635f4bbb20 100644 --- a/fs/ocfs2/sysfile.c +++ b/fs/ocfs2/sysfile.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
29 | 29 | ||
30 | #define MLOG_MASK_PREFIX ML_INODE | ||
31 | #include <cluster/masklog.h> | 30 | #include <cluster/masklog.h> |
32 | 31 | ||
33 | #include "ocfs2.h" | 32 | #include "ocfs2.h" |