Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
jbd: change the field "b_cow_tid" of struct journal_head from type unsigned to tid_t
ext3.txt: update the links in the section "useful links" to the latest ones
ext3: Fix data corruption in inodes with journalled data
ext2: check xattr name_len before acquiring xattr_sem in ext2_xattr_get
ext3: Fix compilation with -DDX_DEBUG
quota: Remove unused declaration
jbd: Use WRITE_SYNC in journal checkpoint.
jbd: Fix oops in journal_remove_journal_head()
ext3: Return -EINVAL when start is beyond the end of fs in ext3_trim_fs()
ext3/ioctl.c: silence sparse warnings about different address spaces
ext3/ext4 Documentation: remove bh/nobh since it has been deprecated
ext3: Improve truncate error handling
ext3: use proper little-endian bitops
ext2: include fs.h into ext2_fs.h
ext3: Fix oops in ext3_try_to_allocate_with_rsv()
jbd: fix a bug of leaking jh->b_jcount
jbd: remove dependency on __GFP_NOFAIL
ext3: Convert ext3 to new truncate calling convention
jbd: Add fixed tracepoints
ext3: Add fixed tracepoints

Resolve conflicts in fs/ext3/fsync.c due to fsync locking push-down and
new fixed tracepoints.

+1419 -270
+2 -11
Documentation/filesystems/ext3.txt
··· 147 147 package for more details 148 148 (http://sourceforge.net/projects/linuxquota). 149 149 150 - bh (*) ext3 associates buffer heads to data pages to 151 - nobh (a) cache disk block mapping information 152 - (b) link pages into transaction to provide 153 - ordering guarantees. 154 - "bh" option forces use of buffer heads. 155 - "nobh" option tries to avoid associating buffer 156 - heads (supported only for "writeback" mode). 157 - 158 - 159 150 Specification 160 151 ============= 161 152 Ext3 shares all disk implementation with the ext2 filesystem, and adds ··· 218 227 programs: http://e2fsprogs.sourceforge.net/ 219 228 http://ext2resize.sourceforge.net 220 229 221 - useful links: http://www.ibm.com/developerworks/library/l-fs7.html 222 - http://www.ibm.com/developerworks/library/l-fs8.html 230 + useful links: http://www.ibm.com/developerworks/library/l-fs7/index.html 231 + http://www.ibm.com/developerworks/library/l-fs8/index.html
+7 -16
Documentation/filesystems/ext4.txt
··· 68 68 '-o barriers=[0|1]' mount option for both ext3 and ext4 filesystems 69 69 for a fair comparison. When tuning ext3 for best benchmark numbers, 70 70 it is often worthwhile to try changing the data journaling mode; '-o 71 - data=writeback,nobh' can be faster for some workloads. (Note 72 - however that running mounted with data=writeback can potentially 73 - leave stale data exposed in recently written files in case of an 74 - unclean shutdown, which could be a security exposure in some 75 - situations.) Configuring the filesystem with a large journal can 76 - also be helpful for metadata-intensive workloads. 71 + data=writeback' can be faster for some workloads. (Note however that 72 + running mounted with data=writeback can potentially leave stale data 73 + exposed in recently written files in case of an unclean shutdown, 74 + which could be a security exposure in some situations.) Configuring 75 + the filesystem with a large journal can also be helpful for 76 + metadata-intensive workloads. 77 77 78 78 2. Features 79 79 =========== ··· 272 272 package for more details 273 273 (http://sourceforge.net/projects/linuxquota). 274 274 275 - bh (*) ext4 associates buffer heads to data pages to 276 - nobh (a) cache disk block mapping information 277 - (b) link pages into transaction to provide 278 - ordering guarantees. 279 - "bh" option forces use of buffer heads. 280 - "nobh" option tries to avoid associating buffer 281 - heads (supported only for "writeback" mode). 282 - 283 275 stripe=n Number of filesystem blocks that mballoc will try 284 276 to use for allocation size and alignment. For RAID5/6 285 277 systems this should be the number of data ··· 385 393 write and convert the extent to initialized after IO 386 394 completes. This approach allows ext4 code to avoid 387 395 using inode mutex, which improves scalability on high 388 - speed storages. However this does not work with nobh 389 - option and the mount will fail. Nor does it work with 396 + speed storages. However this does not work with 390 397 data journaling and dioread_nolock option will be 391 398 ignored with kernel warning. Note that dioread_nolock 392 399 code path is only used for extent-based files.
+5 -5
fs/ext2/xattr.c
··· 161 161 162 162 if (name == NULL) 163 163 return -EINVAL; 164 + name_len = strlen(name); 165 + if (name_len > 255) 166 + return -ERANGE; 167 + 164 168 down_read(&EXT2_I(inode)->xattr_sem); 165 169 error = -ENODATA; 166 170 if (!EXT2_I(inode)->i_file_acl) ··· 185 181 error = -EIO; 186 182 goto cleanup; 187 183 } 188 - /* find named attribute */ 189 - name_len = strlen(name); 190 184 191 - error = -ERANGE; 192 - if (name_len > 255) 193 - goto cleanup; 185 + /* find named attribute */ 194 186 entry = FIRST_ENTRY(bh); 195 187 while (!IS_LAST_ENTRY(entry)) { 196 188 struct ext2_xattr_entry *next =
+22 -16
fs/ext3/balloc.c
··· 21 21 #include <linux/quotaops.h> 22 22 #include <linux/buffer_head.h> 23 23 #include <linux/blkdev.h> 24 + #include <trace/events/ext3.h> 24 25 25 26 /* 26 27 * balloc.c contains the blocks allocation and deallocation routines ··· 162 161 desc = ext3_get_group_desc(sb, block_group, NULL); 163 162 if (!desc) 164 163 return NULL; 164 + trace_ext3_read_block_bitmap(sb, block_group); 165 165 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); 166 166 bh = sb_getblk(sb, bitmap_blk); 167 167 if (unlikely(!bh)) { ··· 353 351 struct rb_node * parent = NULL; 354 352 struct ext3_reserve_window_node *this; 355 353 354 + trace_ext3_rsv_window_add(sb, rsv); 356 355 while (*p) 357 356 { 358 357 parent = *p; ··· 479 476 rsv = &block_i->rsv_window_node; 480 477 if (!rsv_is_empty(&rsv->rsv_window)) { 481 478 spin_lock(rsv_lock); 482 - if (!rsv_is_empty(&rsv->rsv_window)) 479 + if (!rsv_is_empty(&rsv->rsv_window)) { 480 + trace_ext3_discard_reservation(inode, rsv); 483 481 rsv_window_remove(inode->i_sb, rsv); 482 + } 484 483 spin_unlock(rsv_lock); 485 484 } 486 485 } ··· 688 683 void ext3_free_blocks(handle_t *handle, struct inode *inode, 689 684 ext3_fsblk_t block, unsigned long count) 690 685 { 691 - struct super_block * sb; 686 + struct super_block *sb = inode->i_sb; 692 687 unsigned long dquot_freed_blocks; 693 688 694 - sb = inode->i_sb; 695 - if (!sb) { 696 - printk ("ext3_free_blocks: nonexistent device"); 697 - return; 698 - } 689 + trace_ext3_free_blocks(inode, block, count); 699 690 ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks); 700 691 if (dquot_freed_blocks) 701 692 dquot_free_block(inode, dquot_freed_blocks); ··· 1137 1136 else 1138 1137 start_block = grp_goal + group_first_block; 1139 1138 1139 + trace_ext3_alloc_new_reservation(sb, start_block); 1140 1140 size = my_rsv->rsv_goal_size; 1141 1141 1142 1142 if (!rsv_is_empty(&my_rsv->rsv_window)) { ··· 1232 1230 * check if the first free block is within the 1233 1231 * free space we just reserved 1234 1232 */ 1235 - if (start_block >= my_rsv->rsv_start && start_block <= my_rsv->rsv_end) 1233 + if (start_block >= my_rsv->rsv_start && 1234 + start_block <= my_rsv->rsv_end) { 1235 + trace_ext3_reserved(sb, start_block, my_rsv); 1236 1236 return 0; /* success */ 1237 + } 1237 1238 /* 1238 1239 * if the first free bit we found is out of the reservable space 1239 1240 * continue search for next reservable space, ··· 1519 1514 1520 1515 *errp = -ENOSPC; 1521 1516 sb = inode->i_sb; 1522 - if (!sb) { 1523 - printk("ext3_new_block: nonexistent device"); 1524 - return 0; 1525 - } 1526 1517 1527 1518 /* 1528 1519 * Check quota for allocation of this block. ··· 1529 1528 return 0; 1530 1529 } 1531 1530 1531 + trace_ext3_request_blocks(inode, goal, num); 1532 + 1532 1533 sbi = EXT3_SB(sb); 1533 - es = EXT3_SB(sb)->s_es; 1534 + es = sbi->s_es; 1534 1535 ext3_debug("goal=%lu.\n", goal); 1535 1536 /* 1536 1537 * Allocate a block from reservation only when ··· 1745 1742 brelse(bitmap_bh); 1746 1743 dquot_free_block(inode, *count-num); 1747 1744 *count = num; 1745 + 1746 + trace_ext3_allocate_blocks(inode, goal, num, 1747 + (unsigned long long)ret_block); 1748 + 1748 1749 return ret_block; 1749 1750 1750 1751 io_error: ··· 2003 1996 if ((next - start) < minblocks) 2004 1997 goto free_extent; 2005 1998 1999 + trace_ext3_discard_blocks(sb, discard_block, next - start); 2006 2000 /* Send the TRIM command down to the device */ 2007 2001 err = sb_issue_discard(sb, discard_block, next - start, 2008 2002 GFP_NOFS, 0); ··· 2108 2100 if (unlikely(minlen > EXT3_BLOCKS_PER_GROUP(sb))) 2109 2101 return -EINVAL; 2110 2102 if (start >= max_blks) 2111 - goto out; 2103 + return -EINVAL; 2112 2104 if (start + len > max_blks) 2113 2105 len = max_blks - start; 2114 2106 ··· 2156 2148 2157 2149 if (ret >= 0) 2158 2150 ret = 0; 2159 - 2160 - out: 2161 2151 range->len = trimmed * sb->s_blocksize; 2162 2152 2163 2153 return ret;
-1
fs/ext3/file.c
··· 71 71 }; 72 72 73 73 const struct inode_operations ext3_file_inode_operations = { 74 - .truncate = ext3_truncate, 75 74 .setattr = ext3_setattr, 76 75 #ifdef CONFIG_EXT3_FS_XATTR 77 76 .setxattr = generic_setxattr,
+9 -2
fs/ext3/fsync.c
··· 30 30 #include <linux/jbd.h> 31 31 #include <linux/ext3_fs.h> 32 32 #include <linux/ext3_jbd.h> 33 + #include <trace/events/ext3.h> 33 34 34 35 /* 35 36 * akpm: A new design for ext3_sync_file(). ··· 52 51 int ret, needs_barrier = 0; 53 52 tid_t commit_tid; 54 53 54 + trace_ext3_sync_file_enter(file, datasync); 55 + 55 56 if (inode->i_sb->s_flags & MS_RDONLY) 56 57 return 0; 57 58 58 59 ret = filemap_write_and_wait_range(inode->i_mapping, start, end); 59 60 if (ret) 60 - return ret; 61 + goto out; 61 62 62 63 /* 63 64 * Taking the mutex here just to keep consistent with how fsync was ··· 86 83 */ 87 84 if (ext3_should_journal_data(inode)) { 88 85 mutex_unlock(&inode->i_mutex); 89 - return ext3_force_commit(inode->i_sb); 86 + ret = ext3_force_commit(inode->i_sb); 87 + goto out; 90 88 } 91 89 92 90 if (datasync) ··· 108 104 */ 109 105 if (needs_barrier) 110 106 blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); 107 + 111 108 mutex_unlock(&inode->i_mutex); 109 + out: 110 + trace_ext3_sync_file_exit(inode, ret); 112 111 return ret; 113 112 }
+4
fs/ext3/ialloc.c
··· 23 23 #include <linux/buffer_head.h> 24 24 #include <linux/random.h> 25 25 #include <linux/bitops.h> 26 + #include <trace/events/ext3.h> 26 27 27 28 #include <asm/byteorder.h> 28 29 ··· 119 118 120 119 ino = inode->i_ino; 121 120 ext3_debug ("freeing inode %lu\n", ino); 121 + trace_ext3_free_inode(inode); 122 122 123 123 is_directory = S_ISDIR(inode->i_mode); 124 124 ··· 428 426 return ERR_PTR(-EPERM); 429 427 430 428 sb = dir->i_sb; 429 + trace_ext3_request_inode(dir, mode); 431 430 inode = new_inode(sb); 432 431 if (!inode) 433 432 return ERR_PTR(-ENOMEM); ··· 604 601 } 605 602 606 603 ext3_debug("allocating inode %lu\n", inode->i_ino); 604 + trace_ext3_allocate_inode(inode, dir, mode); 607 605 goto really_out; 608 606 fail: 609 607 ext3_std_error(sb, err);
+136 -57
fs/ext3/inode.c
··· 38 38 #include <linux/bio.h> 39 39 #include <linux/fiemap.h> 40 40 #include <linux/namei.h> 41 + #include <trace/events/ext3.h> 41 42 #include "xattr.h" 42 43 #include "acl.h" 43 44 44 45 static int ext3_writepage_trans_blocks(struct inode *inode); 46 + static int ext3_block_truncate_page(struct inode *inode, loff_t from); 45 47 46 48 /* 47 49 * Test whether an inode is a fast symlink. ··· 72 70 73 71 might_sleep(); 74 72 73 + trace_ext3_forget(inode, is_metadata, blocknr); 75 74 BUFFER_TRACE(bh, "enter"); 76 75 77 76 jbd_debug(4, "forgetting bh %p: is_metadata = %d, mode %o, " ··· 197 194 */ 198 195 void ext3_evict_inode (struct inode *inode) 199 196 { 197 + struct ext3_inode_info *ei = EXT3_I(inode); 200 198 struct ext3_block_alloc_info *rsv; 201 199 handle_t *handle; 202 200 int want_delete = 0; 203 201 202 + trace_ext3_evict_inode(inode); 204 203 if (!inode->i_nlink && !is_bad_inode(inode)) { 205 204 dquot_initialize(inode); 206 205 want_delete = 1; 207 206 } 208 207 208 + /* 209 + * When journalling data dirty buffers are tracked only in the journal. 210 + * So although mm thinks everything is clean and ready for reaping the 211 + * inode might still have some pages to write in the running 212 + * transaction or waiting to be checkpointed. Thus calling 213 + * journal_invalidatepage() (via truncate_inode_pages()) to discard 214 + * these buffers can cause data loss. Also even if we did not discard 215 + * these buffers, we would have no way to find them after the inode 216 + * is reaped and thus user could see stale data if he tries to read 217 + * them before the transaction is checkpointed. So be careful and 218 + * force everything to disk here... We use ei->i_datasync_tid to 219 + * store the newest transaction containing inode's data. 220 + * 221 + * Note that directories do not have this problem because they don't 222 + * use page cache. 223 + */ 224 + if (inode->i_nlink && ext3_should_journal_data(inode) && 225 + (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { 226 + tid_t commit_tid = atomic_read(&ei->i_datasync_tid); 227 + journal_t *journal = EXT3_SB(inode->i_sb)->s_journal; 228 + 229 + log_start_commit(journal, commit_tid); 230 + log_wait_commit(journal, commit_tid); 231 + filemap_write_and_wait(&inode->i_data); 232 + } 209 233 truncate_inode_pages(&inode->i_data, 0); 210 234 211 235 ext3_discard_reservation(inode); 212 - rsv = EXT3_I(inode)->i_block_alloc_info; 213 - EXT3_I(inode)->i_block_alloc_info = NULL; 236 + rsv = ei->i_block_alloc_info; 237 + ei->i_block_alloc_info = NULL; 214 238 if (unlikely(rsv)) 215 239 kfree(rsv); 216 240 ··· 261 231 if (inode->i_blocks) 262 232 ext3_truncate(inode); 263 233 /* 264 - * Kill off the orphan record which ext3_truncate created. 265 - * AKPM: I think this can be inside the above `if'. 266 - * Note that ext3_orphan_del() has to be able to cope with the 267 - * deletion of a non-existent orphan - this is because we don't 268 - * know if ext3_truncate() actually created an orphan record. 269 - * (Well, we could do this if we need to, but heck - it works) 234 + * Kill off the orphan record created when the inode lost the last 235 + * link. Note that ext3_orphan_del() has to be able to cope with the 236 + * deletion of a non-existent orphan - ext3_truncate() could 237 + * have removed the record. 270 238 */ 271 239 ext3_orphan_del(handle, inode); 272 - EXT3_I(inode)->i_dtime = get_seconds(); 240 + ei->i_dtime = get_seconds(); 273 241 274 242 /* 275 243 * One subtle ordering requirement: if anything has gone wrong ··· 870 842 ext3_fsblk_t first_block = 0; 871 843 872 844 845 + trace_ext3_get_blocks_enter(inode, iblock, maxblocks, create); 873 846 J_ASSERT(handle != NULL || create == 0); 874 847 depth = ext3_block_to_path(inode,iblock,offsets,&blocks_to_boundary); 875 848 ··· 915 886 if (!create || err == -EIO) 916 887 goto cleanup; 917 888 889 + /* 890 + * Block out ext3_truncate while we alter the tree 891 + */ 918 892 mutex_lock(&ei->truncate_mutex); 919 893 920 894 /* ··· 966 934 */ 967 935 count = ext3_blks_to_allocate(partial, indirect_blks, 968 936 maxblocks, blocks_to_boundary); 969 - /* 970 - * Block out ext3_truncate while we alter the tree 971 - */ 972 937 err = ext3_alloc_branch(handle, inode, indirect_blks, &count, goal, 973 938 offsets + (partial - chain), partial); 974 939 ··· 999 970 } 1000 971 BUFFER_TRACE(bh_result, "returned"); 1001 972 out: 973 + trace_ext3_get_blocks_exit(inode, iblock, 974 + depth ? le32_to_cpu(chain[depth-1].key) : 0, 975 + count, err); 1002 976 return err; 1003 977 } 1004 978 ··· 1234 1202 ext3_truncate(inode); 1235 1203 } 1236 1204 1205 + /* 1206 + * Truncate blocks that were not used by direct IO write. We have to zero out 1207 + * the last file block as well because direct IO might have written to it. 1208 + */ 1209 + static void ext3_truncate_failed_direct_write(struct inode *inode) 1210 + { 1211 + ext3_block_truncate_page(inode, inode->i_size); 1212 + ext3_truncate(inode); 1213 + } 1214 + 1237 1215 static int ext3_write_begin(struct file *file, struct address_space *mapping, 1238 1216 loff_t pos, unsigned len, unsigned flags, 1239 1217 struct page **pagep, void **fsdata) ··· 1258 1216 /* Reserve one block more for addition to orphan list in case 1259 1217 * we allocate blocks but write fails for some reason */ 1260 1218 int needed_blocks = ext3_writepage_trans_blocks(inode) + 1; 1219 + 1220 + trace_ext3_write_begin(inode, pos, len, flags); 1261 1221 1262 1222 index = pos >> PAGE_CACHE_SHIFT; 1263 1223 from = pos & (PAGE_CACHE_SIZE - 1); ··· 1376 1332 unsigned from, to; 1377 1333 int ret = 0, ret2; 1378 1334 1335 + trace_ext3_ordered_write_end(inode, pos, len, copied); 1379 1336 copied = block_write_end(file, mapping, pos, len, copied, page, fsdata); 1380 1337 1381 1338 from = pos & (PAGE_CACHE_SIZE - 1); ··· 1412 1367 struct inode *inode = file->f_mapping->host; 1413 1368 int ret; 1414 1369 1370 + trace_ext3_writeback_write_end(inode, pos, len, copied); 1415 1371 copied = block_write_end(file, mapping, pos, len, copied, page, fsdata); 1416 1372 update_file_sizes(inode, pos, copied); 1417 1373 /* ··· 1437 1391 { 1438 1392 handle_t *handle = ext3_journal_current_handle(); 1439 1393 struct inode *inode = mapping->host; 1394 + struct ext3_inode_info *ei = EXT3_I(inode); 1440 1395 int ret = 0, ret2; 1441 1396 int partial = 0; 1442 1397 unsigned from, to; 1443 1398 1399 + trace_ext3_journalled_write_end(inode, pos, len, copied); 1444 1400 from = pos & (PAGE_CACHE_SIZE - 1); 1445 1401 to = from + len; 1446 1402 ··· 1467 1419 if (pos + len > inode->i_size && ext3_can_truncate(inode)) 1468 1420 ext3_orphan_add(handle, inode); 1469 1421 ext3_set_inode_state(inode, EXT3_STATE_JDATA); 1470 - if (inode->i_size > EXT3_I(inode)->i_disksize) { 1471 - EXT3_I(inode)->i_disksize = inode->i_size; 1422 + atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); 1423 + if (inode->i_size > ei->i_disksize) { 1424 + ei->i_disksize = inode->i_size; 1472 1425 ret2 = ext3_mark_inode_dirty(handle, inode); 1473 1426 if (!ret) 1474 1427 ret = ret2; ··· 1626 1577 if (ext3_journal_current_handle()) 1627 1578 goto out_fail; 1628 1579 1580 + trace_ext3_ordered_writepage(page); 1629 1581 if (!page_has_buffers(page)) { 1630 1582 create_empty_buffers(page, inode->i_sb->s_blocksize, 1631 1583 (1 << BH_Dirty)|(1 << BH_Uptodate)); ··· 1697 1647 if (ext3_journal_current_handle()) 1698 1648 goto out_fail; 1699 1649 1650 + trace_ext3_writeback_writepage(page); 1700 1651 if (page_has_buffers(page)) { 1701 1652 if (!walk_page_buffers(NULL, page_buffers(page), 0, 1702 1653 PAGE_CACHE_SIZE, NULL, buffer_unmapped)) { ··· 1740 1689 if (ext3_journal_current_handle()) 1741 1690 goto no_write; 1742 1691 1692 + trace_ext3_journalled_writepage(page); 1743 1693 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); 1744 1694 if (IS_ERR(handle)) { 1745 1695 ret = PTR_ERR(handle); ··· 1767 1715 if (ret == 0) 1768 1716 ret = err; 1769 1717 ext3_set_inode_state(inode, EXT3_STATE_JDATA); 1718 + atomic_set(&EXT3_I(inode)->i_datasync_tid, 1719 + handle->h_transaction->t_tid); 1770 1720 unlock_page(page); 1771 1721 } else { 1772 1722 /* ··· 1793 1739 1794 1740 static int ext3_readpage(struct file *file, struct page *page) 1795 1741 { 1742 + trace_ext3_readpage(page); 1796 1743 return mpage_readpage(page, ext3_get_block); 1797 1744 } 1798 1745 ··· 1808 1753 { 1809 1754 journal_t *journal = EXT3_JOURNAL(page->mapping->host); 1810 1755 1756 + trace_ext3_invalidatepage(page, offset); 1757 + 1811 1758 /* 1812 1759 * If it's a full truncate we just forget about the pending dirtying 1813 1760 */ ··· 1823 1766 { 1824 1767 journal_t *journal = EXT3_JOURNAL(page->mapping->host); 1825 1768 1769 + trace_ext3_releasepage(page); 1826 1770 WARN_ON(PageChecked(page)); 1827 1771 if (!page_has_buffers(page)) 1828 1772 return 0; ··· 1851 1793 int orphan = 0; 1852 1794 size_t count = iov_length(iov, nr_segs); 1853 1795 int retries = 0; 1796 + 1797 + trace_ext3_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw); 1854 1798 1855 1799 if (rw == WRITE) { 1856 1800 loff_t final_size = offset + count; ··· 1887 1827 loff_t end = offset + iov_length(iov, nr_segs); 1888 1828 1889 1829 if (end > isize) 1890 - vmtruncate(inode, isize); 1830 + ext3_truncate_failed_direct_write(inode); 1891 1831 } 1892 1832 if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) 1893 1833 goto retry; ··· 1901 1841 /* This is really bad luck. We've written the data 1902 1842 * but cannot extend i_size. Truncate allocated blocks 1903 1843 * and pretend the write failed... */ 1904 - ext3_truncate(inode); 1844 + ext3_truncate_failed_direct_write(inode); 1905 1845 ret = PTR_ERR(handle); 1906 1846 goto out; 1907 1847 } ··· 1927 1867 ret = err; 1928 1868 } 1929 1869 out: 1870 + trace_ext3_direct_IO_exit(inode, offset, 1871 + iov_length(iov, nr_segs), rw, ret); 1930 1872 return ret; 1931 1873 } 1932 1874 ··· 2011 1949 * This required during truncate. We need to physically zero the tail end 2012 1950 * of that block so it doesn't yield old data if the file is later grown. 2013 1951 */ 2014 - static int ext3_block_truncate_page(handle_t *handle, struct page *page, 2015 - struct address_space *mapping, loff_t from) 1952 + static int ext3_block_truncate_page(struct inode *inode, loff_t from) 2016 1953 { 2017 1954 ext3_fsblk_t index = from >> PAGE_CACHE_SHIFT; 2018 - unsigned offset = from & (PAGE_CACHE_SIZE-1); 1955 + unsigned offset = from & (PAGE_CACHE_SIZE - 1); 2019 1956 unsigned blocksize, iblock, length, pos; 2020 - struct inode *inode = mapping->host; 1957 + struct page *page; 1958 + handle_t *handle = NULL; 2021 1959 struct buffer_head *bh; 2022 1960 int err = 0; 2023 1961 1962 + /* Truncated on block boundary - nothing to do */ 2024 1963 blocksize = inode->i_sb->s_blocksize; 1964 + if ((from & (blocksize - 1)) == 0) 1965 + return 0; 1966 + 1967 + page = grab_cache_page(inode->i_mapping, index); 1968 + if (!page) 1969 + return -ENOMEM; 2025 1970 length = blocksize - (offset & (blocksize - 1)); 2026 1971 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); 2027 1972 ··· 2073 2004 goto unlock; 2074 2005 } 2075 2006 2007 + /* data=writeback mode doesn't need transaction to zero-out data */ 2008 + if (!ext3_should_writeback_data(inode)) { 2009 + /* We journal at most one block */ 2010 + handle = ext3_journal_start(inode, 1); 2011 + if (IS_ERR(handle)) { 2012 + clear_highpage(page); 2013 + flush_dcache_page(page); 2014 + err = PTR_ERR(handle); 2015 + goto unlock; 2016 + } 2017 + } 2018 + 2076 2019 if (ext3_should_journal_data(inode)) { 2077 2020 BUFFER_TRACE(bh, "get write access"); 2078 2021 err = ext3_journal_get_write_access(handle, bh); 2079 2022 if (err) 2080 - goto unlock; 2023 + goto stop; 2081 2024 } 2082 2025 2083 2026 zero_user(page, offset, length); ··· 2103 2022 err = ext3_journal_dirty_data(handle, bh); 2104 2023 mark_buffer_dirty(bh); 2105 2024 } 2025 + stop: 2026 + if (handle) 2027 + ext3_journal_stop(handle); 2106 2028 2107 2029 unlock: 2108 2030 unlock_page(page); ··· 2474 2390 2475 2391 int ext3_can_truncate(struct inode *inode) 2476 2392 { 2477 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 2478 - return 0; 2479 2393 if (S_ISREG(inode->i_mode)) 2480 2394 return 1; 2481 2395 if (S_ISDIR(inode->i_mode)) ··· 2517 2435 struct ext3_inode_info *ei = EXT3_I(inode); 2518 2436 __le32 *i_data = ei->i_data; 2519 2437 int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb); 2520 - struct address_space *mapping = inode->i_mapping; 2521 2438 int offsets[4]; 2522 2439 Indirect chain[4]; 2523 2440 Indirect *partial; ··· 2524 2443 int n; 2525 2444 long last_block; 2526 2445 unsigned blocksize = inode->i_sb->s_blocksize; 2527 - struct page *page; 2446 + 2447 + trace_ext3_truncate_enter(inode); 2528 2448 2529 2449 if (!ext3_can_truncate(inode)) 2530 2450 goto out_notrans; ··· 2533 2451 if (inode->i_size == 0 && ext3_should_writeback_data(inode)) 2534 2452 ext3_set_inode_state(inode, EXT3_STATE_FLUSH_ON_CLOSE); 2535 2453 2536 - /* 2537 - * We have to lock the EOF page here, because lock_page() nests 2538 - * outside journal_start(). 2539 - */ 2540 - if ((inode->i_size & (blocksize - 1)) == 0) { 2541 - /* Block boundary? Nothing to do */ 2542 - page = NULL; 2543 - } else { 2544 - page = grab_cache_page(mapping, 2545 - inode->i_size >> PAGE_CACHE_SHIFT); 2546 - if (!page) 2547 - goto out_notrans; 2548 - } 2549 - 2550 2454 handle = start_transaction(inode); 2551 - if (IS_ERR(handle)) { 2552 - if (page) { 2553 - clear_highpage(page); 2554 - flush_dcache_page(page); 2555 - unlock_page(page); 2556 - page_cache_release(page); 2557 - } 2455 + if (IS_ERR(handle)) 2558 2456 goto out_notrans; 2559 - } 2560 2457 2561 2458 last_block = (inode->i_size + blocksize-1) 2562 2459 >> EXT3_BLOCK_SIZE_BITS(inode->i_sb); 2563 - 2564 - if (page) 2565 - ext3_block_truncate_page(handle, page, mapping, inode->i_size); 2566 - 2567 2460 n = ext3_block_to_path(inode, last_block, offsets, NULL); 2568 2461 if (n == 0) 2569 2462 goto out_stop; /* error */ ··· 2653 2596 ext3_orphan_del(handle, inode); 2654 2597 2655 2598 ext3_journal_stop(handle); 2599 + trace_ext3_truncate_exit(inode); 2656 2600 return; 2657 2601 out_notrans: 2658 2602 /* ··· 2662 2604 */ 2663 2605 if (inode->i_nlink) 2664 2606 ext3_orphan_del(NULL, inode); 2607 + trace_ext3_truncate_exit(inode); 2665 2608 } 2666 2609 2667 2610 static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, ··· 2804 2745 * has in-inode xattrs, or we don't have this inode in memory. 2805 2746 * Read the block from disk. 2806 2747 */ 2748 + trace_ext3_load_inode(inode); 2807 2749 get_bh(bh); 2808 2750 bh->b_end_io = end_buffer_read_sync; 2809 2751 submit_bh(READ_META, bh); ··· 3289 3229 } 3290 3230 3291 3231 error = ext3_orphan_add(handle, inode); 3232 + if (error) { 3233 + ext3_journal_stop(handle); 3234 + goto err_out; 3235 + } 3292 3236 EXT3_I(inode)->i_disksize = attr->ia_size; 3293 - rc = ext3_mark_inode_dirty(handle, inode); 3294 - if (!error) 3295 - error = rc; 3237 + error = ext3_mark_inode_dirty(handle, inode); 3296 3238 ext3_journal_stop(handle); 3239 + if (error) { 3240 + /* Some hard fs error must have happened. Bail out. */ 3241 + ext3_orphan_del(NULL, inode); 3242 + goto err_out; 3243 + } 3244 + rc = ext3_block_truncate_page(inode, attr->ia_size); 3245 + if (rc) { 3246 + /* Cleanup orphan list and exit */ 3247 + handle = ext3_journal_start(inode, 3); 3248 + if (IS_ERR(handle)) { 3249 + ext3_orphan_del(NULL, inode); 3250 + goto err_out; 3251 + } 3252 + ext3_orphan_del(handle, inode); 3253 + ext3_journal_stop(handle); 3254 + goto err_out; 3255 + } 3297 3256 } 3298 3257 3299 3258 if ((attr->ia_valid & ATTR_SIZE) && 3300 3259 attr->ia_size != i_size_read(inode)) { 3301 - rc = vmtruncate(inode, attr->ia_size); 3302 - if (rc) 3303 - goto err_out; 3260 + truncate_setsize(inode, attr->ia_size); 3261 + ext3_truncate(inode); 3304 3262 } 3305 3263 3306 3264 setattr_copy(inode, attr); ··· 3452 3374 int err; 3453 3375 3454 3376 might_sleep(); 3377 + trace_ext3_mark_inode_dirty(inode, _RET_IP_); 3455 3378 err = ext3_reserve_inode_write(handle, inode, &iloc); 3456 3379 if (!err) 3457 3380 err = ext3_mark_iloc_dirty(handle, inode, &iloc);
+2 -2
fs/ext3/ioctl.c
··· 285 285 if (!capable(CAP_SYS_ADMIN)) 286 286 return -EPERM; 287 287 288 - if (copy_from_user(&range, (struct fstrim_range *)arg, 288 + if (copy_from_user(&range, (struct fstrim_range __user *)arg, 289 289 sizeof(range))) 290 290 return -EFAULT; 291 291 ··· 293 293 if (ret < 0) 294 294 return ret; 295 295 296 - if (copy_to_user((struct fstrim_range *)arg, &range, 296 + if (copy_to_user((struct fstrim_range __user *)arg, &range, 297 297 sizeof(range))) 298 298 return -EFAULT; 299 299
+5 -2
fs/ext3/namei.c
··· 36 36 #include <linux/quotaops.h> 37 37 #include <linux/buffer_head.h> 38 38 #include <linux/bio.h> 39 + #include <trace/events/ext3.h> 39 40 40 41 #include "namei.h" 41 42 #include "xattr.h" ··· 288 287 while (len--) printk("%c", *name++); 289 288 ext3fs_dirhash(de->name, de->name_len, &h); 290 289 printk(":%x.%u ", h.hash, 291 - ((char *) de - base)); 290 + (unsigned) ((char *) de - base)); 292 291 } 293 292 space += EXT3_DIR_REC_LEN(de->name_len); 294 293 names++; ··· 1014 1013 1015 1014 *err = -ENOENT; 1016 1015 errout: 1017 - dxtrace(printk("%s not found\n", name)); 1016 + dxtrace(printk("%s not found\n", entry->name)); 1018 1017 dx_release (frames); 1019 1018 return NULL; 1020 1019 } ··· 2141 2140 struct ext3_dir_entry_2 * de; 2142 2141 handle_t *handle; 2143 2142 2143 + trace_ext3_unlink_enter(dir, dentry); 2144 2144 /* Initialize quotas before so that eventual writes go 2145 2145 * in separate transaction */ 2146 2146 dquot_initialize(dir); ··· 2187 2185 end_unlink: 2188 2186 ext3_journal_stop(handle); 2189 2187 brelse (bh); 2188 + trace_ext3_unlink_exit(dentry, retval); 2190 2189 return retval; 2191 2190 } 2192 2191
+13
fs/ext3/super.c
··· 44 44 #include "acl.h" 45 45 #include "namei.h" 46 46 47 + #define CREATE_TRACE_POINTS 48 + #include <trace/events/ext3.h> 49 + 47 50 #ifdef CONFIG_EXT3_DEFAULTS_TO_ORDERED 48 51 #define EXT3_MOUNT_DEFAULT_DATA_MODE EXT3_MOUNT_ORDERED_DATA 49 52 #else ··· 500 497 return &ei->vfs_inode; 501 498 } 502 499 500 + static int ext3_drop_inode(struct inode *inode) 501 + { 502 + int drop = generic_drop_inode(inode); 503 + 504 + trace_ext3_drop_inode(inode, drop); 505 + return drop; 506 + } 507 + 503 508 static void ext3_i_callback(struct rcu_head *head) 504 509 { 505 510 struct inode *inode = container_of(head, struct inode, i_rcu); ··· 799 788 .destroy_inode = ext3_destroy_inode, 800 789 .write_inode = ext3_write_inode, 801 790 .dirty_inode = ext3_dirty_inode, 791 + .drop_inode = ext3_drop_inode, 802 792 .evict_inode = ext3_evict_inode, 803 793 .put_super = ext3_put_super, 804 794 .sync_fs = ext3_sync_fs, ··· 2521 2509 { 2522 2510 tid_t target; 2523 2511 2512 + trace_ext3_sync_fs(sb, wait); 2524 2513 if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) { 2525 2514 if (wait) 2526 2515 log_wait_commit(EXT3_SB(sb)->s_journal, target);
+10 -2
fs/ext3/xattr.c
··· 803 803 /* We need to allocate a new block */ 804 804 ext3_fsblk_t goal = ext3_group_first_block_no(sb, 805 805 EXT3_I(inode)->i_block_group); 806 - ext3_fsblk_t block = ext3_new_block(handle, inode, 807 - goal, &error); 806 + ext3_fsblk_t block; 807 + 808 + /* 809 + * Protect us agaist concurrent allocations to the 810 + * same inode from ext3_..._writepage(). Reservation 811 + * code does not expect racing allocations. 812 + */ 813 + mutex_lock(&EXT3_I(inode)->truncate_mutex); 814 + block = ext3_new_block(handle, inode, goal, &error); 815 + mutex_unlock(&EXT3_I(inode)->truncate_mutex); 808 816 if (error) 809 817 goto cleanup; 810 818 ea_idebug(inode, "creating block %d", block);
+24 -13
fs/jbd/checkpoint.c
··· 22 22 #include <linux/jbd.h> 23 23 #include <linux/errno.h> 24 24 #include <linux/slab.h> 25 + #include <linux/blkdev.h> 26 + #include <trace/events/jbd.h> 25 27 26 28 /* 27 29 * Unlink a buffer from a transaction checkpoint list. ··· 97 95 98 96 if (jh->b_jlist == BJ_None && !buffer_locked(bh) && 99 97 !buffer_dirty(bh) && !buffer_write_io_error(bh)) { 98 + /* 99 + * Get our reference so that bh cannot be freed before 100 + * we unlock it 101 + */ 102 + get_bh(bh); 100 103 JBUFFER_TRACE(jh, "remove from checkpoint list"); 101 104 ret = __journal_remove_checkpoint(jh) + 1; 102 105 jbd_unlock_bh_state(bh); 103 - journal_remove_journal_head(bh); 104 106 BUFFER_TRACE(bh, "release"); 105 107 __brelse(bh); 106 108 } else { ··· 226 220 spin_lock(&journal->j_list_lock); 227 221 goto restart; 228 222 } 223 + get_bh(bh); 229 224 if (buffer_locked(bh)) { 230 - get_bh(bh); 231 225 spin_unlock(&journal->j_list_lock); 232 226 jbd_unlock_bh_state(bh); 233 227 wait_on_buffer(bh); ··· 246 240 */ 247 241 released = __journal_remove_checkpoint(jh); 248 242 jbd_unlock_bh_state(bh); 249 - journal_remove_journal_head(bh); 250 243 __brelse(bh); 251 244 } 252 245 ··· 258 253 __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count) 259 254 { 260 255 int i; 256 + struct blk_plug plug; 261 257 258 + blk_start_plug(&plug); 262 259 for (i = 0; i < *batch_count; i++) 263 - write_dirty_buffer(bhs[i], WRITE); 260 + write_dirty_buffer(bhs[i], WRITE_SYNC); 261 + blk_finish_plug(&plug); 264 262 265 263 for (i = 0; i < *batch_count; i++) { 266 264 struct buffer_head *bh = bhs[i]; ··· 312 304 ret = 1; 313 305 if (unlikely(buffer_write_io_error(bh))) 314 306 ret = -EIO; 307 + get_bh(bh); 315 308 J_ASSERT_JH(jh, !buffer_jbddirty(bh)); 316 309 BUFFER_TRACE(bh, "remove from checkpoint"); 317 310 __journal_remove_checkpoint(jh); 318 311 spin_unlock(&journal->j_list_lock); 319 312 jbd_unlock_bh_state(bh); 320 - journal_remove_journal_head(bh); 321 313 __brelse(bh); 322 314 } else { 323 315 /* ··· 366 358 * journal straight away. 367 359 */ 368 360 result = cleanup_journal_tail(journal); 361 + trace_jbd_checkpoint(journal, result); 369 362 jbd_debug(1, "cleanup_journal_tail returned %d\n", result); 370 363 if (result <= 0) 371 364 return result; ··· 512 503 if (blocknr < journal->j_tail) 513 504 freed = freed + journal->j_last - journal->j_first; 514 505 506 + trace_jbd_cleanup_journal_tail(journal, first_tid, blocknr, freed); 515 507 jbd_debug(1, 516 508 "Cleaning journal tail from %d to %d (offset %u), " 517 509 "freeing %u\n", ··· 533 523 /* 534 524 * journal_clean_one_cp_list 535 525 * 536 - * Find all the written-back checkpoint buffers in the given list and release them. 526 + * Find all the written-back checkpoint buffers in the given list and release 527 + * them. 537 528 * 538 - * Called with the journal locked. 539 529 * Called with j_list_lock held. 540 530 * Returns number of bufers reaped (for debug) 541 531 */ ··· 642 632 * checkpoint lists. 643 633 * 644 634 * The function returns 1 if it frees the transaction, 0 otherwise. 635 + * The function can free jh and bh. 645 636 * 646 - * This function is called with the journal locked. 647 637 * This function is called with j_list_lock held. 648 638 * This function is called with jbd_lock_bh_state(jh2bh(jh)) 649 639 */ ··· 662 652 } 663 653 journal = transaction->t_journal; 664 654 655 + JBUFFER_TRACE(jh, "removing from transaction"); 665 656 __buffer_unlink(jh); 666 657 jh->b_cp_transaction = NULL; 658 + journal_put_journal_head(jh); 667 659 668 660 if (transaction->t_checkpoint_list != NULL || 669 661 transaction->t_checkpoint_io_list != NULL) 670 662 goto out; 671 - JBUFFER_TRACE(jh, "transaction has no more buffers"); 672 663 673 664 /* 674 665 * There is one special case to worry about: if we have just pulled the ··· 680 669 * The locking here around t_state is a bit sleazy. 681 670 * See the comment at the end of journal_commit_transaction(). 682 671 */ 683 - if (transaction->t_state != T_FINISHED) { 684 - JBUFFER_TRACE(jh, "belongs to running/committing transaction"); 672 + if (transaction->t_state != T_FINISHED) 685 673 goto out; 686 - } 687 674 688 675 /* OK, that was the last buffer for the transaction: we can now 689 676 safely remove this transaction from the log */ ··· 693 684 wake_up(&journal->j_wait_logspace); 694 685 ret = 1; 695 686 out: 696 - JBUFFER_TRACE(jh, "exit"); 697 687 return ret; 698 688 } 699 689 ··· 711 703 J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh))); 712 704 J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); 713 705 706 + /* Get reference for checkpointing transaction */ 707 + journal_grab_journal_head(jh2bh(jh)); 714 708 jh->b_cp_transaction = transaction; 715 709 716 710 if (!transaction->t_checkpoint_list) { ··· 762 752 J_ASSERT(journal->j_committing_transaction != transaction); 763 753 J_ASSERT(journal->j_running_transaction != transaction); 764 754 755 + trace_jbd_drop_transaction(journal, transaction); 765 756 jbd_debug(1, "Dropping transaction %d, all done\n", transaction->t_tid); 766 757 kfree(transaction); 767 758 }
+32 -25
fs/jbd/commit.c
··· 21 21 #include <linux/pagemap.h> 22 22 #include <linux/bio.h> 23 23 #include <linux/blkdev.h> 24 + #include <trace/events/jbd.h> 24 25 25 26 /* 26 27 * Default IO end handler for temporary BJ_IO buffer_heads. ··· 205 204 if (!trylock_buffer(bh)) { 206 205 BUFFER_TRACE(bh, "needs blocking lock"); 207 206 spin_unlock(&journal->j_list_lock); 207 + trace_jbd_do_submit_data(journal, 208 + commit_transaction); 208 209 /* Write out all data to prevent deadlocks */ 209 210 journal_do_submit_data(wbuf, bufs, write_op); 210 211 bufs = 0; ··· 239 236 jbd_unlock_bh_state(bh); 240 237 if (bufs == journal->j_wbufsize) { 241 238 spin_unlock(&journal->j_list_lock); 239 + trace_jbd_do_submit_data(journal, 240 + commit_transaction); 242 241 journal_do_submit_data(wbuf, bufs, write_op); 243 242 bufs = 0; 244 243 goto write_out_data; ··· 258 253 jbd_unlock_bh_state(bh); 259 254 if (locked) 260 255 unlock_buffer(bh); 261 - journal_remove_journal_head(bh); 262 - /* One for our safety reference, other for 263 - * journal_remove_journal_head() */ 264 - put_bh(bh); 265 256 release_data_buffer(bh); 266 257 } 267 258 ··· 267 266 } 268 267 } 269 268 spin_unlock(&journal->j_list_lock); 269 + trace_jbd_do_submit_data(journal, commit_transaction); 270 270 journal_do_submit_data(wbuf, bufs, write_op); 271 271 272 272 return err; ··· 318 316 commit_transaction = journal->j_running_transaction; 319 317 J_ASSERT(commit_transaction->t_state == T_RUNNING); 320 318 319 + trace_jbd_start_commit(journal, commit_transaction); 321 320 jbd_debug(1, "JBD: starting commit of transaction %d\n", 322 321 commit_transaction->t_tid); 323 322 324 323 spin_lock(&journal->j_state_lock); 325 324 commit_transaction->t_state = T_LOCKED; 326 325 326 + trace_jbd_commit_locking(journal, commit_transaction); 327 327 spin_lock(&commit_transaction->t_handle_lock); 328 328 while (commit_transaction->t_updates) { 329 329 DEFINE_WAIT(wait); ··· 396 392 */ 397 393 journal_switch_revoke_table(journal); 398 394 395 + trace_jbd_commit_flushing(journal, commit_transaction); 399 396 commit_transaction->t_state = T_FLUSH; 400 397 journal->j_committing_transaction = commit_transaction; 401 398 journal->j_running_transaction = NULL; ··· 451 446 } 452 447 if (buffer_jbd(bh) && bh2jh(bh) == jh && 453 448 jh->b_transaction == commit_transaction && 454 - jh->b_jlist == BJ_Locked) { 449 + jh->b_jlist == BJ_Locked) 455 450 __journal_unfile_buffer(jh); 456 - jbd_unlock_bh_state(bh); 457 - journal_remove_journal_head(bh); 458 - put_bh(bh); 459 - } else { 460 - jbd_unlock_bh_state(bh); 461 - } 451 + jbd_unlock_bh_state(bh); 462 452 release_data_buffer(bh); 463 453 cond_resched_lock(&journal->j_list_lock); 464 454 } ··· 493 493 commit_transaction->t_state = T_COMMIT; 494 494 spin_unlock(&journal->j_state_lock); 495 495 496 + trace_jbd_commit_logging(journal, commit_transaction); 496 497 J_ASSERT(commit_transaction->t_nr_buffers <= 497 498 commit_transaction->t_outstanding_credits); 498 499 ··· 798 797 while (commit_transaction->t_forget) { 799 798 transaction_t *cp_transaction; 800 799 struct buffer_head *bh; 800 + int try_to_free = 0; 801 801 802 802 jh = commit_transaction->t_forget; 803 803 spin_unlock(&journal->j_list_lock); 804 804 bh = jh2bh(jh); 805 + /* 806 + * Get a reference so that bh cannot be freed before we are 807 + * done with it. 808 + */ 809 + get_bh(bh); 805 810 jbd_lock_bh_state(bh); 806 811 J_ASSERT_JH(jh, jh->b_transaction == commit_transaction || 807 812 jh->b_transaction == journal->j_running_transaction); ··· 865 858 __journal_insert_checkpoint(jh, commit_transaction); 866 859 if (is_journal_aborted(journal)) 867 860 clear_buffer_jbddirty(bh); 868 - JBUFFER_TRACE(jh, "refile for checkpoint writeback"); 869 - __journal_refile_buffer(jh); 870 - jbd_unlock_bh_state(bh); 871 861 } else { 872 862 J_ASSERT_BH(bh, !buffer_dirty(bh)); 873 - /* The buffer on BJ_Forget list and not jbddirty means 863 + /* 864 + * The buffer on BJ_Forget list and not jbddirty means 874 865 * it has been freed by this transaction and hence it 875 866 * could not have been reallocated until this 876 867 * transaction has committed. *BUT* it could be 877 868 * reallocated once we have written all the data to 878 869 * disk and before we process the buffer on BJ_Forget 879 - * list. */ 880 - JBUFFER_TRACE(jh, "refile or unfile freed buffer"); 881 - __journal_refile_buffer(jh); 882 - if (!jh->b_transaction) { 883 - jbd_unlock_bh_state(bh); 884 - /* needs a brelse */ 885 - journal_remove_journal_head(bh); 886 - release_buffer_page(bh); 887 - } else 888 - jbd_unlock_bh_state(bh); 870 + * list. 871 + */ 872 + if (!jh->b_next_transaction) 873 + try_to_free = 1; 889 874 } 875 + JBUFFER_TRACE(jh, "refile or unfile freed buffer"); 876 + __journal_refile_buffer(jh); 877 + jbd_unlock_bh_state(bh); 878 + if (try_to_free) 879 + release_buffer_page(bh); 880 + else 881 + __brelse(bh); 890 882 cond_resched_lock(&journal->j_list_lock); 891 883 } 892 884 spin_unlock(&journal->j_list_lock); ··· 952 946 } 953 947 spin_unlock(&journal->j_list_lock); 954 948 949 + trace_jbd_end_commit(journal, commit_transaction); 955 950 jbd_debug(1, "JBD: commit %d complete, head %d\n", 956 951 journal->j_commit_sequence, journal->j_tail_sequence); 957 952
+35 -64
fs/jbd/journal.c
··· 38 38 #include <linux/debugfs.h> 39 39 #include <linux/ratelimit.h> 40 40 41 + #define CREATE_TRACE_POINTS 42 + #include <trace/events/jbd.h> 43 + 41 44 #include <asm/uaccess.h> 42 45 #include <asm/page.h> 43 46 ··· 1068 1065 } else 1069 1066 write_dirty_buffer(bh, WRITE); 1070 1067 1068 + trace_jbd_update_superblock_end(journal, wait); 1071 1069 out: 1072 1070 /* If we have just flushed the log (by marking s_start==0), then 1073 1071 * any future commit will have to be careful to update the ··· 1803 1799 * When a buffer has its BH_JBD bit set it is immune from being released by 1804 1800 * core kernel code, mainly via ->b_count. 1805 1801 * 1806 - * A journal_head may be detached from its buffer_head when the journal_head's 1807 - * b_transaction, b_cp_transaction and b_next_transaction pointers are NULL. 1808 - * Various places in JBD call journal_remove_journal_head() to indicate that the 1809 - * journal_head can be dropped if needed. 1802 + * A journal_head is detached from its buffer_head when the journal_head's 1803 + * b_jcount reaches zero. Running transaction (b_transaction) and checkpoint 1804 + * transaction (b_cp_transaction) hold their references to b_jcount. 1810 1805 * 1811 1806 * Various places in the kernel want to attach a journal_head to a buffer_head 1812 1807 * _before_ attaching the journal_head to a transaction. To protect the ··· 1818 1815 * (Attach a journal_head if needed. Increments b_jcount) 1819 1816 * struct journal_head *jh = journal_add_journal_head(bh); 1820 1817 * ... 1821 - * jh->b_transaction = xxx; 1822 - * journal_put_journal_head(jh); 1823 - * 1824 - * Now, the journal_head's b_jcount is zero, but it is safe from being released 1825 - * because it has a non-zero b_transaction. 1818 + * (Get another reference for transaction) 1819 + * journal_grab_journal_head(bh); 1820 + * jh->b_transaction = xxx; 1821 + * (Put original reference) 1822 + * journal_put_journal_head(jh); 1826 1823 */ 1827 1824 1828 1825 /* 1829 1826 * Give a buffer_head a journal_head. 1830 1827 * 1831 - * Doesn't need the journal lock. 1832 1828 * May sleep. 1833 1829 */ 1834 1830 struct journal_head *journal_add_journal_head(struct buffer_head *bh) ··· 1891 1889 struct journal_head *jh = bh2jh(bh); 1892 1890 1893 1891 J_ASSERT_JH(jh, jh->b_jcount >= 0); 1894 - 1895 - get_bh(bh); 1896 - if (jh->b_jcount == 0) { 1897 - if (jh->b_transaction == NULL && 1898 - jh->b_next_transaction == NULL && 1899 - jh->b_cp_transaction == NULL) { 1900 - J_ASSERT_JH(jh, jh->b_jlist == BJ_None); 1901 - J_ASSERT_BH(bh, buffer_jbd(bh)); 1902 - J_ASSERT_BH(bh, jh2bh(jh) == bh); 1903 - BUFFER_TRACE(bh, "remove journal_head"); 1904 - if (jh->b_frozen_data) { 1905 - printk(KERN_WARNING "%s: freeing " 1906 - "b_frozen_data\n", 1907 - __func__); 1908 - jbd_free(jh->b_frozen_data, bh->b_size); 1909 - } 1910 - if (jh->b_committed_data) { 1911 - printk(KERN_WARNING "%s: freeing " 1912 - "b_committed_data\n", 1913 - __func__); 1914 - jbd_free(jh->b_committed_data, bh->b_size); 1915 - } 1916 - bh->b_private = NULL; 1917 - jh->b_bh = NULL; /* debug, really */ 1918 - clear_buffer_jbd(bh); 1919 - __brelse(bh); 1920 - journal_free_journal_head(jh); 1921 - } else { 1922 - BUFFER_TRACE(bh, "journal_head was locked"); 1923 - } 1892 + J_ASSERT_JH(jh, jh->b_transaction == NULL); 1893 + J_ASSERT_JH(jh, jh->b_next_transaction == NULL); 1894 + J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); 1895 + J_ASSERT_JH(jh, jh->b_jlist == BJ_None); 1896 + J_ASSERT_BH(bh, buffer_jbd(bh)); 1897 + J_ASSERT_BH(bh, jh2bh(jh) == bh); 1898 + BUFFER_TRACE(bh, "remove journal_head"); 1899 + if (jh->b_frozen_data) { 1900 + printk(KERN_WARNING "%s: freeing b_frozen_data\n", __func__); 1901 + jbd_free(jh->b_frozen_data, bh->b_size); 1924 1902 } 1903 + if (jh->b_committed_data) { 1904 + printk(KERN_WARNING "%s: freeing b_committed_data\n", __func__); 1905 + jbd_free(jh->b_committed_data, bh->b_size); 1906 + } 1907 + bh->b_private = NULL; 1908 + jh->b_bh = NULL; /* debug, really */ 1909 + clear_buffer_jbd(bh); 1910 + journal_free_journal_head(jh); 1925 1911 } 1926 1912 1927 1913 /* 1928 - * journal_remove_journal_head(): if the buffer isn't attached to a transaction 1929 - * and has a zero b_jcount then remove and release its journal_head. If we did 1930 - * see that the buffer is not used by any transaction we also "logically" 1931 - * decrement ->b_count. 1932 - * 1933 - * We in fact take an additional increment on ->b_count as a convenience, 1934 - * because the caller usually wants to do additional things with the bh 1935 - * after calling here. 1936 - * The caller of journal_remove_journal_head() *must* run __brelse(bh) at some 1937 - * time. Once the caller has run __brelse(), the buffer is eligible for 1938 - * reaping by try_to_free_buffers(). 1939 - */ 1940 - void journal_remove_journal_head(struct buffer_head *bh) 1941 - { 1942 - jbd_lock_bh_journal_head(bh); 1943 - __journal_remove_journal_head(bh); 1944 - jbd_unlock_bh_journal_head(bh); 1945 - } 1946 - 1947 - /* 1948 - * Drop a reference on the passed journal_head. If it fell to zero then try to 1914 + * Drop a reference on the passed journal_head. If it fell to zero then 1949 1915 * release the journal_head from the buffer_head. 1950 1916 */ 1951 1917 void journal_put_journal_head(struct journal_head *jh) ··· 1923 1953 jbd_lock_bh_journal_head(bh); 1924 1954 J_ASSERT_JH(jh, jh->b_jcount > 0); 1925 1955 --jh->b_jcount; 1926 - if (!jh->b_jcount && !jh->b_transaction) { 1956 + if (!jh->b_jcount) { 1927 1957 __journal_remove_journal_head(bh); 1958 + jbd_unlock_bh_journal_head(bh); 1928 1959 __brelse(bh); 1929 - } 1930 - jbd_unlock_bh_journal_head(bh); 1960 + } else 1961 + jbd_unlock_bh_journal_head(bh); 1931 1962 } 1932 1963 1933 1964 /*
+41 -40
fs/jbd/transaction.c
··· 26 26 #include <linux/mm.h> 27 27 #include <linux/highmem.h> 28 28 #include <linux/hrtimer.h> 29 + #include <linux/backing-dev.h> 29 30 30 31 static void __journal_temp_unlink_buffer(struct journal_head *jh); 31 32 ··· 100 99 101 100 alloc_transaction: 102 101 if (!journal->j_running_transaction) { 103 - new_transaction = kzalloc(sizeof(*new_transaction), 104 - GFP_NOFS|__GFP_NOFAIL); 102 + new_transaction = kzalloc(sizeof(*new_transaction), GFP_NOFS); 105 103 if (!new_transaction) { 106 - ret = -ENOMEM; 107 - goto out; 104 + congestion_wait(BLK_RW_ASYNC, HZ/50); 105 + goto alloc_transaction; 108 106 } 109 107 } 110 108 ··· 696 696 if (!jh->b_transaction) { 697 697 JBUFFER_TRACE(jh, "no transaction"); 698 698 J_ASSERT_JH(jh, !jh->b_next_transaction); 699 - jh->b_transaction = transaction; 700 699 JBUFFER_TRACE(jh, "file as BJ_Reserved"); 701 700 spin_lock(&journal->j_list_lock); 702 701 __journal_file_buffer(jh, transaction, BJ_Reserved); ··· 817 818 * committed and so it's safe to clear the dirty bit. 818 819 */ 819 820 clear_buffer_dirty(jh2bh(jh)); 820 - jh->b_transaction = transaction; 821 821 822 822 /* first access by this transaction */ 823 823 jh->b_modified = 0; ··· 842 844 */ 843 845 JBUFFER_TRACE(jh, "cancelling revoke"); 844 846 journal_cancel_revoke(handle, jh); 845 - journal_put_journal_head(jh); 846 847 out: 848 + journal_put_journal_head(jh); 847 849 return err; 848 850 } 849 851 ··· 1067 1069 ret = -EIO; 1068 1070 goto no_journal; 1069 1071 } 1070 - 1071 - if (jh->b_transaction != NULL) { 1072 + /* We might have slept so buffer could be refiled now */ 1073 + if (jh->b_transaction != NULL && 1074 + jh->b_transaction != handle->h_transaction) { 1072 1075 JBUFFER_TRACE(jh, "unfile from commit"); 1073 1076 __journal_temp_unlink_buffer(jh); 1074 1077 /* It still points to the committing ··· 1090 1091 if (jh->b_jlist != BJ_SyncData && jh->b_jlist != BJ_Locked) { 1091 1092 JBUFFER_TRACE(jh, "not on correct data list: unfile"); 1092 1093 J_ASSERT_JH(jh, jh->b_jlist != BJ_Shadow); 1093 - __journal_temp_unlink_buffer(jh); 1094 - jh->b_transaction = handle->h_transaction; 1095 1094 JBUFFER_TRACE(jh, "file as data"); 1096 1095 __journal_file_buffer(jh, handle->h_transaction, 1097 1096 BJ_SyncData); ··· 1297 1300 __journal_file_buffer(jh, transaction, BJ_Forget); 1298 1301 } else { 1299 1302 __journal_unfile_buffer(jh); 1300 - journal_remove_journal_head(bh); 1301 - __brelse(bh); 1302 1303 if (!buffer_jbd(bh)) { 1303 1304 spin_unlock(&journal->j_list_lock); 1304 1305 jbd_unlock_bh_state(bh); ··· 1617 1622 mark_buffer_dirty(bh); /* Expose it to the VM */ 1618 1623 } 1619 1624 1625 + /* 1626 + * Remove buffer from all transactions. 1627 + * 1628 + * Called with bh_state lock and j_list_lock 1629 + * 1630 + * jh and bh may be already freed when this function returns. 1631 + */ 1620 1632 void __journal_unfile_buffer(struct journal_head *jh) 1621 1633 { 1622 1634 __journal_temp_unlink_buffer(jh); 1623 1635 jh->b_transaction = NULL; 1636 + journal_put_journal_head(jh); 1624 1637 } 1625 1638 1626 1639 void journal_unfile_buffer(journal_t *journal, struct journal_head *jh) 1627 1640 { 1628 - jbd_lock_bh_state(jh2bh(jh)); 1641 + struct buffer_head *bh = jh2bh(jh); 1642 + 1643 + /* Get reference so that buffer cannot be freed before we unlock it */ 1644 + get_bh(bh); 1645 + jbd_lock_bh_state(bh); 1629 1646 spin_lock(&journal->j_list_lock); 1630 1647 __journal_unfile_buffer(jh); 1631 1648 spin_unlock(&journal->j_list_lock); 1632 - jbd_unlock_bh_state(jh2bh(jh)); 1649 + jbd_unlock_bh_state(bh); 1650 + __brelse(bh); 1633 1651 } 1634 1652 1635 1653 /* ··· 1669 1661 /* A written-back ordered data buffer */ 1670 1662 JBUFFER_TRACE(jh, "release data"); 1671 1663 __journal_unfile_buffer(jh); 1672 - journal_remove_journal_head(bh); 1673 - __brelse(bh); 1674 1664 } 1675 1665 } else if (jh->b_cp_transaction != NULL && jh->b_transaction == NULL) { 1676 1666 /* written-back checkpointed metadata buffer */ 1677 1667 if (jh->b_jlist == BJ_None) { 1678 1668 JBUFFER_TRACE(jh, "remove from checkpoint list"); 1679 1669 __journal_remove_checkpoint(jh); 1680 - journal_remove_journal_head(bh); 1681 - __brelse(bh); 1682 1670 } 1683 1671 } 1684 1672 spin_unlock(&journal->j_list_lock); ··· 1737 1733 /* 1738 1734 * We take our own ref against the journal_head here to avoid 1739 1735 * having to add tons of locking around each instance of 1740 - * journal_remove_journal_head() and journal_put_journal_head(). 1736 + * journal_put_journal_head(). 1741 1737 */ 1742 1738 jh = journal_grab_journal_head(bh); 1743 1739 if (!jh) ··· 1774 1770 int may_free = 1; 1775 1771 struct buffer_head *bh = jh2bh(jh); 1776 1772 1777 - __journal_unfile_buffer(jh); 1778 - 1779 1773 if (jh->b_cp_transaction) { 1780 1774 JBUFFER_TRACE(jh, "on running+cp transaction"); 1775 + __journal_temp_unlink_buffer(jh); 1781 1776 /* 1782 1777 * We don't want to write the buffer anymore, clear the 1783 1778 * bit so that we don't confuse checks in ··· 1787 1784 may_free = 0; 1788 1785 } else { 1789 1786 JBUFFER_TRACE(jh, "on running transaction"); 1790 - journal_remove_journal_head(bh); 1791 - __brelse(bh); 1787 + __journal_unfile_buffer(jh); 1792 1788 } 1793 1789 return may_free; 1794 1790 } ··· 2072 2070 2073 2071 if (jh->b_transaction) 2074 2072 __journal_temp_unlink_buffer(jh); 2073 + else 2074 + journal_grab_journal_head(bh); 2075 2075 jh->b_transaction = transaction; 2076 2076 2077 2077 switch (jlist) { ··· 2131 2127 * already started to be used by a subsequent transaction, refile the 2132 2128 * buffer on that transaction's metadata list. 2133 2129 * 2134 - * Called under journal->j_list_lock 2135 - * 2130 + * Called under j_list_lock 2136 2131 * Called under jbd_lock_bh_state(jh2bh(jh)) 2132 + * 2133 + * jh and bh may be already free when this function returns 2137 2134 */ 2138 2135 void __journal_refile_buffer(struct journal_head *jh) 2139 2136 { ··· 2158 2153 2159 2154 was_dirty = test_clear_buffer_jbddirty(bh); 2160 2155 __journal_temp_unlink_buffer(jh); 2156 + /* 2157 + * We set b_transaction here because b_next_transaction will inherit 2158 + * our jh reference and thus __journal_file_buffer() must not take a 2159 + * new one. 2160 + */ 2161 2161 jh->b_transaction = jh->b_next_transaction; 2162 2162 jh->b_next_transaction = NULL; 2163 2163 if (buffer_freed(bh)) ··· 2179 2169 } 2180 2170 2181 2171 /* 2182 - * For the unlocked version of this call, also make sure that any 2183 - * hanging journal_head is cleaned up if necessary. 2172 + * __journal_refile_buffer() with necessary locking added. We take our bh 2173 + * reference so that we can safely unlock bh. 2184 2174 * 2185 - * __journal_refile_buffer is usually called as part of a single locked 2186 - * operation on a buffer_head, in which the caller is probably going to 2187 - * be hooking the journal_head onto other lists. In that case it is up 2188 - * to the caller to remove the journal_head if necessary. For the 2189 - * unlocked journal_refile_buffer call, the caller isn't going to be 2190 - * doing anything else to the buffer so we need to do the cleanup 2191 - * ourselves to avoid a jh leak. 2192 - * 2193 - * *** The journal_head may be freed by this call! *** 2175 + * The jh and bh may be freed by this call. 2194 2176 */ 2195 2177 void journal_refile_buffer(journal_t *journal, struct journal_head *jh) 2196 2178 { 2197 2179 struct buffer_head *bh = jh2bh(jh); 2198 2180 2181 + /* Get reference so that buffer cannot be freed before we unlock it */ 2182 + get_bh(bh); 2199 2183 jbd_lock_bh_state(bh); 2200 2184 spin_lock(&journal->j_list_lock); 2201 - 2202 2185 __journal_refile_buffer(jh); 2203 2186 jbd_unlock_bh_state(bh); 2204 - journal_remove_journal_head(bh); 2205 - 2206 2187 spin_unlock(&journal->j_list_lock); 2207 2188 __brelse(bh); 2208 2189 }
+1
include/linux/ext2_fs.h
··· 18 18 19 19 #include <linux/types.h> 20 20 #include <linux/magic.h> 21 + #include <linux/fs.h> 21 22 22 23 /* 23 24 * The second extended filesystem constants/structures
+3 -4
include/linux/ext3_fs.h
··· 418 418 #define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS 419 419 #endif 420 420 421 - #define ext3_set_bit __test_and_set_bit_le 421 + #define ext3_set_bit __set_bit_le 422 422 #define ext3_set_bit_atomic ext2_set_bit_atomic 423 - #define ext3_clear_bit __test_and_clear_bit_le 423 + #define ext3_clear_bit __clear_bit_le 424 424 #define ext3_clear_bit_atomic ext2_clear_bit_atomic 425 425 #define ext3_test_bit test_bit_le 426 - #define ext3_find_first_zero_bit find_first_zero_bit_le 427 426 #define ext3_find_next_zero_bit find_next_zero_bit_le 428 427 429 428 /* ··· 912 913 extern int ext3_change_inode_journal_flag(struct inode *, int); 913 914 extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *); 914 915 extern int ext3_can_truncate(struct inode *inode); 915 - extern void ext3_truncate (struct inode *); 916 + extern void ext3_truncate(struct inode *inode); 916 917 extern void ext3_set_inode_flags(struct inode *); 917 918 extern void ext3_get_inode_flags(struct ext3_inode_info *); 918 919 extern void ext3_set_aops(struct inode *inode);
-1
include/linux/jbd.h
··· 940 940 */ 941 941 struct journal_head *journal_add_journal_head(struct buffer_head *bh); 942 942 struct journal_head *journal_grab_journal_head(struct buffer_head *bh); 943 - void journal_remove_journal_head(struct buffer_head *bh); 944 943 void journal_put_journal_head(struct journal_head *jh); 945 944 946 945 /*
+1 -1
include/linux/journal-head.h
··· 45 45 * has been cowed 46 46 * [jbd_lock_bh_state()] 47 47 */ 48 - unsigned b_cow_tid; 48 + tid_t b_cow_tid; 49 49 50 50 /* 51 51 * Copy of the buffer data frozen for writing to the log.
-8
include/linux/quota.h
··· 415 415 {QFMT_VFS_V0, "quota_v2"},\ 416 416 {0, NULL}} 417 417 418 - #else 419 - 420 - # /* nodep */ include <sys/cdefs.h> 421 - 422 - __BEGIN_DECLS 423 - long quotactl __P ((unsigned int, const char *, int, caddr_t)); 424 - __END_DECLS 425 - 426 418 #endif /* __KERNEL__ */ 427 419 #endif /* _QUOTA_ */
+864
include/trace/events/ext3.h
··· 1 + #undef TRACE_SYSTEM 2 + #define TRACE_SYSTEM ext3 3 + 4 + #if !defined(_TRACE_EXT3_H) || defined(TRACE_HEADER_MULTI_READ) 5 + #define _TRACE_EXT3_H 6 + 7 + #include <linux/tracepoint.h> 8 + 9 + TRACE_EVENT(ext3_free_inode, 10 + TP_PROTO(struct inode *inode), 11 + 12 + TP_ARGS(inode), 13 + 14 + TP_STRUCT__entry( 15 + __field( dev_t, dev ) 16 + __field( ino_t, ino ) 17 + __field( umode_t, mode ) 18 + __field( uid_t, uid ) 19 + __field( gid_t, gid ) 20 + __field( blkcnt_t, blocks ) 21 + ), 22 + 23 + TP_fast_assign( 24 + __entry->dev = inode->i_sb->s_dev; 25 + __entry->ino = inode->i_ino; 26 + __entry->mode = inode->i_mode; 27 + __entry->uid = inode->i_uid; 28 + __entry->gid = inode->i_gid; 29 + __entry->blocks = inode->i_blocks; 30 + ), 31 + 32 + TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %lu", 33 + MAJOR(__entry->dev), MINOR(__entry->dev), 34 + (unsigned long) __entry->ino, 35 + __entry->mode, __entry->uid, __entry->gid, 36 + (unsigned long) __entry->blocks) 37 + ); 38 + 39 + TRACE_EVENT(ext3_request_inode, 40 + TP_PROTO(struct inode *dir, int mode), 41 + 42 + TP_ARGS(dir, mode), 43 + 44 + TP_STRUCT__entry( 45 + __field( dev_t, dev ) 46 + __field( ino_t, dir ) 47 + __field( umode_t, mode ) 48 + ), 49 + 50 + TP_fast_assign( 51 + __entry->dev = dir->i_sb->s_dev; 52 + __entry->dir = dir->i_ino; 53 + __entry->mode = mode; 54 + ), 55 + 56 + TP_printk("dev %d,%d dir %lu mode 0%o", 57 + MAJOR(__entry->dev), MINOR(__entry->dev), 58 + (unsigned long) __entry->dir, __entry->mode) 59 + ); 60 + 61 + TRACE_EVENT(ext3_allocate_inode, 62 + TP_PROTO(struct inode *inode, struct inode *dir, int mode), 63 + 64 + TP_ARGS(inode, dir, mode), 65 + 66 + TP_STRUCT__entry( 67 + __field( dev_t, dev ) 68 + __field( ino_t, ino ) 69 + __field( ino_t, dir ) 70 + __field( umode_t, mode ) 71 + ), 72 + 73 + TP_fast_assign( 74 + __entry->dev = inode->i_sb->s_dev; 75 + __entry->ino = inode->i_ino; 76 + __entry->dir = dir->i_ino; 77 + __entry->mode = mode; 78 + ), 79 + 80 + TP_printk("dev %d,%d ino %lu dir %lu mode 0%o", 81 + MAJOR(__entry->dev), MINOR(__entry->dev), 82 + (unsigned long) __entry->ino, 83 + (unsigned long) __entry->dir, __entry->mode) 84 + ); 85 + 86 + TRACE_EVENT(ext3_evict_inode, 87 + TP_PROTO(struct inode *inode), 88 + 89 + TP_ARGS(inode), 90 + 91 + TP_STRUCT__entry( 92 + __field( dev_t, dev ) 93 + __field( ino_t, ino ) 94 + __field( int, nlink ) 95 + ), 96 + 97 + TP_fast_assign( 98 + __entry->dev = inode->i_sb->s_dev; 99 + __entry->ino = inode->i_ino; 100 + __entry->nlink = inode->i_nlink; 101 + ), 102 + 103 + TP_printk("dev %d,%d ino %lu nlink %d", 104 + MAJOR(__entry->dev), MINOR(__entry->dev), 105 + (unsigned long) __entry->ino, __entry->nlink) 106 + ); 107 + 108 + TRACE_EVENT(ext3_drop_inode, 109 + TP_PROTO(struct inode *inode, int drop), 110 + 111 + TP_ARGS(inode, drop), 112 + 113 + TP_STRUCT__entry( 114 + __field( dev_t, dev ) 115 + __field( ino_t, ino ) 116 + __field( int, drop ) 117 + ), 118 + 119 + TP_fast_assign( 120 + __entry->dev = inode->i_sb->s_dev; 121 + __entry->ino = inode->i_ino; 122 + __entry->drop = drop; 123 + ), 124 + 125 + TP_printk("dev %d,%d ino %lu drop %d", 126 + MAJOR(__entry->dev), MINOR(__entry->dev), 127 + (unsigned long) __entry->ino, __entry->drop) 128 + ); 129 + 130 + TRACE_EVENT(ext3_mark_inode_dirty, 131 + TP_PROTO(struct inode *inode, unsigned long IP), 132 + 133 + TP_ARGS(inode, IP), 134 + 135 + TP_STRUCT__entry( 136 + __field( dev_t, dev ) 137 + __field( ino_t, ino ) 138 + __field(unsigned long, ip ) 139 + ), 140 + 141 + TP_fast_assign( 142 + __entry->dev = inode->i_sb->s_dev; 143 + __entry->ino = inode->i_ino; 144 + __entry->ip = IP; 145 + ), 146 + 147 + TP_printk("dev %d,%d ino %lu caller %pF", 148 + MAJOR(__entry->dev), MINOR(__entry->dev), 149 + (unsigned long) __entry->ino, (void *)__entry->ip) 150 + ); 151 + 152 + TRACE_EVENT(ext3_write_begin, 153 + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 154 + unsigned int flags), 155 + 156 + TP_ARGS(inode, pos, len, flags), 157 + 158 + TP_STRUCT__entry( 159 + __field( dev_t, dev ) 160 + __field( ino_t, ino ) 161 + __field( loff_t, pos ) 162 + __field( unsigned int, len ) 163 + __field( unsigned int, flags ) 164 + ), 165 + 166 + TP_fast_assign( 167 + __entry->dev = inode->i_sb->s_dev; 168 + __entry->ino = inode->i_ino; 169 + __entry->pos = pos; 170 + __entry->len = len; 171 + __entry->flags = flags; 172 + ), 173 + 174 + TP_printk("dev %d,%d ino %lu pos %llu len %u flags %u", 175 + MAJOR(__entry->dev), MINOR(__entry->dev), 176 + (unsigned long) __entry->ino, 177 + (unsigned long long) __entry->pos, __entry->len, 178 + __entry->flags) 179 + ); 180 + 181 + DECLARE_EVENT_CLASS(ext3__write_end, 182 + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 183 + unsigned int copied), 184 + 185 + TP_ARGS(inode, pos, len, copied), 186 + 187 + TP_STRUCT__entry( 188 + __field( dev_t, dev ) 189 + __field( ino_t, ino ) 190 + __field( loff_t, pos ) 191 + __field( unsigned int, len ) 192 + __field( unsigned int, copied ) 193 + ), 194 + 195 + TP_fast_assign( 196 + __entry->dev = inode->i_sb->s_dev; 197 + __entry->ino = inode->i_ino; 198 + __entry->pos = pos; 199 + __entry->len = len; 200 + __entry->copied = copied; 201 + ), 202 + 203 + TP_printk("dev %d,%d ino %lu pos %llu len %u copied %u", 204 + MAJOR(__entry->dev), MINOR(__entry->dev), 205 + (unsigned long) __entry->ino, 206 + (unsigned long long) __entry->pos, __entry->len, 207 + __entry->copied) 208 + ); 209 + 210 + DEFINE_EVENT(ext3__write_end, ext3_ordered_write_end, 211 + 212 + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 213 + unsigned int copied), 214 + 215 + TP_ARGS(inode, pos, len, copied) 216 + ); 217 + 218 + DEFINE_EVENT(ext3__write_end, ext3_writeback_write_end, 219 + 220 + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 221 + unsigned int copied), 222 + 223 + TP_ARGS(inode, pos, len, copied) 224 + ); 225 + 226 + DEFINE_EVENT(ext3__write_end, ext3_journalled_write_end, 227 + 228 + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 229 + unsigned int copied), 230 + 231 + TP_ARGS(inode, pos, len, copied) 232 + ); 233 + 234 + DECLARE_EVENT_CLASS(ext3__page_op, 235 + TP_PROTO(struct page *page), 236 + 237 + TP_ARGS(page), 238 + 239 + TP_STRUCT__entry( 240 + __field( dev_t, dev ) 241 + __field( ino_t, ino ) 242 + __field( pgoff_t, index ) 243 + 244 + ), 245 + 246 + TP_fast_assign( 247 + __entry->index = page->index; 248 + __entry->ino = page->mapping->host->i_ino; 249 + __entry->dev = page->mapping->host->i_sb->s_dev; 250 + ), 251 + 252 + TP_printk("dev %d,%d ino %lu page_index %lu", 253 + MAJOR(__entry->dev), MINOR(__entry->dev), 254 + (unsigned long) __entry->ino, __entry->index) 255 + ); 256 + 257 + DEFINE_EVENT(ext3__page_op, ext3_ordered_writepage, 258 + 259 + TP_PROTO(struct page *page), 260 + 261 + TP_ARGS(page) 262 + ); 263 + 264 + DEFINE_EVENT(ext3__page_op, ext3_writeback_writepage, 265 + 266 + TP_PROTO(struct page *page), 267 + 268 + TP_ARGS(page) 269 + ); 270 + 271 + DEFINE_EVENT(ext3__page_op, ext3_journalled_writepage, 272 + 273 + TP_PROTO(struct page *page), 274 + 275 + TP_ARGS(page) 276 + ); 277 + 278 + DEFINE_EVENT(ext3__page_op, ext3_readpage, 279 + 280 + TP_PROTO(struct page *page), 281 + 282 + TP_ARGS(page) 283 + ); 284 + 285 + DEFINE_EVENT(ext3__page_op, ext3_releasepage, 286 + 287 + TP_PROTO(struct page *page), 288 + 289 + TP_ARGS(page) 290 + ); 291 + 292 + TRACE_EVENT(ext3_invalidatepage, 293 + TP_PROTO(struct page *page, unsigned long offset), 294 + 295 + TP_ARGS(page, offset), 296 + 297 + TP_STRUCT__entry( 298 + __field( pgoff_t, index ) 299 + __field( unsigned long, offset ) 300 + __field( ino_t, ino ) 301 + __field( dev_t, dev ) 302 + 303 + ), 304 + 305 + TP_fast_assign( 306 + __entry->index = page->index; 307 + __entry->offset = offset; 308 + __entry->ino = page->mapping->host->i_ino; 309 + __entry->dev = page->mapping->host->i_sb->s_dev; 310 + ), 311 + 312 + TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", 313 + MAJOR(__entry->dev), MINOR(__entry->dev), 314 + (unsigned long) __entry->ino, 315 + __entry->index, __entry->offset) 316 + ); 317 + 318 + TRACE_EVENT(ext3_discard_blocks, 319 + TP_PROTO(struct super_block *sb, unsigned long blk, 320 + unsigned long count), 321 + 322 + TP_ARGS(sb, blk, count), 323 + 324 + TP_STRUCT__entry( 325 + __field( dev_t, dev ) 326 + __field( unsigned long, blk ) 327 + __field( unsigned long, count ) 328 + 329 + ), 330 + 331 + TP_fast_assign( 332 + __entry->dev = sb->s_dev; 333 + __entry->blk = blk; 334 + __entry->count = count; 335 + ), 336 + 337 + TP_printk("dev %d,%d blk %lu count %lu", 338 + MAJOR(__entry->dev), MINOR(__entry->dev), 339 + __entry->blk, __entry->count) 340 + ); 341 + 342 + TRACE_EVENT(ext3_request_blocks, 343 + TP_PROTO(struct inode *inode, unsigned long goal, 344 + unsigned long count), 345 + 346 + TP_ARGS(inode, goal, count), 347 + 348 + TP_STRUCT__entry( 349 + __field( dev_t, dev ) 350 + __field( ino_t, ino ) 351 + __field( unsigned long, count ) 352 + __field( unsigned long, goal ) 353 + ), 354 + 355 + TP_fast_assign( 356 + __entry->dev = inode->i_sb->s_dev; 357 + __entry->ino = inode->i_ino; 358 + __entry->count = count; 359 + __entry->goal = goal; 360 + ), 361 + 362 + TP_printk("dev %d,%d ino %lu count %lu goal %lu ", 363 + MAJOR(__entry->dev), MINOR(__entry->dev), 364 + (unsigned long) __entry->ino, 365 + __entry->count, __entry->goal) 366 + ); 367 + 368 + TRACE_EVENT(ext3_allocate_blocks, 369 + TP_PROTO(struct inode *inode, unsigned long goal, 370 + unsigned long count, unsigned long block), 371 + 372 + TP_ARGS(inode, goal, count, block), 373 + 374 + TP_STRUCT__entry( 375 + __field( dev_t, dev ) 376 + __field( ino_t, ino ) 377 + __field( unsigned long, block ) 378 + __field( unsigned long, count ) 379 + __field( unsigned long, goal ) 380 + ), 381 + 382 + TP_fast_assign( 383 + __entry->dev = inode->i_sb->s_dev; 384 + __entry->ino = inode->i_ino; 385 + __entry->block = block; 386 + __entry->count = count; 387 + __entry->goal = goal; 388 + ), 389 + 390 + TP_printk("dev %d,%d ino %lu count %lu block %lu goal %lu", 391 + MAJOR(__entry->dev), MINOR(__entry->dev), 392 + (unsigned long) __entry->ino, 393 + __entry->count, __entry->block, 394 + __entry->goal) 395 + ); 396 + 397 + TRACE_EVENT(ext3_free_blocks, 398 + TP_PROTO(struct inode *inode, unsigned long block, 399 + unsigned long count), 400 + 401 + TP_ARGS(inode, block, count), 402 + 403 + TP_STRUCT__entry( 404 + __field( dev_t, dev ) 405 + __field( ino_t, ino ) 406 + __field( umode_t, mode ) 407 + __field( unsigned long, block ) 408 + __field( unsigned long, count ) 409 + ), 410 + 411 + TP_fast_assign( 412 + __entry->dev = inode->i_sb->s_dev; 413 + __entry->ino = inode->i_ino; 414 + __entry->mode = inode->i_mode; 415 + __entry->block = block; 416 + __entry->count = count; 417 + ), 418 + 419 + TP_printk("dev %d,%d ino %lu mode 0%o block %lu count %lu", 420 + MAJOR(__entry->dev), MINOR(__entry->dev), 421 + (unsigned long) __entry->ino, 422 + __entry->mode, __entry->block, __entry->count) 423 + ); 424 + 425 + TRACE_EVENT(ext3_sync_file_enter, 426 + TP_PROTO(struct file *file, int datasync), 427 + 428 + TP_ARGS(file, datasync), 429 + 430 + TP_STRUCT__entry( 431 + __field( dev_t, dev ) 432 + __field( ino_t, ino ) 433 + __field( ino_t, parent ) 434 + __field( int, datasync ) 435 + ), 436 + 437 + TP_fast_assign( 438 + struct dentry *dentry = file->f_path.dentry; 439 + 440 + __entry->dev = dentry->d_inode->i_sb->s_dev; 441 + __entry->ino = dentry->d_inode->i_ino; 442 + __entry->datasync = datasync; 443 + __entry->parent = dentry->d_parent->d_inode->i_ino; 444 + ), 445 + 446 + TP_printk("dev %d,%d ino %lu parent %ld datasync %d ", 447 + MAJOR(__entry->dev), MINOR(__entry->dev), 448 + (unsigned long) __entry->ino, 449 + (unsigned long) __entry->parent, __entry->datasync) 450 + ); 451 + 452 + TRACE_EVENT(ext3_sync_file_exit, 453 + TP_PROTO(struct inode *inode, int ret), 454 + 455 + TP_ARGS(inode, ret), 456 + 457 + TP_STRUCT__entry( 458 + __field( int, ret ) 459 + __field( ino_t, ino ) 460 + __field( dev_t, dev ) 461 + ), 462 + 463 + TP_fast_assign( 464 + __entry->ret = ret; 465 + __entry->ino = inode->i_ino; 466 + __entry->dev = inode->i_sb->s_dev; 467 + ), 468 + 469 + TP_printk("dev %d,%d ino %lu ret %d", 470 + MAJOR(__entry->dev), MINOR(__entry->dev), 471 + (unsigned long) __entry->ino, 472 + __entry->ret) 473 + ); 474 + 475 + TRACE_EVENT(ext3_sync_fs, 476 + TP_PROTO(struct super_block *sb, int wait), 477 + 478 + TP_ARGS(sb, wait), 479 + 480 + TP_STRUCT__entry( 481 + __field( dev_t, dev ) 482 + __field( int, wait ) 483 + 484 + ), 485 + 486 + TP_fast_assign( 487 + __entry->dev = sb->s_dev; 488 + __entry->wait = wait; 489 + ), 490 + 491 + TP_printk("dev %d,%d wait %d", 492 + MAJOR(__entry->dev), MINOR(__entry->dev), 493 + __entry->wait) 494 + ); 495 + 496 + TRACE_EVENT(ext3_rsv_window_add, 497 + TP_PROTO(struct super_block *sb, 498 + struct ext3_reserve_window_node *rsv_node), 499 + 500 + TP_ARGS(sb, rsv_node), 501 + 502 + TP_STRUCT__entry( 503 + __field( unsigned long, start ) 504 + __field( unsigned long, end ) 505 + __field( dev_t, dev ) 506 + ), 507 + 508 + TP_fast_assign( 509 + __entry->dev = sb->s_dev; 510 + __entry->start = rsv_node->rsv_window._rsv_start; 511 + __entry->end = rsv_node->rsv_window._rsv_end; 512 + ), 513 + 514 + TP_printk("dev %d,%d start %lu end %lu", 515 + MAJOR(__entry->dev), MINOR(__entry->dev), 516 + __entry->start, __entry->end) 517 + ); 518 + 519 + TRACE_EVENT(ext3_discard_reservation, 520 + TP_PROTO(struct inode *inode, 521 + struct ext3_reserve_window_node *rsv_node), 522 + 523 + TP_ARGS(inode, rsv_node), 524 + 525 + TP_STRUCT__entry( 526 + __field( unsigned long, start ) 527 + __field( unsigned long, end ) 528 + __field( ino_t, ino ) 529 + __field( dev_t, dev ) 530 + ), 531 + 532 + TP_fast_assign( 533 + __entry->start = rsv_node->rsv_window._rsv_start; 534 + __entry->end = rsv_node->rsv_window._rsv_end; 535 + __entry->ino = inode->i_ino; 536 + __entry->dev = inode->i_sb->s_dev; 537 + ), 538 + 539 + TP_printk("dev %d,%d ino %lu start %lu end %lu", 540 + MAJOR(__entry->dev), MINOR(__entry->dev), 541 + (unsigned long)__entry->ino, __entry->start, 542 + __entry->end) 543 + ); 544 + 545 + TRACE_EVENT(ext3_alloc_new_reservation, 546 + TP_PROTO(struct super_block *sb, unsigned long goal), 547 + 548 + TP_ARGS(sb, goal), 549 + 550 + TP_STRUCT__entry( 551 + __field( dev_t, dev ) 552 + __field( unsigned long, goal ) 553 + ), 554 + 555 + TP_fast_assign( 556 + __entry->dev = sb->s_dev; 557 + __entry->goal = goal; 558 + ), 559 + 560 + TP_printk("dev %d,%d goal %lu", 561 + MAJOR(__entry->dev), MINOR(__entry->dev), 562 + __entry->goal) 563 + ); 564 + 565 + TRACE_EVENT(ext3_reserved, 566 + TP_PROTO(struct super_block *sb, unsigned long block, 567 + struct ext3_reserve_window_node *rsv_node), 568 + 569 + TP_ARGS(sb, block, rsv_node), 570 + 571 + TP_STRUCT__entry( 572 + __field( unsigned long, block ) 573 + __field( unsigned long, start ) 574 + __field( unsigned long, end ) 575 + __field( dev_t, dev ) 576 + ), 577 + 578 + TP_fast_assign( 579 + __entry->block = block; 580 + __entry->start = rsv_node->rsv_window._rsv_start; 581 + __entry->end = rsv_node->rsv_window._rsv_end; 582 + __entry->dev = sb->s_dev; 583 + ), 584 + 585 + TP_printk("dev %d,%d block %lu, start %lu end %lu", 586 + MAJOR(__entry->dev), MINOR(__entry->dev), 587 + __entry->block, __entry->start, __entry->end) 588 + ); 589 + 590 + TRACE_EVENT(ext3_forget, 591 + TP_PROTO(struct inode *inode, int is_metadata, unsigned long block), 592 + 593 + TP_ARGS(inode, is_metadata, block), 594 + 595 + TP_STRUCT__entry( 596 + __field( dev_t, dev ) 597 + __field( ino_t, ino ) 598 + __field( umode_t, mode ) 599 + __field( int, is_metadata ) 600 + __field( unsigned long, block ) 601 + ), 602 + 603 + TP_fast_assign( 604 + __entry->dev = inode->i_sb->s_dev; 605 + __entry->ino = inode->i_ino; 606 + __entry->mode = inode->i_mode; 607 + __entry->is_metadata = is_metadata; 608 + __entry->block = block; 609 + ), 610 + 611 + TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %lu", 612 + MAJOR(__entry->dev), MINOR(__entry->dev), 613 + (unsigned long) __entry->ino, 614 + __entry->mode, __entry->is_metadata, __entry->block) 615 + ); 616 + 617 + TRACE_EVENT(ext3_read_block_bitmap, 618 + TP_PROTO(struct super_block *sb, unsigned int group), 619 + 620 + TP_ARGS(sb, group), 621 + 622 + TP_STRUCT__entry( 623 + __field( dev_t, dev ) 624 + __field( __u32, group ) 625 + 626 + ), 627 + 628 + TP_fast_assign( 629 + __entry->dev = sb->s_dev; 630 + __entry->group = group; 631 + ), 632 + 633 + TP_printk("dev %d,%d group %u", 634 + MAJOR(__entry->dev), MINOR(__entry->dev), 635 + __entry->group) 636 + ); 637 + 638 + TRACE_EVENT(ext3_direct_IO_enter, 639 + TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw), 640 + 641 + TP_ARGS(inode, offset, len, rw), 642 + 643 + TP_STRUCT__entry( 644 + __field( ino_t, ino ) 645 + __field( dev_t, dev ) 646 + __field( loff_t, pos ) 647 + __field( unsigned long, len ) 648 + __field( int, rw ) 649 + ), 650 + 651 + TP_fast_assign( 652 + __entry->ino = inode->i_ino; 653 + __entry->dev = inode->i_sb->s_dev; 654 + __entry->pos = offset; 655 + __entry->len = len; 656 + __entry->rw = rw; 657 + ), 658 + 659 + TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d", 660 + MAJOR(__entry->dev), MINOR(__entry->dev), 661 + (unsigned long) __entry->ino, 662 + (unsigned long long) __entry->pos, __entry->len, 663 + __entry->rw) 664 + ); 665 + 666 + TRACE_EVENT(ext3_direct_IO_exit, 667 + TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, 668 + int rw, int ret), 669 + 670 + TP_ARGS(inode, offset, len, rw, ret), 671 + 672 + TP_STRUCT__entry( 673 + __field( ino_t, ino ) 674 + __field( dev_t, dev ) 675 + __field( loff_t, pos ) 676 + __field( unsigned long, len ) 677 + __field( int, rw ) 678 + __field( int, ret ) 679 + ), 680 + 681 + TP_fast_assign( 682 + __entry->ino = inode->i_ino; 683 + __entry->dev = inode->i_sb->s_dev; 684 + __entry->pos = offset; 685 + __entry->len = len; 686 + __entry->rw = rw; 687 + __entry->ret = ret; 688 + ), 689 + 690 + TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d ret %d", 691 + MAJOR(__entry->dev), MINOR(__entry->dev), 692 + (unsigned long) __entry->ino, 693 + (unsigned long long) __entry->pos, __entry->len, 694 + __entry->rw, __entry->ret) 695 + ); 696 + 697 + TRACE_EVENT(ext3_unlink_enter, 698 + TP_PROTO(struct inode *parent, struct dentry *dentry), 699 + 700 + TP_ARGS(parent, dentry), 701 + 702 + TP_STRUCT__entry( 703 + __field( ino_t, parent ) 704 + __field( ino_t, ino ) 705 + __field( loff_t, size ) 706 + __field( dev_t, dev ) 707 + ), 708 + 709 + TP_fast_assign( 710 + __entry->parent = parent->i_ino; 711 + __entry->ino = dentry->d_inode->i_ino; 712 + __entry->size = dentry->d_inode->i_size; 713 + __entry->dev = dentry->d_inode->i_sb->s_dev; 714 + ), 715 + 716 + TP_printk("dev %d,%d ino %lu size %lld parent %ld", 717 + MAJOR(__entry->dev), MINOR(__entry->dev), 718 + (unsigned long) __entry->ino, 719 + (unsigned long long)__entry->size, 720 + (unsigned long) __entry->parent) 721 + ); 722 + 723 + TRACE_EVENT(ext3_unlink_exit, 724 + TP_PROTO(struct dentry *dentry, int ret), 725 + 726 + TP_ARGS(dentry, ret), 727 + 728 + TP_STRUCT__entry( 729 + __field( ino_t, ino ) 730 + __field( dev_t, dev ) 731 + __field( int, ret ) 732 + ), 733 + 734 + TP_fast_assign( 735 + __entry->ino = dentry->d_inode->i_ino; 736 + __entry->dev = dentry->d_inode->i_sb->s_dev; 737 + __entry->ret = ret; 738 + ), 739 + 740 + TP_printk("dev %d,%d ino %lu ret %d", 741 + MAJOR(__entry->dev), MINOR(__entry->dev), 742 + (unsigned long) __entry->ino, 743 + __entry->ret) 744 + ); 745 + 746 + DECLARE_EVENT_CLASS(ext3__truncate, 747 + TP_PROTO(struct inode *inode), 748 + 749 + TP_ARGS(inode), 750 + 751 + TP_STRUCT__entry( 752 + __field( ino_t, ino ) 753 + __field( dev_t, dev ) 754 + __field( blkcnt_t, blocks ) 755 + ), 756 + 757 + TP_fast_assign( 758 + __entry->ino = inode->i_ino; 759 + __entry->dev = inode->i_sb->s_dev; 760 + __entry->blocks = inode->i_blocks; 761 + ), 762 + 763 + TP_printk("dev %d,%d ino %lu blocks %lu", 764 + MAJOR(__entry->dev), MINOR(__entry->dev), 765 + (unsigned long) __entry->ino, (unsigned long) __entry->blocks) 766 + ); 767 + 768 + DEFINE_EVENT(ext3__truncate, ext3_truncate_enter, 769 + 770 + TP_PROTO(struct inode *inode), 771 + 772 + TP_ARGS(inode) 773 + ); 774 + 775 + DEFINE_EVENT(ext3__truncate, ext3_truncate_exit, 776 + 777 + TP_PROTO(struct inode *inode), 778 + 779 + TP_ARGS(inode) 780 + ); 781 + 782 + TRACE_EVENT(ext3_get_blocks_enter, 783 + TP_PROTO(struct inode *inode, unsigned long lblk, 784 + unsigned long len, int create), 785 + 786 + TP_ARGS(inode, lblk, len, create), 787 + 788 + TP_STRUCT__entry( 789 + __field( ino_t, ino ) 790 + __field( dev_t, dev ) 791 + __field( unsigned long, lblk ) 792 + __field( unsigned long, len ) 793 + __field( int, create ) 794 + ), 795 + 796 + TP_fast_assign( 797 + __entry->ino = inode->i_ino; 798 + __entry->dev = inode->i_sb->s_dev; 799 + __entry->lblk = lblk; 800 + __entry->len = len; 801 + __entry->create = create; 802 + ), 803 + 804 + TP_printk("dev %d,%d ino %lu lblk %lu len %lu create %u", 805 + MAJOR(__entry->dev), MINOR(__entry->dev), 806 + (unsigned long) __entry->ino, 807 + __entry->lblk, __entry->len, __entry->create) 808 + ); 809 + 810 + TRACE_EVENT(ext3_get_blocks_exit, 811 + TP_PROTO(struct inode *inode, unsigned long lblk, 812 + unsigned long pblk, unsigned long len, int ret), 813 + 814 + TP_ARGS(inode, lblk, pblk, len, ret), 815 + 816 + TP_STRUCT__entry( 817 + __field( ino_t, ino ) 818 + __field( dev_t, dev ) 819 + __field( unsigned long, lblk ) 820 + __field( unsigned long, pblk ) 821 + __field( unsigned long, len ) 822 + __field( int, ret ) 823 + ), 824 + 825 + TP_fast_assign( 826 + __entry->ino = inode->i_ino; 827 + __entry->dev = inode->i_sb->s_dev; 828 + __entry->lblk = lblk; 829 + __entry->pblk = pblk; 830 + __entry->len = len; 831 + __entry->ret = ret; 832 + ), 833 + 834 + TP_printk("dev %d,%d ino %lu lblk %lu pblk %lu len %lu ret %d", 835 + MAJOR(__entry->dev), MINOR(__entry->dev), 836 + (unsigned long) __entry->ino, 837 + __entry->lblk, __entry->pblk, 838 + __entry->len, __entry->ret) 839 + ); 840 + 841 + TRACE_EVENT(ext3_load_inode, 842 + TP_PROTO(struct inode *inode), 843 + 844 + TP_ARGS(inode), 845 + 846 + TP_STRUCT__entry( 847 + __field( ino_t, ino ) 848 + __field( dev_t, dev ) 849 + ), 850 + 851 + TP_fast_assign( 852 + __entry->ino = inode->i_ino; 853 + __entry->dev = inode->i_sb->s_dev; 854 + ), 855 + 856 + TP_printk("dev %d,%d ino %lu", 857 + MAJOR(__entry->dev), MINOR(__entry->dev), 858 + (unsigned long) __entry->ino) 859 + ); 860 + 861 + #endif /* _TRACE_EXT3_H */ 862 + 863 + /* This part must be outside protection */ 864 + #include <trace/define_trace.h>
+203
include/trace/events/jbd.h
··· 1 + #undef TRACE_SYSTEM 2 + #define TRACE_SYSTEM jbd 3 + 4 + #if !defined(_TRACE_JBD_H) || defined(TRACE_HEADER_MULTI_READ) 5 + #define _TRACE_JBD_H 6 + 7 + #include <linux/jbd.h> 8 + #include <linux/tracepoint.h> 9 + 10 + TRACE_EVENT(jbd_checkpoint, 11 + 12 + TP_PROTO(journal_t *journal, int result), 13 + 14 + TP_ARGS(journal, result), 15 + 16 + TP_STRUCT__entry( 17 + __field( dev_t, dev ) 18 + __field( int, result ) 19 + ), 20 + 21 + TP_fast_assign( 22 + __entry->dev = journal->j_fs_dev->bd_dev; 23 + __entry->result = result; 24 + ), 25 + 26 + TP_printk("dev %d,%d result %d", 27 + MAJOR(__entry->dev), MINOR(__entry->dev), 28 + __entry->result) 29 + ); 30 + 31 + DECLARE_EVENT_CLASS(jbd_commit, 32 + 33 + TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 34 + 35 + TP_ARGS(journal, commit_transaction), 36 + 37 + TP_STRUCT__entry( 38 + __field( dev_t, dev ) 39 + __field( char, sync_commit ) 40 + __field( int, transaction ) 41 + ), 42 + 43 + TP_fast_assign( 44 + __entry->dev = journal->j_fs_dev->bd_dev; 45 + __entry->sync_commit = commit_transaction->t_synchronous_commit; 46 + __entry->transaction = commit_transaction->t_tid; 47 + ), 48 + 49 + TP_printk("dev %d,%d transaction %d sync %d", 50 + MAJOR(__entry->dev), MINOR(__entry->dev), 51 + __entry->transaction, __entry->sync_commit) 52 + ); 53 + 54 + DEFINE_EVENT(jbd_commit, jbd_start_commit, 55 + 56 + TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 57 + 58 + TP_ARGS(journal, commit_transaction) 59 + ); 60 + 61 + DEFINE_EVENT(jbd_commit, jbd_commit_locking, 62 + 63 + TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 64 + 65 + TP_ARGS(journal, commit_transaction) 66 + ); 67 + 68 + DEFINE_EVENT(jbd_commit, jbd_commit_flushing, 69 + 70 + TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 71 + 72 + TP_ARGS(journal, commit_transaction) 73 + ); 74 + 75 + DEFINE_EVENT(jbd_commit, jbd_commit_logging, 76 + 77 + TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 78 + 79 + TP_ARGS(journal, commit_transaction) 80 + ); 81 + 82 + TRACE_EVENT(jbd_drop_transaction, 83 + 84 + TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 85 + 86 + TP_ARGS(journal, commit_transaction), 87 + 88 + TP_STRUCT__entry( 89 + __field( dev_t, dev ) 90 + __field( char, sync_commit ) 91 + __field( int, transaction ) 92 + ), 93 + 94 + TP_fast_assign( 95 + __entry->dev = journal->j_fs_dev->bd_dev; 96 + __entry->sync_commit = commit_transaction->t_synchronous_commit; 97 + __entry->transaction = commit_transaction->t_tid; 98 + ), 99 + 100 + TP_printk("dev %d,%d transaction %d sync %d", 101 + MAJOR(__entry->dev), MINOR(__entry->dev), 102 + __entry->transaction, __entry->sync_commit) 103 + ); 104 + 105 + TRACE_EVENT(jbd_end_commit, 106 + TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 107 + 108 + TP_ARGS(journal, commit_transaction), 109 + 110 + TP_STRUCT__entry( 111 + __field( dev_t, dev ) 112 + __field( char, sync_commit ) 113 + __field( int, transaction ) 114 + __field( int, head ) 115 + ), 116 + 117 + TP_fast_assign( 118 + __entry->dev = journal->j_fs_dev->bd_dev; 119 + __entry->sync_commit = commit_transaction->t_synchronous_commit; 120 + __entry->transaction = commit_transaction->t_tid; 121 + __entry->head = journal->j_tail_sequence; 122 + ), 123 + 124 + TP_printk("dev %d,%d transaction %d sync %d head %d", 125 + MAJOR(__entry->dev), MINOR(__entry->dev), 126 + __entry->transaction, __entry->sync_commit, __entry->head) 127 + ); 128 + 129 + TRACE_EVENT(jbd_do_submit_data, 130 + TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 131 + 132 + TP_ARGS(journal, commit_transaction), 133 + 134 + TP_STRUCT__entry( 135 + __field( dev_t, dev ) 136 + __field( char, sync_commit ) 137 + __field( int, transaction ) 138 + ), 139 + 140 + TP_fast_assign( 141 + __entry->dev = journal->j_fs_dev->bd_dev; 142 + __entry->sync_commit = commit_transaction->t_synchronous_commit; 143 + __entry->transaction = commit_transaction->t_tid; 144 + ), 145 + 146 + TP_printk("dev %d,%d transaction %d sync %d", 147 + MAJOR(__entry->dev), MINOR(__entry->dev), 148 + __entry->transaction, __entry->sync_commit) 149 + ); 150 + 151 + TRACE_EVENT(jbd_cleanup_journal_tail, 152 + 153 + TP_PROTO(journal_t *journal, tid_t first_tid, 154 + unsigned long block_nr, unsigned long freed), 155 + 156 + TP_ARGS(journal, first_tid, block_nr, freed), 157 + 158 + TP_STRUCT__entry( 159 + __field( dev_t, dev ) 160 + __field( tid_t, tail_sequence ) 161 + __field( tid_t, first_tid ) 162 + __field(unsigned long, block_nr ) 163 + __field(unsigned long, freed ) 164 + ), 165 + 166 + TP_fast_assign( 167 + __entry->dev = journal->j_fs_dev->bd_dev; 168 + __entry->tail_sequence = journal->j_tail_sequence; 169 + __entry->first_tid = first_tid; 170 + __entry->block_nr = block_nr; 171 + __entry->freed = freed; 172 + ), 173 + 174 + TP_printk("dev %d,%d from %u to %u offset %lu freed %lu", 175 + MAJOR(__entry->dev), MINOR(__entry->dev), 176 + __entry->tail_sequence, __entry->first_tid, 177 + __entry->block_nr, __entry->freed) 178 + ); 179 + 180 + TRACE_EVENT(jbd_update_superblock_end, 181 + TP_PROTO(journal_t *journal, int wait), 182 + 183 + TP_ARGS(journal, wait), 184 + 185 + TP_STRUCT__entry( 186 + __field( dev_t, dev ) 187 + __field( int, wait ) 188 + ), 189 + 190 + TP_fast_assign( 191 + __entry->dev = journal->j_fs_dev->bd_dev; 192 + __entry->wait = wait; 193 + ), 194 + 195 + TP_printk("dev %d,%d wait %d", 196 + MAJOR(__entry->dev), MINOR(__entry->dev), 197 + __entry->wait) 198 + ); 199 + 200 + #endif /* _TRACE_JBD_H */ 201 + 202 + /* This part must be outside protection */ 203 + #include <trace/define_trace.h>