diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/gfs2/file.c | 38 | ||||
| -rw-r--r-- | fs/gfs2/meta_io.c | 2 | ||||
| -rw-r--r-- | fs/gfs2/ops_inode.c | 6 | ||||
| -rw-r--r-- | fs/gfs2/xattr.c | 21 | ||||
| -rw-r--r-- | fs/nfs/dir.c | 1 | ||||
| -rw-r--r-- | fs/proc/array.c | 89 | ||||
| -rw-r--r-- | fs/proc/task_mmu.c | 3 | ||||
| -rw-r--r-- | fs/quota/dquot.c | 3 | ||||
| -rw-r--r-- | fs/reiserfs/inode.c | 19 | ||||
| -rw-r--r-- | fs/reiserfs/ioctl.c | 3 | ||||
| -rw-r--r-- | fs/reiserfs/xattr.c | 18 | ||||
| -rw-r--r-- | fs/reiserfs/xattr_acl.c | 2 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_acl.c | 3 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_trace.h | 1145 | ||||
| -rw-r--r-- | fs/xfs/xfs_alloc.c | 44 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.c | 10 | ||||
| -rw-r--r-- | fs/xfs/xfs_vnodeops.c | 93 |
17 files changed, 758 insertions, 742 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 4eb308aa3234..a6abbae8a278 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
| @@ -569,6 +569,40 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
| 569 | return ret; | 569 | return ret; |
| 570 | } | 570 | } |
| 571 | 571 | ||
| 572 | /** | ||
| 573 | * gfs2_file_aio_write - Perform a write to a file | ||
| 574 | * @iocb: The io context | ||
| 575 | * @iov: The data to write | ||
| 576 | * @nr_segs: Number of @iov segments | ||
| 577 | * @pos: The file position | ||
| 578 | * | ||
| 579 | * We have to do a lock/unlock here to refresh the inode size for | ||
| 580 | * O_APPEND writes, otherwise we can land up writing at the wrong | ||
| 581 | * offset. There is still a race, but provided the app is using its | ||
| 582 | * own file locking, this will make O_APPEND work as expected. | ||
| 583 | * | ||
| 584 | */ | ||
| 585 | |||
| 586 | static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | ||
| 587 | unsigned long nr_segs, loff_t pos) | ||
| 588 | { | ||
| 589 | struct file *file = iocb->ki_filp; | ||
| 590 | |||
| 591 | if (file->f_flags & O_APPEND) { | ||
| 592 | struct dentry *dentry = file->f_dentry; | ||
| 593 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | ||
| 594 | struct gfs2_holder gh; | ||
| 595 | int ret; | ||
| 596 | |||
| 597 | ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh); | ||
| 598 | if (ret) | ||
| 599 | return ret; | ||
| 600 | gfs2_glock_dq_uninit(&gh); | ||
| 601 | } | ||
| 602 | |||
| 603 | return generic_file_aio_write(iocb, iov, nr_segs, pos); | ||
| 604 | } | ||
| 605 | |||
| 572 | #ifdef CONFIG_GFS2_FS_LOCKING_DLM | 606 | #ifdef CONFIG_GFS2_FS_LOCKING_DLM |
| 573 | 607 | ||
| 574 | /** | 608 | /** |
| @@ -711,7 +745,7 @@ const struct file_operations gfs2_file_fops = { | |||
| 711 | .read = do_sync_read, | 745 | .read = do_sync_read, |
| 712 | .aio_read = generic_file_aio_read, | 746 | .aio_read = generic_file_aio_read, |
| 713 | .write = do_sync_write, | 747 | .write = do_sync_write, |
| 714 | .aio_write = generic_file_aio_write, | 748 | .aio_write = gfs2_file_aio_write, |
| 715 | .unlocked_ioctl = gfs2_ioctl, | 749 | .unlocked_ioctl = gfs2_ioctl, |
| 716 | .mmap = gfs2_mmap, | 750 | .mmap = gfs2_mmap, |
| 717 | .open = gfs2_open, | 751 | .open = gfs2_open, |
| @@ -741,7 +775,7 @@ const struct file_operations gfs2_file_fops_nolock = { | |||
| 741 | .read = do_sync_read, | 775 | .read = do_sync_read, |
| 742 | .aio_read = generic_file_aio_read, | 776 | .aio_read = generic_file_aio_read, |
| 743 | .write = do_sync_write, | 777 | .write = do_sync_write, |
| 744 | .aio_write = generic_file_aio_write, | 778 | .aio_write = gfs2_file_aio_write, |
| 745 | .unlocked_ioctl = gfs2_ioctl, | 779 | .unlocked_ioctl = gfs2_ioctl, |
| 746 | .mmap = gfs2_mmap, | 780 | .mmap = gfs2_mmap, |
| 747 | .open = gfs2_open, | 781 | .open = gfs2_open, |
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index cb8d7a93d5ec..6f68a5f18eb8 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
| @@ -121,7 +121,7 @@ struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) | |||
| 121 | if (aspace) { | 121 | if (aspace) { |
| 122 | mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); | 122 | mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); |
| 123 | aspace->i_mapping->a_ops = &aspace_aops; | 123 | aspace->i_mapping->a_ops = &aspace_aops; |
| 124 | aspace->i_size = ~0ULL; | 124 | aspace->i_size = MAX_LFS_FILESIZE; |
| 125 | ip = GFS2_I(aspace); | 125 | ip = GFS2_I(aspace); |
| 126 | clear_bit(GIF_USER, &ip->i_flags); | 126 | clear_bit(GIF_USER, &ip->i_flags); |
| 127 | insert_inode_hash(aspace); | 127 | insert_inode_hash(aspace); |
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 247436c10deb..78f73ca1ef3e 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
| @@ -748,7 +748,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 748 | struct gfs2_rgrpd *nrgd; | 748 | struct gfs2_rgrpd *nrgd; |
| 749 | unsigned int num_gh; | 749 | unsigned int num_gh; |
| 750 | int dir_rename = 0; | 750 | int dir_rename = 0; |
| 751 | int alloc_required; | 751 | int alloc_required = 0; |
| 752 | unsigned int x; | 752 | unsigned int x; |
| 753 | int error; | 753 | int error; |
| 754 | 754 | ||
| @@ -867,7 +867,9 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 867 | goto out_gunlock; | 867 | goto out_gunlock; |
| 868 | } | 868 | } |
| 869 | 869 | ||
| 870 | alloc_required = error = gfs2_diradd_alloc_required(ndir, &ndentry->d_name); | 870 | if (nip == NULL) |
| 871 | alloc_required = gfs2_diradd_alloc_required(ndir, &ndentry->d_name); | ||
| 872 | error = alloc_required; | ||
| 871 | if (error < 0) | 873 | if (error < 0) |
| 872 | goto out_gunlock; | 874 | goto out_gunlock; |
| 873 | error = 0; | 875 | error = 0; |
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index 8a04108e0c22..c2ebdf2c01d4 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c | |||
| @@ -1296,6 +1296,7 @@ fail: | |||
| 1296 | 1296 | ||
| 1297 | int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | 1297 | int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) |
| 1298 | { | 1298 | { |
| 1299 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | ||
| 1299 | struct gfs2_ea_location el; | 1300 | struct gfs2_ea_location el; |
| 1300 | struct buffer_head *dibh; | 1301 | struct buffer_head *dibh; |
| 1301 | int error; | 1302 | int error; |
| @@ -1305,16 +1306,17 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | |||
| 1305 | return error; | 1306 | return error; |
| 1306 | 1307 | ||
| 1307 | if (GFS2_EA_IS_STUFFED(el.el_ea)) { | 1308 | if (GFS2_EA_IS_STUFFED(el.el_ea)) { |
| 1308 | error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0); | 1309 | error = gfs2_trans_begin(sdp, RES_DINODE + RES_EATTR, 0); |
| 1309 | if (error) | 1310 | if (error == 0) { |
| 1310 | return error; | 1311 | gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1); |
| 1311 | 1312 | memcpy(GFS2_EA2DATA(el.el_ea), data, | |
| 1312 | gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1); | 1313 | GFS2_EA_DATA_LEN(el.el_ea)); |
| 1313 | memcpy(GFS2_EA2DATA(el.el_ea), data, | 1314 | } |
| 1314 | GFS2_EA_DATA_LEN(el.el_ea)); | 1315 | } else { |
| 1315 | } else | ||
| 1316 | error = ea_acl_chmod_unstuffed(ip, el.el_ea, data); | 1316 | error = ea_acl_chmod_unstuffed(ip, el.el_ea, data); |
| 1317 | } | ||
| 1317 | 1318 | ||
| 1319 | brelse(el.el_bh); | ||
| 1318 | if (error) | 1320 | if (error) |
| 1319 | return error; | 1321 | return error; |
| 1320 | 1322 | ||
| @@ -1327,8 +1329,7 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | |||
| 1327 | brelse(dibh); | 1329 | brelse(dibh); |
| 1328 | } | 1330 | } |
| 1329 | 1331 | ||
| 1330 | gfs2_trans_end(GFS2_SB(&ip->i_inode)); | 1332 | gfs2_trans_end(sdp); |
| 1331 | |||
| 1332 | return error; | 1333 | return error; |
| 1333 | } | 1334 | } |
| 1334 | 1335 | ||
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 2c5ace4f00a7..3c7f03b669fb 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -1615,6 +1615,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1615 | goto out; | 1615 | goto out; |
| 1616 | 1616 | ||
| 1617 | new_dentry = dentry; | 1617 | new_dentry = dentry; |
| 1618 | rehash = NULL; | ||
| 1618 | new_inode = NULL; | 1619 | new_inode = NULL; |
| 1619 | } | 1620 | } |
| 1620 | } | 1621 | } |
diff --git a/fs/proc/array.c b/fs/proc/array.c index f560325c444f..13b5d0708175 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
| @@ -327,94 +327,6 @@ static inline void task_context_switch_counts(struct seq_file *m, | |||
| 327 | p->nivcsw); | 327 | p->nivcsw); |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | #ifdef CONFIG_MMU | ||
| 331 | |||
| 332 | struct stack_stats { | ||
| 333 | struct vm_area_struct *vma; | ||
| 334 | unsigned long startpage; | ||
| 335 | unsigned long usage; | ||
| 336 | }; | ||
| 337 | |||
| 338 | static int stack_usage_pte_range(pmd_t *pmd, unsigned long addr, | ||
| 339 | unsigned long end, struct mm_walk *walk) | ||
| 340 | { | ||
| 341 | struct stack_stats *ss = walk->private; | ||
| 342 | struct vm_area_struct *vma = ss->vma; | ||
| 343 | pte_t *pte, ptent; | ||
| 344 | spinlock_t *ptl; | ||
| 345 | int ret = 0; | ||
| 346 | |||
| 347 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); | ||
| 348 | for (; addr != end; pte++, addr += PAGE_SIZE) { | ||
| 349 | ptent = *pte; | ||
| 350 | |||
| 351 | #ifdef CONFIG_STACK_GROWSUP | ||
| 352 | if (pte_present(ptent) || is_swap_pte(ptent)) | ||
| 353 | ss->usage = addr - ss->startpage + PAGE_SIZE; | ||
| 354 | #else | ||
| 355 | if (pte_present(ptent) || is_swap_pte(ptent)) { | ||
| 356 | ss->usage = ss->startpage - addr + PAGE_SIZE; | ||
| 357 | pte++; | ||
| 358 | ret = 1; | ||
| 359 | break; | ||
| 360 | } | ||
| 361 | #endif | ||
| 362 | } | ||
| 363 | pte_unmap_unlock(pte - 1, ptl); | ||
| 364 | cond_resched(); | ||
| 365 | return ret; | ||
| 366 | } | ||
| 367 | |||
| 368 | static inline unsigned long get_stack_usage_in_bytes(struct vm_area_struct *vma, | ||
| 369 | struct task_struct *task) | ||
| 370 | { | ||
| 371 | struct stack_stats ss; | ||
| 372 | struct mm_walk stack_walk = { | ||
| 373 | .pmd_entry = stack_usage_pte_range, | ||
| 374 | .mm = vma->vm_mm, | ||
| 375 | .private = &ss, | ||
| 376 | }; | ||
| 377 | |||
| 378 | if (!vma->vm_mm || is_vm_hugetlb_page(vma)) | ||
| 379 | return 0; | ||
| 380 | |||
| 381 | ss.vma = vma; | ||
| 382 | ss.startpage = task->stack_start & PAGE_MASK; | ||
| 383 | ss.usage = 0; | ||
| 384 | |||
| 385 | #ifdef CONFIG_STACK_GROWSUP | ||
| 386 | walk_page_range(KSTK_ESP(task) & PAGE_MASK, vma->vm_end, | ||
| 387 | &stack_walk); | ||
| 388 | #else | ||
| 389 | walk_page_range(vma->vm_start, (KSTK_ESP(task) & PAGE_MASK) + PAGE_SIZE, | ||
| 390 | &stack_walk); | ||
| 391 | #endif | ||
| 392 | return ss.usage; | ||
| 393 | } | ||
| 394 | |||
| 395 | static inline void task_show_stack_usage(struct seq_file *m, | ||
| 396 | struct task_struct *task) | ||
| 397 | { | ||
| 398 | struct vm_area_struct *vma; | ||
| 399 | struct mm_struct *mm = get_task_mm(task); | ||
| 400 | |||
| 401 | if (mm) { | ||
| 402 | down_read(&mm->mmap_sem); | ||
| 403 | vma = find_vma(mm, task->stack_start); | ||
| 404 | if (vma) | ||
| 405 | seq_printf(m, "Stack usage:\t%lu kB\n", | ||
| 406 | get_stack_usage_in_bytes(vma, task) >> 10); | ||
| 407 | |||
| 408 | up_read(&mm->mmap_sem); | ||
| 409 | mmput(mm); | ||
| 410 | } | ||
| 411 | } | ||
| 412 | #else | ||
| 413 | static void task_show_stack_usage(struct seq_file *m, struct task_struct *task) | ||
| 414 | { | ||
| 415 | } | ||
| 416 | #endif /* CONFIG_MMU */ | ||
| 417 | |||
| 418 | static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) | 330 | static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) |
| 419 | { | 331 | { |
| 420 | seq_printf(m, "Cpus_allowed:\t"); | 332 | seq_printf(m, "Cpus_allowed:\t"); |
| @@ -445,7 +357,6 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | |||
| 445 | task_show_regs(m, task); | 357 | task_show_regs(m, task); |
| 446 | #endif | 358 | #endif |
| 447 | task_context_switch_counts(m, task); | 359 | task_context_switch_counts(m, task); |
| 448 | task_show_stack_usage(m, task); | ||
| 449 | return 0; | 360 | return 0; |
| 450 | } | 361 | } |
| 451 | 362 | ||
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 47c03f4336b8..f277c4a111cb 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
| @@ -361,12 +361,11 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
| 361 | if (!pte_present(ptent)) | 361 | if (!pte_present(ptent)) |
| 362 | continue; | 362 | continue; |
| 363 | 363 | ||
| 364 | mss->resident += PAGE_SIZE; | ||
| 365 | |||
| 366 | page = vm_normal_page(vma, addr, ptent); | 364 | page = vm_normal_page(vma, addr, ptent); |
| 367 | if (!page) | 365 | if (!page) |
| 368 | continue; | 366 | continue; |
| 369 | 367 | ||
| 368 | mss->resident += PAGE_SIZE; | ||
| 370 | /* Accumulate the size in pages that have been accessed. */ | 369 | /* Accumulate the size in pages that have been accessed. */ |
| 371 | if (pte_young(ptent) || PageReferenced(page)) | 370 | if (pte_young(ptent) || PageReferenced(page)) |
| 372 | mss->referenced += PAGE_SIZE; | 371 | mss->referenced += PAGE_SIZE; |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index dea86abdf2e7..3fc62b097bed 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
| @@ -1377,6 +1377,9 @@ static void inode_sub_rsv_space(struct inode *inode, qsize_t number) | |||
| 1377 | static qsize_t inode_get_rsv_space(struct inode *inode) | 1377 | static qsize_t inode_get_rsv_space(struct inode *inode) |
| 1378 | { | 1378 | { |
| 1379 | qsize_t ret; | 1379 | qsize_t ret; |
| 1380 | |||
| 1381 | if (!inode->i_sb->dq_op->get_reserved_space) | ||
| 1382 | return 0; | ||
| 1380 | spin_lock(&inode->i_lock); | 1383 | spin_lock(&inode->i_lock); |
| 1381 | ret = *inode_reserved_space(inode); | 1384 | ret = *inode_reserved_space(inode); |
| 1382 | spin_unlock(&inode->i_lock); | 1385 | spin_unlock(&inode->i_lock); |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 1150ebb2536f..9087b10209e6 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
| @@ -3062,13 +3062,14 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, | |||
| 3062 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | 3062 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 3063 | { | 3063 | { |
| 3064 | struct inode *inode = dentry->d_inode; | 3064 | struct inode *inode = dentry->d_inode; |
| 3065 | int error; | ||
| 3066 | unsigned int ia_valid; | 3065 | unsigned int ia_valid; |
| 3066 | int depth; | ||
| 3067 | int error; | ||
| 3067 | 3068 | ||
| 3068 | /* must be turned off for recursive notify_change calls */ | 3069 | /* must be turned off for recursive notify_change calls */ |
| 3069 | ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); | 3070 | ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); |
| 3070 | 3071 | ||
| 3071 | reiserfs_write_lock(inode->i_sb); | 3072 | depth = reiserfs_write_lock_once(inode->i_sb); |
| 3072 | if (attr->ia_valid & ATTR_SIZE) { | 3073 | if (attr->ia_valid & ATTR_SIZE) { |
| 3073 | /* version 2 items will be caught by the s_maxbytes check | 3074 | /* version 2 items will be caught by the s_maxbytes check |
| 3074 | ** done for us in vmtruncate | 3075 | ** done for us in vmtruncate |
| @@ -3149,8 +3150,17 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 3149 | journal_end(&th, inode->i_sb, jbegin_count); | 3150 | journal_end(&th, inode->i_sb, jbegin_count); |
| 3150 | } | 3151 | } |
| 3151 | } | 3152 | } |
| 3152 | if (!error) | 3153 | if (!error) { |
| 3154 | /* | ||
| 3155 | * Relax the lock here, as it might truncate the | ||
| 3156 | * inode pages and wait for inode pages locks. | ||
| 3157 | * To release such page lock, the owner needs the | ||
| 3158 | * reiserfs lock | ||
| 3159 | */ | ||
| 3160 | reiserfs_write_unlock_once(inode->i_sb, depth); | ||
| 3153 | error = inode_setattr(inode, attr); | 3161 | error = inode_setattr(inode, attr); |
| 3162 | depth = reiserfs_write_lock_once(inode->i_sb); | ||
| 3163 | } | ||
| 3154 | } | 3164 | } |
| 3155 | 3165 | ||
| 3156 | if (!error && reiserfs_posixacl(inode->i_sb)) { | 3166 | if (!error && reiserfs_posixacl(inode->i_sb)) { |
| @@ -3159,7 +3169,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 3159 | } | 3169 | } |
| 3160 | 3170 | ||
| 3161 | out: | 3171 | out: |
| 3162 | reiserfs_write_unlock(inode->i_sb); | 3172 | reiserfs_write_unlock_once(inode->i_sb, depth); |
| 3173 | |||
| 3163 | return error; | 3174 | return error; |
| 3164 | } | 3175 | } |
| 3165 | 3176 | ||
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index ace77451ceb1..f53505de0712 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
| @@ -104,9 +104,10 @@ setflags_out: | |||
| 104 | err = put_user(inode->i_generation, (int __user *)arg); | 104 | err = put_user(inode->i_generation, (int __user *)arg); |
| 105 | break; | 105 | break; |
| 106 | case REISERFS_IOC_SETVERSION: | 106 | case REISERFS_IOC_SETVERSION: |
| 107 | if (!is_owner_or_cap(inode)) | 107 | if (!is_owner_or_cap(inode)) { |
| 108 | err = -EPERM; | 108 | err = -EPERM; |
| 109 | break; | 109 | break; |
| 110 | } | ||
| 110 | err = mnt_want_write(filp->f_path.mnt); | 111 | err = mnt_want_write(filp->f_path.mnt); |
| 111 | if (err) | 112 | if (err) |
| 112 | break; | 113 | break; |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index c3b004ee627b..81f09fab8ae4 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
| @@ -452,7 +452,9 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | if (dentry->d_inode) { | 454 | if (dentry->d_inode) { |
| 455 | reiserfs_write_lock(inode->i_sb); | ||
| 455 | err = xattr_unlink(xadir->d_inode, dentry); | 456 | err = xattr_unlink(xadir->d_inode, dentry); |
| 457 | reiserfs_write_unlock(inode->i_sb); | ||
| 456 | update_ctime(inode); | 458 | update_ctime(inode); |
| 457 | } | 459 | } |
| 458 | 460 | ||
| @@ -486,17 +488,21 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
| 486 | if (get_inode_sd_version(inode) == STAT_DATA_V1) | 488 | if (get_inode_sd_version(inode) == STAT_DATA_V1) |
| 487 | return -EOPNOTSUPP; | 489 | return -EOPNOTSUPP; |
| 488 | 490 | ||
| 489 | if (!buffer) | ||
| 490 | return lookup_and_delete_xattr(inode, name); | ||
| 491 | |||
| 492 | reiserfs_write_unlock(inode->i_sb); | 491 | reiserfs_write_unlock(inode->i_sb); |
| 492 | |||
| 493 | if (!buffer) { | ||
| 494 | err = lookup_and_delete_xattr(inode, name); | ||
| 495 | reiserfs_write_lock(inode->i_sb); | ||
| 496 | return err; | ||
| 497 | } | ||
| 498 | |||
| 493 | dentry = xattr_lookup(inode, name, flags); | 499 | dentry = xattr_lookup(inode, name, flags); |
| 494 | if (IS_ERR(dentry)) { | 500 | if (IS_ERR(dentry)) { |
| 495 | reiserfs_write_lock(inode->i_sb); | 501 | reiserfs_write_lock(inode->i_sb); |
| 496 | return PTR_ERR(dentry); | 502 | return PTR_ERR(dentry); |
| 497 | } | 503 | } |
| 498 | 504 | ||
| 499 | down_read(&REISERFS_I(inode)->i_xattr_sem); | 505 | down_write(&REISERFS_I(inode)->i_xattr_sem); |
| 500 | 506 | ||
| 501 | reiserfs_write_lock(inode->i_sb); | 507 | reiserfs_write_lock(inode->i_sb); |
| 502 | 508 | ||
| @@ -554,8 +560,12 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
| 554 | .ia_size = buffer_size, | 560 | .ia_size = buffer_size, |
| 555 | .ia_valid = ATTR_SIZE | ATTR_CTIME, | 561 | .ia_valid = ATTR_SIZE | ATTR_CTIME, |
| 556 | }; | 562 | }; |
| 563 | |||
| 564 | reiserfs_write_unlock(inode->i_sb); | ||
| 557 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); | 565 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); |
| 558 | down_write(&dentry->d_inode->i_alloc_sem); | 566 | down_write(&dentry->d_inode->i_alloc_sem); |
| 567 | reiserfs_write_lock(inode->i_sb); | ||
| 568 | |||
| 559 | err = reiserfs_setattr(dentry, &newattrs); | 569 | err = reiserfs_setattr(dentry, &newattrs); |
| 560 | up_write(&dentry->d_inode->i_alloc_sem); | 570 | up_write(&dentry->d_inode->i_alloc_sem); |
| 561 | mutex_unlock(&dentry->d_inode->i_mutex); | 571 | mutex_unlock(&dentry->d_inode->i_mutex); |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index cc32e6ada67b..dd20a7883f0f 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
| @@ -455,7 +455,9 @@ int reiserfs_acl_chmod(struct inode *inode) | |||
| 455 | return 0; | 455 | return 0; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | reiserfs_write_unlock(inode->i_sb); | ||
| 458 | acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); | 459 | acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); |
| 460 | reiserfs_write_lock(inode->i_sb); | ||
| 459 | if (!acl) | 461 | if (!acl) |
| 460 | return 0; | 462 | return 0; |
| 461 | if (IS_ERR(acl)) | 463 | if (IS_ERR(acl)) |
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c index 2512125dfa7c..883ca5ab8af5 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/linux-2.6/xfs_acl.c | |||
| @@ -251,8 +251,9 @@ xfs_set_mode(struct inode *inode, mode_t mode) | |||
| 251 | if (mode != inode->i_mode) { | 251 | if (mode != inode->i_mode) { |
| 252 | struct iattr iattr; | 252 | struct iattr iattr; |
| 253 | 253 | ||
| 254 | iattr.ia_valid = ATTR_MODE; | 254 | iattr.ia_valid = ATTR_MODE | ATTR_CTIME; |
| 255 | iattr.ia_mode = mode; | 255 | iattr.ia_mode = mode; |
| 256 | iattr.ia_ctime = current_fs_time(inode->i_sb); | ||
| 256 | 257 | ||
| 257 | error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL); | 258 | error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL); |
| 258 | } | 259 | } |
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h index c40834bdee58..c22a608321a3 100644 --- a/fs/xfs/linux-2.6/xfs_trace.h +++ b/fs/xfs/linux-2.6/xfs_trace.h | |||
| @@ -33,51 +33,55 @@ struct xfs_dquot; | |||
| 33 | struct xlog_ticket; | 33 | struct xlog_ticket; |
| 34 | struct log; | 34 | struct log; |
| 35 | 35 | ||
| 36 | DECLARE_EVENT_CLASS(xfs_attr_list_class, | ||
| 37 | TP_PROTO(struct xfs_attr_list_context *ctx), | ||
| 38 | TP_ARGS(ctx), | ||
| 39 | TP_STRUCT__entry( | ||
| 40 | __field(dev_t, dev) | ||
| 41 | __field(xfs_ino_t, ino) | ||
| 42 | __field(u32, hashval) | ||
| 43 | __field(u32, blkno) | ||
| 44 | __field(u32, offset) | ||
| 45 | __field(void *, alist) | ||
| 46 | __field(int, bufsize) | ||
| 47 | __field(int, count) | ||
| 48 | __field(int, firstu) | ||
| 49 | __field(int, dupcnt) | ||
| 50 | __field(int, flags) | ||
| 51 | ), | ||
| 52 | TP_fast_assign( | ||
| 53 | __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev; | ||
| 54 | __entry->ino = ctx->dp->i_ino; | ||
| 55 | __entry->hashval = ctx->cursor->hashval; | ||
| 56 | __entry->blkno = ctx->cursor->blkno; | ||
| 57 | __entry->offset = ctx->cursor->offset; | ||
| 58 | __entry->alist = ctx->alist; | ||
| 59 | __entry->bufsize = ctx->bufsize; | ||
| 60 | __entry->count = ctx->count; | ||
| 61 | __entry->firstu = ctx->firstu; | ||
| 62 | __entry->flags = ctx->flags; | ||
| 63 | ), | ||
| 64 | TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u " | ||
| 65 | "alist 0x%p size %u count %u firstu %u flags %d %s", | ||
| 66 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 67 | __entry->ino, | ||
| 68 | __entry->hashval, | ||
| 69 | __entry->blkno, | ||
| 70 | __entry->offset, | ||
| 71 | __entry->dupcnt, | ||
| 72 | __entry->alist, | ||
| 73 | __entry->bufsize, | ||
| 74 | __entry->count, | ||
| 75 | __entry->firstu, | ||
| 76 | __entry->flags, | ||
| 77 | __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS) | ||
| 78 | ) | ||
| 79 | ) | ||
| 80 | |||
| 36 | #define DEFINE_ATTR_LIST_EVENT(name) \ | 81 | #define DEFINE_ATTR_LIST_EVENT(name) \ |
| 37 | TRACE_EVENT(name, \ | 82 | DEFINE_EVENT(xfs_attr_list_class, name, \ |
| 38 | TP_PROTO(struct xfs_attr_list_context *ctx), \ | 83 | TP_PROTO(struct xfs_attr_list_context *ctx), \ |
| 39 | TP_ARGS(ctx), \ | 84 | TP_ARGS(ctx)) |
| 40 | TP_STRUCT__entry( \ | ||
| 41 | __field(dev_t, dev) \ | ||
| 42 | __field(xfs_ino_t, ino) \ | ||
| 43 | __field(u32, hashval) \ | ||
| 44 | __field(u32, blkno) \ | ||
| 45 | __field(u32, offset) \ | ||
| 46 | __field(void *, alist) \ | ||
| 47 | __field(int, bufsize) \ | ||
| 48 | __field(int, count) \ | ||
| 49 | __field(int, firstu) \ | ||
| 50 | __field(int, dupcnt) \ | ||
| 51 | __field(int, flags) \ | ||
| 52 | ), \ | ||
| 53 | TP_fast_assign( \ | ||
| 54 | __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev; \ | ||
| 55 | __entry->ino = ctx->dp->i_ino; \ | ||
| 56 | __entry->hashval = ctx->cursor->hashval; \ | ||
| 57 | __entry->blkno = ctx->cursor->blkno; \ | ||
| 58 | __entry->offset = ctx->cursor->offset; \ | ||
| 59 | __entry->alist = ctx->alist; \ | ||
| 60 | __entry->bufsize = ctx->bufsize; \ | ||
| 61 | __entry->count = ctx->count; \ | ||
| 62 | __entry->firstu = ctx->firstu; \ | ||
| 63 | __entry->flags = ctx->flags; \ | ||
| 64 | ), \ | ||
| 65 | TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u " \ | ||
| 66 | "alist 0x%p size %u count %u firstu %u flags %d %s", \ | ||
| 67 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 68 | __entry->ino, \ | ||
| 69 | __entry->hashval, \ | ||
| 70 | __entry->blkno, \ | ||
| 71 | __entry->offset, \ | ||
| 72 | __entry->dupcnt, \ | ||
| 73 | __entry->alist, \ | ||
| 74 | __entry->bufsize, \ | ||
| 75 | __entry->count, \ | ||
| 76 | __entry->firstu, \ | ||
| 77 | __entry->flags, \ | ||
| 78 | __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS) \ | ||
| 79 | ) \ | ||
| 80 | ) | ||
| 81 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf); | 85 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf); |
| 82 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all); | 86 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all); |
| 83 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf); | 87 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf); |
| @@ -178,91 +182,99 @@ TRACE_EVENT(xfs_iext_insert, | |||
| 178 | (char *)__entry->caller_ip) | 182 | (char *)__entry->caller_ip) |
| 179 | ); | 183 | ); |
| 180 | 184 | ||
| 185 | DECLARE_EVENT_CLASS(xfs_bmap_class, | ||
| 186 | TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, | ||
| 187 | unsigned long caller_ip), | ||
| 188 | TP_ARGS(ip, idx, state, caller_ip), | ||
| 189 | TP_STRUCT__entry( | ||
| 190 | __field(dev_t, dev) | ||
| 191 | __field(xfs_ino_t, ino) | ||
| 192 | __field(xfs_extnum_t, idx) | ||
| 193 | __field(xfs_fileoff_t, startoff) | ||
| 194 | __field(xfs_fsblock_t, startblock) | ||
| 195 | __field(xfs_filblks_t, blockcount) | ||
| 196 | __field(xfs_exntst_t, state) | ||
| 197 | __field(int, bmap_state) | ||
| 198 | __field(unsigned long, caller_ip) | ||
| 199 | ), | ||
| 200 | TP_fast_assign( | ||
| 201 | struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ? | ||
| 202 | ip->i_afp : &ip->i_df; | ||
| 203 | struct xfs_bmbt_irec r; | ||
| 204 | |||
| 205 | xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r); | ||
| 206 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
| 207 | __entry->ino = ip->i_ino; | ||
| 208 | __entry->idx = idx; | ||
| 209 | __entry->startoff = r.br_startoff; | ||
| 210 | __entry->startblock = r.br_startblock; | ||
| 211 | __entry->blockcount = r.br_blockcount; | ||
| 212 | __entry->state = r.br_state; | ||
| 213 | __entry->bmap_state = state; | ||
| 214 | __entry->caller_ip = caller_ip; | ||
| 215 | ), | ||
| 216 | TP_printk("dev %d:%d ino 0x%llx state %s idx %ld " | ||
| 217 | "offset %lld block %s count %lld flag %d caller %pf", | ||
| 218 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 219 | __entry->ino, | ||
| 220 | __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS), | ||
| 221 | (long)__entry->idx, | ||
| 222 | __entry->startoff, | ||
| 223 | xfs_fmtfsblock(__entry->startblock), | ||
| 224 | __entry->blockcount, | ||
| 225 | __entry->state, | ||
| 226 | (char *)__entry->caller_ip) | ||
| 227 | ) | ||
| 228 | |||
| 181 | #define DEFINE_BMAP_EVENT(name) \ | 229 | #define DEFINE_BMAP_EVENT(name) \ |
| 182 | TRACE_EVENT(name, \ | 230 | DEFINE_EVENT(xfs_bmap_class, name, \ |
| 183 | TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \ | 231 | TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \ |
| 184 | unsigned long caller_ip), \ | 232 | unsigned long caller_ip), \ |
| 185 | TP_ARGS(ip, idx, state, caller_ip), \ | 233 | TP_ARGS(ip, idx, state, caller_ip)) |
| 186 | TP_STRUCT__entry( \ | ||
| 187 | __field(dev_t, dev) \ | ||
| 188 | __field(xfs_ino_t, ino) \ | ||
| 189 | __field(xfs_extnum_t, idx) \ | ||
| 190 | __field(xfs_fileoff_t, startoff) \ | ||
| 191 | __field(xfs_fsblock_t, startblock) \ | ||
| 192 | __field(xfs_filblks_t, blockcount) \ | ||
| 193 | __field(xfs_exntst_t, state) \ | ||
| 194 | __field(int, bmap_state) \ | ||
| 195 | __field(unsigned long, caller_ip) \ | ||
| 196 | ), \ | ||
| 197 | TP_fast_assign( \ | ||
| 198 | struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ? \ | ||
| 199 | ip->i_afp : &ip->i_df; \ | ||
| 200 | struct xfs_bmbt_irec r; \ | ||
| 201 | \ | ||
| 202 | xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r); \ | ||
| 203 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
| 204 | __entry->ino = ip->i_ino; \ | ||
| 205 | __entry->idx = idx; \ | ||
| 206 | __entry->startoff = r.br_startoff; \ | ||
| 207 | __entry->startblock = r.br_startblock; \ | ||
| 208 | __entry->blockcount = r.br_blockcount; \ | ||
| 209 | __entry->state = r.br_state; \ | ||
| 210 | __entry->bmap_state = state; \ | ||
| 211 | __entry->caller_ip = caller_ip; \ | ||
| 212 | ), \ | ||
| 213 | TP_printk("dev %d:%d ino 0x%llx state %s idx %ld " \ | ||
| 214 | "offset %lld block %s count %lld flag %d caller %pf", \ | ||
| 215 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 216 | __entry->ino, \ | ||
| 217 | __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS), \ | ||
| 218 | (long)__entry->idx, \ | ||
| 219 | __entry->startoff, \ | ||
| 220 | xfs_fmtfsblock(__entry->startblock), \ | ||
| 221 | __entry->blockcount, \ | ||
| 222 | __entry->state, \ | ||
| 223 | (char *)__entry->caller_ip) \ | ||
| 224 | ) | ||
| 225 | |||
| 226 | DEFINE_BMAP_EVENT(xfs_iext_remove); | 234 | DEFINE_BMAP_EVENT(xfs_iext_remove); |
| 227 | DEFINE_BMAP_EVENT(xfs_bmap_pre_update); | 235 | DEFINE_BMAP_EVENT(xfs_bmap_pre_update); |
| 228 | DEFINE_BMAP_EVENT(xfs_bmap_post_update); | 236 | DEFINE_BMAP_EVENT(xfs_bmap_post_update); |
| 229 | DEFINE_BMAP_EVENT(xfs_extlist); | 237 | DEFINE_BMAP_EVENT(xfs_extlist); |
| 230 | 238 | ||
| 231 | #define DEFINE_BUF_EVENT(tname) \ | 239 | DECLARE_EVENT_CLASS(xfs_buf_class, |
| 232 | TRACE_EVENT(tname, \ | 240 | TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), |
| 233 | TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \ | 241 | TP_ARGS(bp, caller_ip), |
| 234 | TP_ARGS(bp, caller_ip), \ | 242 | TP_STRUCT__entry( |
| 235 | TP_STRUCT__entry( \ | 243 | __field(dev_t, dev) |
| 236 | __field(dev_t, dev) \ | 244 | __field(xfs_daddr_t, bno) |
| 237 | __field(xfs_daddr_t, bno) \ | 245 | __field(size_t, buffer_length) |
| 238 | __field(size_t, buffer_length) \ | 246 | __field(int, hold) |
| 239 | __field(int, hold) \ | 247 | __field(int, pincount) |
| 240 | __field(int, pincount) \ | 248 | __field(unsigned, lockval) |
| 241 | __field(unsigned, lockval) \ | 249 | __field(unsigned, flags) |
| 242 | __field(unsigned, flags) \ | 250 | __field(unsigned long, caller_ip) |
| 243 | __field(unsigned long, caller_ip) \ | 251 | ), |
| 244 | ), \ | 252 | TP_fast_assign( |
| 245 | TP_fast_assign( \ | 253 | __entry->dev = bp->b_target->bt_dev; |
| 246 | __entry->dev = bp->b_target->bt_dev; \ | 254 | __entry->bno = bp->b_bn; |
| 247 | __entry->bno = bp->b_bn; \ | 255 | __entry->buffer_length = bp->b_buffer_length; |
| 248 | __entry->buffer_length = bp->b_buffer_length; \ | 256 | __entry->hold = atomic_read(&bp->b_hold); |
| 249 | __entry->hold = atomic_read(&bp->b_hold); \ | 257 | __entry->pincount = atomic_read(&bp->b_pin_count); |
| 250 | __entry->pincount = atomic_read(&bp->b_pin_count); \ | 258 | __entry->lockval = xfs_buf_lock_value(bp); |
| 251 | __entry->lockval = xfs_buf_lock_value(bp); \ | 259 | __entry->flags = bp->b_flags; |
| 252 | __entry->flags = bp->b_flags; \ | 260 | __entry->caller_ip = caller_ip; |
| 253 | __entry->caller_ip = caller_ip; \ | 261 | ), |
| 254 | ), \ | 262 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " |
| 255 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ | 263 | "lock %d flags %s caller %pf", |
| 256 | "lock %d flags %s caller %pf", \ | 264 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 257 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 265 | (unsigned long long)__entry->bno, |
| 258 | (unsigned long long)__entry->bno, \ | 266 | __entry->buffer_length, |
| 259 | __entry->buffer_length, \ | 267 | __entry->hold, |
| 260 | __entry->hold, \ | 268 | __entry->pincount, |
| 261 | __entry->pincount, \ | 269 | __entry->lockval, |
| 262 | __entry->lockval, \ | 270 | __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), |
| 263 | __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), \ | 271 | (void *)__entry->caller_ip) |
| 264 | (void *)__entry->caller_ip) \ | ||
| 265 | ) | 272 | ) |
| 273 | |||
| 274 | #define DEFINE_BUF_EVENT(name) \ | ||
| 275 | DEFINE_EVENT(xfs_buf_class, name, \ | ||
| 276 | TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \ | ||
| 277 | TP_ARGS(bp, caller_ip)) | ||
| 266 | DEFINE_BUF_EVENT(xfs_buf_init); | 278 | DEFINE_BUF_EVENT(xfs_buf_init); |
| 267 | DEFINE_BUF_EVENT(xfs_buf_free); | 279 | DEFINE_BUF_EVENT(xfs_buf_free); |
| 268 | DEFINE_BUF_EVENT(xfs_buf_hold); | 280 | DEFINE_BUF_EVENT(xfs_buf_hold); |
| @@ -299,41 +311,45 @@ DEFINE_BUF_EVENT(xfs_reset_dqcounts); | |||
| 299 | DEFINE_BUF_EVENT(xfs_inode_item_push); | 311 | DEFINE_BUF_EVENT(xfs_inode_item_push); |
| 300 | 312 | ||
| 301 | /* pass flags explicitly */ | 313 | /* pass flags explicitly */ |
| 302 | #define DEFINE_BUF_FLAGS_EVENT(tname) \ | 314 | DECLARE_EVENT_CLASS(xfs_buf_flags_class, |
| 303 | TRACE_EVENT(tname, \ | 315 | TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), |
| 304 | TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \ | 316 | TP_ARGS(bp, flags, caller_ip), |
| 305 | TP_ARGS(bp, flags, caller_ip), \ | 317 | TP_STRUCT__entry( |
| 306 | TP_STRUCT__entry( \ | 318 | __field(dev_t, dev) |
| 307 | __field(dev_t, dev) \ | 319 | __field(xfs_daddr_t, bno) |
| 308 | __field(xfs_daddr_t, bno) \ | 320 | __field(size_t, buffer_length) |
| 309 | __field(size_t, buffer_length) \ | 321 | __field(int, hold) |
| 310 | __field(int, hold) \ | 322 | __field(int, pincount) |
| 311 | __field(int, pincount) \ | 323 | __field(unsigned, lockval) |
| 312 | __field(unsigned, lockval) \ | 324 | __field(unsigned, flags) |
| 313 | __field(unsigned, flags) \ | 325 | __field(unsigned long, caller_ip) |
| 314 | __field(unsigned long, caller_ip) \ | 326 | ), |
| 315 | ), \ | 327 | TP_fast_assign( |
| 316 | TP_fast_assign( \ | 328 | __entry->dev = bp->b_target->bt_dev; |
| 317 | __entry->dev = bp->b_target->bt_dev; \ | 329 | __entry->bno = bp->b_bn; |
| 318 | __entry->bno = bp->b_bn; \ | 330 | __entry->buffer_length = bp->b_buffer_length; |
| 319 | __entry->buffer_length = bp->b_buffer_length; \ | 331 | __entry->flags = flags; |
| 320 | __entry->flags = flags; \ | 332 | __entry->hold = atomic_read(&bp->b_hold); |
| 321 | __entry->hold = atomic_read(&bp->b_hold); \ | 333 | __entry->pincount = atomic_read(&bp->b_pin_count); |
| 322 | __entry->pincount = atomic_read(&bp->b_pin_count); \ | 334 | __entry->lockval = xfs_buf_lock_value(bp); |
| 323 | __entry->lockval = xfs_buf_lock_value(bp); \ | 335 | __entry->caller_ip = caller_ip; |
| 324 | __entry->caller_ip = caller_ip; \ | 336 | ), |
| 325 | ), \ | 337 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " |
| 326 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ | 338 | "lock %d flags %s caller %pf", |
| 327 | "lock %d flags %s caller %pf", \ | 339 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 328 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 340 | (unsigned long long)__entry->bno, |
| 329 | (unsigned long long)__entry->bno, \ | 341 | __entry->buffer_length, |
| 330 | __entry->buffer_length, \ | 342 | __entry->hold, |
| 331 | __entry->hold, \ | 343 | __entry->pincount, |
| 332 | __entry->pincount, \ | 344 | __entry->lockval, |
| 333 | __entry->lockval, \ | 345 | __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), |
| 334 | __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), \ | 346 | (void *)__entry->caller_ip) |
| 335 | (void *)__entry->caller_ip) \ | ||
| 336 | ) | 347 | ) |
| 348 | |||
| 349 | #define DEFINE_BUF_FLAGS_EVENT(name) \ | ||
| 350 | DEFINE_EVENT(xfs_buf_flags_class, name, \ | ||
| 351 | TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \ | ||
| 352 | TP_ARGS(bp, flags, caller_ip)) | ||
| 337 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_find); | 353 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_find); |
| 338 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_get); | 354 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_get); |
| 339 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_read); | 355 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_read); |
| @@ -376,55 +392,58 @@ TRACE_EVENT(xfs_buf_ioerror, | |||
| 376 | (void *)__entry->caller_ip) | 392 | (void *)__entry->caller_ip) |
| 377 | ); | 393 | ); |
| 378 | 394 | ||
| 379 | #define DEFINE_BUF_ITEM_EVENT(tname) \ | 395 | DECLARE_EVENT_CLASS(xfs_buf_item_class, |
| 380 | TRACE_EVENT(tname, \ | 396 | TP_PROTO(struct xfs_buf_log_item *bip), |
| 381 | TP_PROTO(struct xfs_buf_log_item *bip), \ | 397 | TP_ARGS(bip), |
| 382 | TP_ARGS(bip), \ | 398 | TP_STRUCT__entry( |
| 383 | TP_STRUCT__entry( \ | 399 | __field(dev_t, dev) |
| 384 | __field(dev_t, dev) \ | 400 | __field(xfs_daddr_t, buf_bno) |
| 385 | __field(xfs_daddr_t, buf_bno) \ | 401 | __field(size_t, buf_len) |
| 386 | __field(size_t, buf_len) \ | 402 | __field(int, buf_hold) |
| 387 | __field(int, buf_hold) \ | 403 | __field(int, buf_pincount) |
| 388 | __field(int, buf_pincount) \ | 404 | __field(int, buf_lockval) |
| 389 | __field(int, buf_lockval) \ | 405 | __field(unsigned, buf_flags) |
| 390 | __field(unsigned, buf_flags) \ | 406 | __field(unsigned, bli_recur) |
| 391 | __field(unsigned, bli_recur) \ | 407 | __field(int, bli_refcount) |
| 392 | __field(int, bli_refcount) \ | 408 | __field(unsigned, bli_flags) |
| 393 | __field(unsigned, bli_flags) \ | 409 | __field(void *, li_desc) |
| 394 | __field(void *, li_desc) \ | 410 | __field(unsigned, li_flags) |
| 395 | __field(unsigned, li_flags) \ | 411 | ), |
| 396 | ), \ | 412 | TP_fast_assign( |
| 397 | TP_fast_assign( \ | 413 | __entry->dev = bip->bli_buf->b_target->bt_dev; |
| 398 | __entry->dev = bip->bli_buf->b_target->bt_dev; \ | 414 | __entry->bli_flags = bip->bli_flags; |
| 399 | __entry->bli_flags = bip->bli_flags; \ | 415 | __entry->bli_recur = bip->bli_recur; |
| 400 | __entry->bli_recur = bip->bli_recur; \ | 416 | __entry->bli_refcount = atomic_read(&bip->bli_refcount); |
| 401 | __entry->bli_refcount = atomic_read(&bip->bli_refcount); \ | 417 | __entry->buf_bno = bip->bli_buf->b_bn; |
| 402 | __entry->buf_bno = bip->bli_buf->b_bn; \ | 418 | __entry->buf_len = bip->bli_buf->b_buffer_length; |
| 403 | __entry->buf_len = bip->bli_buf->b_buffer_length; \ | 419 | __entry->buf_flags = bip->bli_buf->b_flags; |
| 404 | __entry->buf_flags = bip->bli_buf->b_flags; \ | 420 | __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold); |
| 405 | __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold); \ | 421 | __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count); |
| 406 | __entry->buf_pincount = \ | 422 | __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf); |
| 407 | atomic_read(&bip->bli_buf->b_pin_count); \ | 423 | __entry->li_desc = bip->bli_item.li_desc; |
| 408 | __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf); \ | 424 | __entry->li_flags = bip->bli_item.li_flags; |
| 409 | __entry->li_desc = bip->bli_item.li_desc; \ | 425 | ), |
| 410 | __entry->li_flags = bip->bli_item.li_flags; \ | 426 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " |
| 411 | ), \ | 427 | "lock %d flags %s recur %d refcount %d bliflags %s " |
| 412 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ | 428 | "lidesc 0x%p liflags %s", |
| 413 | "lock %d flags %s recur %d refcount %d bliflags %s " \ | 429 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 414 | "lidesc 0x%p liflags %s", \ | 430 | (unsigned long long)__entry->buf_bno, |
| 415 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 431 | __entry->buf_len, |
| 416 | (unsigned long long)__entry->buf_bno, \ | 432 | __entry->buf_hold, |
| 417 | __entry->buf_len, \ | 433 | __entry->buf_pincount, |
| 418 | __entry->buf_hold, \ | 434 | __entry->buf_lockval, |
| 419 | __entry->buf_pincount, \ | 435 | __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS), |
| 420 | __entry->buf_lockval, \ | 436 | __entry->bli_recur, |
| 421 | __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS), \ | 437 | __entry->bli_refcount, |
| 422 | __entry->bli_recur, \ | 438 | __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS), |
| 423 | __entry->bli_refcount, \ | 439 | __entry->li_desc, |
| 424 | __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS), \ | 440 | __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS)) |
| 425 | __entry->li_desc, \ | ||
| 426 | __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS)) \ | ||
| 427 | ) | 441 | ) |
| 442 | |||
| 443 | #define DEFINE_BUF_ITEM_EVENT(name) \ | ||
| 444 | DEFINE_EVENT(xfs_buf_item_class, name, \ | ||
| 445 | TP_PROTO(struct xfs_buf_log_item *bip), \ | ||
| 446 | TP_ARGS(bip)) | ||
| 428 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size); | 447 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size); |
| 429 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale); | 448 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale); |
| 430 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format); | 449 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format); |
| @@ -450,78 +469,90 @@ DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold); | |||
| 450 | DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release); | 469 | DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release); |
| 451 | DEFINE_BUF_ITEM_EVENT(xfs_trans_binval); | 470 | DEFINE_BUF_ITEM_EVENT(xfs_trans_binval); |
| 452 | 471 | ||
| 472 | DECLARE_EVENT_CLASS(xfs_lock_class, | ||
| 473 | TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, | ||
| 474 | unsigned long caller_ip), | ||
| 475 | TP_ARGS(ip, lock_flags, caller_ip), | ||
| 476 | TP_STRUCT__entry( | ||
| 477 | __field(dev_t, dev) | ||
| 478 | __field(xfs_ino_t, ino) | ||
| 479 | __field(int, lock_flags) | ||
| 480 | __field(unsigned long, caller_ip) | ||
| 481 | ), | ||
| 482 | TP_fast_assign( | ||
| 483 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
| 484 | __entry->ino = ip->i_ino; | ||
| 485 | __entry->lock_flags = lock_flags; | ||
| 486 | __entry->caller_ip = caller_ip; | ||
| 487 | ), | ||
| 488 | TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf", | ||
| 489 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 490 | __entry->ino, | ||
| 491 | __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS), | ||
| 492 | (void *)__entry->caller_ip) | ||
| 493 | ) | ||
| 494 | |||
| 453 | #define DEFINE_LOCK_EVENT(name) \ | 495 | #define DEFINE_LOCK_EVENT(name) \ |
| 454 | TRACE_EVENT(name, \ | 496 | DEFINE_EVENT(xfs_lock_class, name, \ |
| 455 | TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \ | 497 | TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \ |
| 456 | unsigned long caller_ip), \ | 498 | unsigned long caller_ip), \ |
| 457 | TP_ARGS(ip, lock_flags, caller_ip), \ | 499 | TP_ARGS(ip, lock_flags, caller_ip)) |
| 458 | TP_STRUCT__entry( \ | ||
| 459 | __field(dev_t, dev) \ | ||
| 460 | __field(xfs_ino_t, ino) \ | ||
| 461 | __field(int, lock_flags) \ | ||
| 462 | __field(unsigned long, caller_ip) \ | ||
| 463 | ), \ | ||
| 464 | TP_fast_assign( \ | ||
| 465 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
| 466 | __entry->ino = ip->i_ino; \ | ||
| 467 | __entry->lock_flags = lock_flags; \ | ||
| 468 | __entry->caller_ip = caller_ip; \ | ||
| 469 | ), \ | ||
| 470 | TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf", \ | ||
| 471 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 472 | __entry->ino, \ | ||
| 473 | __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS), \ | ||
| 474 | (void *)__entry->caller_ip) \ | ||
| 475 | ) | ||
| 476 | |||
| 477 | DEFINE_LOCK_EVENT(xfs_ilock); | 500 | DEFINE_LOCK_EVENT(xfs_ilock); |
| 478 | DEFINE_LOCK_EVENT(xfs_ilock_nowait); | 501 | DEFINE_LOCK_EVENT(xfs_ilock_nowait); |
| 479 | DEFINE_LOCK_EVENT(xfs_ilock_demote); | 502 | DEFINE_LOCK_EVENT(xfs_ilock_demote); |
| 480 | DEFINE_LOCK_EVENT(xfs_iunlock); | 503 | DEFINE_LOCK_EVENT(xfs_iunlock); |
| 481 | 504 | ||
| 505 | DECLARE_EVENT_CLASS(xfs_iget_class, | ||
| 506 | TP_PROTO(struct xfs_inode *ip), | ||
| 507 | TP_ARGS(ip), | ||
| 508 | TP_STRUCT__entry( | ||
| 509 | __field(dev_t, dev) | ||
| 510 | __field(xfs_ino_t, ino) | ||
| 511 | ), | ||
| 512 | TP_fast_assign( | ||
| 513 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
| 514 | __entry->ino = ip->i_ino; | ||
| 515 | ), | ||
| 516 | TP_printk("dev %d:%d ino 0x%llx", | ||
| 517 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 518 | __entry->ino) | ||
| 519 | ) | ||
| 520 | |||
| 482 | #define DEFINE_IGET_EVENT(name) \ | 521 | #define DEFINE_IGET_EVENT(name) \ |
| 483 | TRACE_EVENT(name, \ | 522 | DEFINE_EVENT(xfs_iget_class, name, \ |
| 484 | TP_PROTO(struct xfs_inode *ip), \ | 523 | TP_PROTO(struct xfs_inode *ip), \ |
| 485 | TP_ARGS(ip), \ | 524 | TP_ARGS(ip)) |
| 486 | TP_STRUCT__entry( \ | ||
| 487 | __field(dev_t, dev) \ | ||
| 488 | __field(xfs_ino_t, ino) \ | ||
| 489 | ), \ | ||
| 490 | TP_fast_assign( \ | ||
| 491 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
| 492 | __entry->ino = ip->i_ino; \ | ||
| 493 | ), \ | ||
| 494 | TP_printk("dev %d:%d ino 0x%llx", \ | ||
| 495 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 496 | __entry->ino) \ | ||
| 497 | ) | ||
| 498 | DEFINE_IGET_EVENT(xfs_iget_skip); | 525 | DEFINE_IGET_EVENT(xfs_iget_skip); |
| 499 | DEFINE_IGET_EVENT(xfs_iget_reclaim); | 526 | DEFINE_IGET_EVENT(xfs_iget_reclaim); |
| 500 | DEFINE_IGET_EVENT(xfs_iget_found); | 527 | DEFINE_IGET_EVENT(xfs_iget_found); |
| 501 | DEFINE_IGET_EVENT(xfs_iget_alloc); | 528 | DEFINE_IGET_EVENT(xfs_iget_alloc); |
| 502 | 529 | ||
| 530 | DECLARE_EVENT_CLASS(xfs_inode_class, | ||
| 531 | TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), | ||
| 532 | TP_ARGS(ip, caller_ip), | ||
| 533 | TP_STRUCT__entry( | ||
| 534 | __field(dev_t, dev) | ||
| 535 | __field(xfs_ino_t, ino) | ||
| 536 | __field(int, count) | ||
| 537 | __field(unsigned long, caller_ip) | ||
| 538 | ), | ||
| 539 | TP_fast_assign( | ||
| 540 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
| 541 | __entry->ino = ip->i_ino; | ||
| 542 | __entry->count = atomic_read(&VFS_I(ip)->i_count); | ||
| 543 | __entry->caller_ip = caller_ip; | ||
| 544 | ), | ||
| 545 | TP_printk("dev %d:%d ino 0x%llx count %d caller %pf", | ||
| 546 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 547 | __entry->ino, | ||
| 548 | __entry->count, | ||
| 549 | (char *)__entry->caller_ip) | ||
| 550 | ) | ||
| 551 | |||
| 503 | #define DEFINE_INODE_EVENT(name) \ | 552 | #define DEFINE_INODE_EVENT(name) \ |
| 504 | TRACE_EVENT(name, \ | 553 | DEFINE_EVENT(xfs_inode_class, name, \ |
| 505 | TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \ | 554 | TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \ |
| 506 | TP_ARGS(ip, caller_ip), \ | 555 | TP_ARGS(ip, caller_ip)) |
| 507 | TP_STRUCT__entry( \ | ||
| 508 | __field(dev_t, dev) \ | ||
| 509 | __field(xfs_ino_t, ino) \ | ||
| 510 | __field(int, count) \ | ||
| 511 | __field(unsigned long, caller_ip) \ | ||
| 512 | ), \ | ||
| 513 | TP_fast_assign( \ | ||
| 514 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
| 515 | __entry->ino = ip->i_ino; \ | ||
| 516 | __entry->count = atomic_read(&VFS_I(ip)->i_count); \ | ||
| 517 | __entry->caller_ip = caller_ip; \ | ||
| 518 | ), \ | ||
| 519 | TP_printk("dev %d:%d ino 0x%llx count %d caller %pf", \ | ||
| 520 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 521 | __entry->ino, \ | ||
| 522 | __entry->count, \ | ||
| 523 | (char *)__entry->caller_ip) \ | ||
| 524 | ) | ||
| 525 | DEFINE_INODE_EVENT(xfs_ihold); | 556 | DEFINE_INODE_EVENT(xfs_ihold); |
| 526 | DEFINE_INODE_EVENT(xfs_irele); | 557 | DEFINE_INODE_EVENT(xfs_irele); |
| 527 | /* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */ | 558 | /* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */ |
| @@ -529,55 +560,59 @@ DEFINE_INODE_EVENT(xfs_inode); | |||
| 529 | #define xfs_itrace_entry(ip) \ | 560 | #define xfs_itrace_entry(ip) \ |
| 530 | trace_xfs_inode(ip, _THIS_IP_) | 561 | trace_xfs_inode(ip, _THIS_IP_) |
| 531 | 562 | ||
| 532 | #define DEFINE_DQUOT_EVENT(tname) \ | 563 | DECLARE_EVENT_CLASS(xfs_dquot_class, |
| 533 | TRACE_EVENT(tname, \ | 564 | TP_PROTO(struct xfs_dquot *dqp), |
| 534 | TP_PROTO(struct xfs_dquot *dqp), \ | 565 | TP_ARGS(dqp), |
| 535 | TP_ARGS(dqp), \ | 566 | TP_STRUCT__entry( |
| 536 | TP_STRUCT__entry( \ | 567 | __field(dev_t, dev) |
| 537 | __field(dev_t, dev) \ | 568 | __field(__be32, id) |
| 538 | __field(__be32, id) \ | 569 | __field(unsigned, flags) |
| 539 | __field(unsigned, flags) \ | 570 | __field(unsigned, nrefs) |
| 540 | __field(unsigned, nrefs) \ | 571 | __field(unsigned long long, res_bcount) |
| 541 | __field(unsigned long long, res_bcount) \ | 572 | __field(unsigned long long, bcount) |
| 542 | __field(unsigned long long, bcount) \ | 573 | __field(unsigned long long, icount) |
| 543 | __field(unsigned long long, icount) \ | 574 | __field(unsigned long long, blk_hardlimit) |
| 544 | __field(unsigned long long, blk_hardlimit) \ | 575 | __field(unsigned long long, blk_softlimit) |
| 545 | __field(unsigned long long, blk_softlimit) \ | 576 | __field(unsigned long long, ino_hardlimit) |
| 546 | __field(unsigned long long, ino_hardlimit) \ | 577 | __field(unsigned long long, ino_softlimit) |
| 547 | __field(unsigned long long, ino_softlimit) \ | ||
| 548 | ), \ | ||
| 549 | TP_fast_assign( \ | ||
| 550 | __entry->dev = dqp->q_mount->m_super->s_dev; \ | ||
| 551 | __entry->id = dqp->q_core.d_id; \ | ||
| 552 | __entry->flags = dqp->dq_flags; \ | ||
| 553 | __entry->nrefs = dqp->q_nrefs; \ | ||
| 554 | __entry->res_bcount = dqp->q_res_bcount; \ | ||
| 555 | __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount); \ | ||
| 556 | __entry->icount = be64_to_cpu(dqp->q_core.d_icount); \ | ||
| 557 | __entry->blk_hardlimit = \ | ||
| 558 | be64_to_cpu(dqp->q_core.d_blk_hardlimit); \ | ||
| 559 | __entry->blk_softlimit = \ | ||
| 560 | be64_to_cpu(dqp->q_core.d_blk_softlimit); \ | ||
| 561 | __entry->ino_hardlimit = \ | ||
| 562 | be64_to_cpu(dqp->q_core.d_ino_hardlimit); \ | ||
| 563 | __entry->ino_softlimit = \ | ||
| 564 | be64_to_cpu(dqp->q_core.d_ino_softlimit); \ | ||
| 565 | ), \ | 578 | ), \ |
| 566 | TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx " \ | 579 | TP_fast_assign( |
| 567 | "bcnt 0x%llx [hard 0x%llx | soft 0x%llx] " \ | 580 | __entry->dev = dqp->q_mount->m_super->s_dev; |
| 568 | "icnt 0x%llx [hard 0x%llx | soft 0x%llx]", \ | 581 | __entry->id = dqp->q_core.d_id; |
| 569 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 582 | __entry->flags = dqp->dq_flags; |
| 570 | be32_to_cpu(__entry->id), \ | 583 | __entry->nrefs = dqp->q_nrefs; |
| 571 | __print_flags(__entry->flags, "|", XFS_DQ_FLAGS), \ | 584 | __entry->res_bcount = dqp->q_res_bcount; |
| 572 | __entry->nrefs, \ | 585 | __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount); |
| 573 | __entry->res_bcount, \ | 586 | __entry->icount = be64_to_cpu(dqp->q_core.d_icount); |
| 574 | __entry->bcount, \ | 587 | __entry->blk_hardlimit = |
| 575 | __entry->blk_hardlimit, \ | 588 | be64_to_cpu(dqp->q_core.d_blk_hardlimit); |
| 576 | __entry->blk_softlimit, \ | 589 | __entry->blk_softlimit = |
| 577 | __entry->icount, \ | 590 | be64_to_cpu(dqp->q_core.d_blk_softlimit); |
| 578 | __entry->ino_hardlimit, \ | 591 | __entry->ino_hardlimit = |
| 579 | __entry->ino_softlimit) \ | 592 | be64_to_cpu(dqp->q_core.d_ino_hardlimit); |
| 593 | __entry->ino_softlimit = | ||
| 594 | be64_to_cpu(dqp->q_core.d_ino_softlimit); | ||
| 595 | ), | ||
| 596 | TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx " | ||
| 597 | "bcnt 0x%llx [hard 0x%llx | soft 0x%llx] " | ||
| 598 | "icnt 0x%llx [hard 0x%llx | soft 0x%llx]", | ||
| 599 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 600 | be32_to_cpu(__entry->id), | ||
| 601 | __print_flags(__entry->flags, "|", XFS_DQ_FLAGS), | ||
| 602 | __entry->nrefs, | ||
| 603 | __entry->res_bcount, | ||
| 604 | __entry->bcount, | ||
| 605 | __entry->blk_hardlimit, | ||
| 606 | __entry->blk_softlimit, | ||
| 607 | __entry->icount, | ||
| 608 | __entry->ino_hardlimit, | ||
| 609 | __entry->ino_softlimit) | ||
| 580 | ) | 610 | ) |
| 611 | |||
| 612 | #define DEFINE_DQUOT_EVENT(name) \ | ||
| 613 | DEFINE_EVENT(xfs_dquot_class, name, \ | ||
| 614 | TP_PROTO(struct xfs_dquot *dqp), \ | ||
| 615 | TP_ARGS(dqp)) | ||
| 581 | DEFINE_DQUOT_EVENT(xfs_dqadjust); | 616 | DEFINE_DQUOT_EVENT(xfs_dqadjust); |
| 582 | DEFINE_DQUOT_EVENT(xfs_dqshake_dirty); | 617 | DEFINE_DQUOT_EVENT(xfs_dqshake_dirty); |
| 583 | DEFINE_DQUOT_EVENT(xfs_dqshake_unlink); | 618 | DEFINE_DQUOT_EVENT(xfs_dqshake_unlink); |
| @@ -610,72 +645,75 @@ DEFINE_DQUOT_EVENT(xfs_dqflush_done); | |||
| 610 | DEFINE_IGET_EVENT(xfs_dquot_dqalloc); | 645 | DEFINE_IGET_EVENT(xfs_dquot_dqalloc); |
| 611 | DEFINE_IGET_EVENT(xfs_dquot_dqdetach); | 646 | DEFINE_IGET_EVENT(xfs_dquot_dqdetach); |
| 612 | 647 | ||
| 648 | DECLARE_EVENT_CLASS(xfs_loggrant_class, | ||
| 649 | TP_PROTO(struct log *log, struct xlog_ticket *tic), | ||
| 650 | TP_ARGS(log, tic), | ||
| 651 | TP_STRUCT__entry( | ||
| 652 | __field(dev_t, dev) | ||
| 653 | __field(unsigned, trans_type) | ||
| 654 | __field(char, ocnt) | ||
| 655 | __field(char, cnt) | ||
| 656 | __field(int, curr_res) | ||
| 657 | __field(int, unit_res) | ||
| 658 | __field(unsigned int, flags) | ||
| 659 | __field(void *, reserve_headq) | ||
| 660 | __field(void *, write_headq) | ||
| 661 | __field(int, grant_reserve_cycle) | ||
| 662 | __field(int, grant_reserve_bytes) | ||
| 663 | __field(int, grant_write_cycle) | ||
| 664 | __field(int, grant_write_bytes) | ||
| 665 | __field(int, curr_cycle) | ||
| 666 | __field(int, curr_block) | ||
| 667 | __field(xfs_lsn_t, tail_lsn) | ||
| 668 | ), | ||
| 669 | TP_fast_assign( | ||
| 670 | __entry->dev = log->l_mp->m_super->s_dev; | ||
| 671 | __entry->trans_type = tic->t_trans_type; | ||
| 672 | __entry->ocnt = tic->t_ocnt; | ||
| 673 | __entry->cnt = tic->t_cnt; | ||
| 674 | __entry->curr_res = tic->t_curr_res; | ||
| 675 | __entry->unit_res = tic->t_unit_res; | ||
| 676 | __entry->flags = tic->t_flags; | ||
| 677 | __entry->reserve_headq = log->l_reserve_headq; | ||
| 678 | __entry->write_headq = log->l_write_headq; | ||
| 679 | __entry->grant_reserve_cycle = log->l_grant_reserve_cycle; | ||
| 680 | __entry->grant_reserve_bytes = log->l_grant_reserve_bytes; | ||
| 681 | __entry->grant_write_cycle = log->l_grant_write_cycle; | ||
| 682 | __entry->grant_write_bytes = log->l_grant_write_bytes; | ||
| 683 | __entry->curr_cycle = log->l_curr_cycle; | ||
| 684 | __entry->curr_block = log->l_curr_block; | ||
| 685 | __entry->tail_lsn = log->l_tail_lsn; | ||
| 686 | ), | ||
| 687 | TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u " | ||
| 688 | "t_unit_res %u t_flags %s reserve_headq 0x%p " | ||
| 689 | "write_headq 0x%p grant_reserve_cycle %d " | ||
| 690 | "grant_reserve_bytes %d grant_write_cycle %d " | ||
| 691 | "grant_write_bytes %d curr_cycle %d curr_block %d " | ||
| 692 | "tail_cycle %d tail_block %d", | ||
| 693 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 694 | __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES), | ||
| 695 | __entry->ocnt, | ||
| 696 | __entry->cnt, | ||
| 697 | __entry->curr_res, | ||
| 698 | __entry->unit_res, | ||
| 699 | __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS), | ||
| 700 | __entry->reserve_headq, | ||
| 701 | __entry->write_headq, | ||
| 702 | __entry->grant_reserve_cycle, | ||
| 703 | __entry->grant_reserve_bytes, | ||
| 704 | __entry->grant_write_cycle, | ||
| 705 | __entry->grant_write_bytes, | ||
| 706 | __entry->curr_cycle, | ||
| 707 | __entry->curr_block, | ||
| 708 | CYCLE_LSN(__entry->tail_lsn), | ||
| 709 | BLOCK_LSN(__entry->tail_lsn) | ||
| 710 | ) | ||
| 711 | ) | ||
| 613 | 712 | ||
| 614 | #define DEFINE_LOGGRANT_EVENT(tname) \ | 713 | #define DEFINE_LOGGRANT_EVENT(name) \ |
| 615 | TRACE_EVENT(tname, \ | 714 | DEFINE_EVENT(xfs_loggrant_class, name, \ |
| 616 | TP_PROTO(struct log *log, struct xlog_ticket *tic), \ | 715 | TP_PROTO(struct log *log, struct xlog_ticket *tic), \ |
| 617 | TP_ARGS(log, tic), \ | 716 | TP_ARGS(log, tic)) |
| 618 | TP_STRUCT__entry( \ | ||
| 619 | __field(dev_t, dev) \ | ||
| 620 | __field(unsigned, trans_type) \ | ||
| 621 | __field(char, ocnt) \ | ||
| 622 | __field(char, cnt) \ | ||
| 623 | __field(int, curr_res) \ | ||
| 624 | __field(int, unit_res) \ | ||
| 625 | __field(unsigned int, flags) \ | ||
| 626 | __field(void *, reserve_headq) \ | ||
| 627 | __field(void *, write_headq) \ | ||
| 628 | __field(int, grant_reserve_cycle) \ | ||
| 629 | __field(int, grant_reserve_bytes) \ | ||
| 630 | __field(int, grant_write_cycle) \ | ||
| 631 | __field(int, grant_write_bytes) \ | ||
| 632 | __field(int, curr_cycle) \ | ||
| 633 | __field(int, curr_block) \ | ||
| 634 | __field(xfs_lsn_t, tail_lsn) \ | ||
| 635 | ), \ | ||
| 636 | TP_fast_assign( \ | ||
| 637 | __entry->dev = log->l_mp->m_super->s_dev; \ | ||
| 638 | __entry->trans_type = tic->t_trans_type; \ | ||
| 639 | __entry->ocnt = tic->t_ocnt; \ | ||
| 640 | __entry->cnt = tic->t_cnt; \ | ||
| 641 | __entry->curr_res = tic->t_curr_res; \ | ||
| 642 | __entry->unit_res = tic->t_unit_res; \ | ||
| 643 | __entry->flags = tic->t_flags; \ | ||
| 644 | __entry->reserve_headq = log->l_reserve_headq; \ | ||
| 645 | __entry->write_headq = log->l_write_headq; \ | ||
| 646 | __entry->grant_reserve_cycle = log->l_grant_reserve_cycle; \ | ||
| 647 | __entry->grant_reserve_bytes = log->l_grant_reserve_bytes; \ | ||
| 648 | __entry->grant_write_cycle = log->l_grant_write_cycle; \ | ||
| 649 | __entry->grant_write_bytes = log->l_grant_write_bytes; \ | ||
| 650 | __entry->curr_cycle = log->l_curr_cycle; \ | ||
| 651 | __entry->curr_block = log->l_curr_block; \ | ||
| 652 | __entry->tail_lsn = log->l_tail_lsn; \ | ||
| 653 | ), \ | ||
| 654 | TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u " \ | ||
| 655 | "t_unit_res %u t_flags %s reserve_headq 0x%p " \ | ||
| 656 | "write_headq 0x%p grant_reserve_cycle %d " \ | ||
| 657 | "grant_reserve_bytes %d grant_write_cycle %d " \ | ||
| 658 | "grant_write_bytes %d curr_cycle %d curr_block %d " \ | ||
| 659 | "tail_cycle %d tail_block %d", \ | ||
| 660 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 661 | __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES), \ | ||
| 662 | __entry->ocnt, \ | ||
| 663 | __entry->cnt, \ | ||
| 664 | __entry->curr_res, \ | ||
| 665 | __entry->unit_res, \ | ||
| 666 | __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS), \ | ||
| 667 | __entry->reserve_headq, \ | ||
| 668 | __entry->write_headq, \ | ||
| 669 | __entry->grant_reserve_cycle, \ | ||
| 670 | __entry->grant_reserve_bytes, \ | ||
| 671 | __entry->grant_write_cycle, \ | ||
| 672 | __entry->grant_write_bytes, \ | ||
| 673 | __entry->curr_cycle, \ | ||
| 674 | __entry->curr_block, \ | ||
| 675 | CYCLE_LSN(__entry->tail_lsn), \ | ||
| 676 | BLOCK_LSN(__entry->tail_lsn) \ | ||
| 677 | ) \ | ||
| 678 | ) | ||
| 679 | DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm); | 717 | DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm); |
| 680 | DEFINE_LOGGRANT_EVENT(xfs_log_done_perm); | 718 | DEFINE_LOGGRANT_EVENT(xfs_log_done_perm); |
| 681 | DEFINE_LOGGRANT_EVENT(xfs_log_reserve); | 719 | DEFINE_LOGGRANT_EVENT(xfs_log_reserve); |
| @@ -815,7 +853,7 @@ TRACE_EVENT(name, \ | |||
| 815 | ), \ | 853 | ), \ |
| 816 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \ | 854 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \ |
| 817 | "offset 0x%llx count %zd flags %s " \ | 855 | "offset 0x%llx count %zd flags %s " \ |
| 818 | "startoff 0x%llx startblock 0x%llx blockcount 0x%llx", \ | 856 | "startoff 0x%llx startblock %s blockcount 0x%llx", \ |
| 819 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 857 | MAJOR(__entry->dev), MINOR(__entry->dev), \ |
| 820 | __entry->ino, \ | 858 | __entry->ino, \ |
| 821 | __entry->size, \ | 859 | __entry->size, \ |
| @@ -824,7 +862,7 @@ TRACE_EVENT(name, \ | |||
| 824 | __entry->count, \ | 862 | __entry->count, \ |
| 825 | __print_flags(__entry->flags, "|", BMAPI_FLAGS), \ | 863 | __print_flags(__entry->flags, "|", BMAPI_FLAGS), \ |
| 826 | __entry->startoff, \ | 864 | __entry->startoff, \ |
| 827 | __entry->startblock, \ | 865 | xfs_fmtfsblock(__entry->startblock), \ |
| 828 | __entry->blockcount) \ | 866 | __entry->blockcount) \ |
| 829 | ) | 867 | ) |
| 830 | DEFINE_IOMAP_EVENT(xfs_iomap_enter); | 868 | DEFINE_IOMAP_EVENT(xfs_iomap_enter); |
| @@ -897,28 +935,32 @@ TRACE_EVENT(xfs_itruncate_start, | |||
| 897 | __entry->toss_finish) | 935 | __entry->toss_finish) |
| 898 | ); | 936 | ); |
| 899 | 937 | ||
| 938 | DECLARE_EVENT_CLASS(xfs_itrunc_class, | ||
| 939 | TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), | ||
| 940 | TP_ARGS(ip, new_size), | ||
| 941 | TP_STRUCT__entry( | ||
| 942 | __field(dev_t, dev) | ||
| 943 | __field(xfs_ino_t, ino) | ||
| 944 | __field(xfs_fsize_t, size) | ||
| 945 | __field(xfs_fsize_t, new_size) | ||
| 946 | ), | ||
| 947 | TP_fast_assign( | ||
| 948 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
| 949 | __entry->ino = ip->i_ino; | ||
| 950 | __entry->size = ip->i_d.di_size; | ||
| 951 | __entry->new_size = new_size; | ||
| 952 | ), | ||
| 953 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx", | ||
| 954 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 955 | __entry->ino, | ||
| 956 | __entry->size, | ||
| 957 | __entry->new_size) | ||
| 958 | ) | ||
| 959 | |||
| 900 | #define DEFINE_ITRUNC_EVENT(name) \ | 960 | #define DEFINE_ITRUNC_EVENT(name) \ |
| 901 | TRACE_EVENT(name, \ | 961 | DEFINE_EVENT(xfs_itrunc_class, name, \ |
| 902 | TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \ | 962 | TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \ |
| 903 | TP_ARGS(ip, new_size), \ | 963 | TP_ARGS(ip, new_size)) |
| 904 | TP_STRUCT__entry( \ | ||
| 905 | __field(dev_t, dev) \ | ||
| 906 | __field(xfs_ino_t, ino) \ | ||
| 907 | __field(xfs_fsize_t, size) \ | ||
| 908 | __field(xfs_fsize_t, new_size) \ | ||
| 909 | ), \ | ||
| 910 | TP_fast_assign( \ | ||
| 911 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
| 912 | __entry->ino = ip->i_ino; \ | ||
| 913 | __entry->size = ip->i_d.di_size; \ | ||
| 914 | __entry->new_size = new_size; \ | ||
| 915 | ), \ | ||
| 916 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx", \ | ||
| 917 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 918 | __entry->ino, \ | ||
| 919 | __entry->size, \ | ||
| 920 | __entry->new_size) \ | ||
| 921 | ) | ||
| 922 | DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start); | 964 | DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start); |
| 923 | DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end); | 965 | DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end); |
| 924 | 966 | ||
| @@ -1037,28 +1079,28 @@ TRACE_EVENT(xfs_alloc_unbusy, | |||
| 1037 | 1079 | ||
| 1038 | TRACE_EVENT(xfs_alloc_busysearch, | 1080 | TRACE_EVENT(xfs_alloc_busysearch, |
| 1039 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, | 1081 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, |
| 1040 | xfs_extlen_t len, int found), | 1082 | xfs_extlen_t len, xfs_lsn_t lsn), |
| 1041 | TP_ARGS(mp, agno, agbno, len, found), | 1083 | TP_ARGS(mp, agno, agbno, len, lsn), |
| 1042 | TP_STRUCT__entry( | 1084 | TP_STRUCT__entry( |
| 1043 | __field(dev_t, dev) | 1085 | __field(dev_t, dev) |
| 1044 | __field(xfs_agnumber_t, agno) | 1086 | __field(xfs_agnumber_t, agno) |
| 1045 | __field(xfs_agblock_t, agbno) | 1087 | __field(xfs_agblock_t, agbno) |
| 1046 | __field(xfs_extlen_t, len) | 1088 | __field(xfs_extlen_t, len) |
| 1047 | __field(int, found) | 1089 | __field(xfs_lsn_t, lsn) |
| 1048 | ), | 1090 | ), |
| 1049 | TP_fast_assign( | 1091 | TP_fast_assign( |
| 1050 | __entry->dev = mp->m_super->s_dev; | 1092 | __entry->dev = mp->m_super->s_dev; |
| 1051 | __entry->agno = agno; | 1093 | __entry->agno = agno; |
| 1052 | __entry->agbno = agbno; | 1094 | __entry->agbno = agbno; |
| 1053 | __entry->len = len; | 1095 | __entry->len = len; |
| 1054 | __entry->found = found; | 1096 | __entry->lsn = lsn; |
| 1055 | ), | 1097 | ), |
| 1056 | TP_printk("dev %d:%d agno %u agbno %u len %u %s", | 1098 | TP_printk("dev %d:%d agno %u agbno %u len %u force lsn 0x%llx", |
| 1057 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1099 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 1058 | __entry->agno, | 1100 | __entry->agno, |
| 1059 | __entry->agbno, | 1101 | __entry->agbno, |
| 1060 | __entry->len, | 1102 | __entry->len, |
| 1061 | __print_symbolic(__entry->found, XFS_BUSY_STATES)) | 1103 | __entry->lsn) |
| 1062 | ); | 1104 | ); |
| 1063 | 1105 | ||
| 1064 | TRACE_EVENT(xfs_agf, | 1106 | TRACE_EVENT(xfs_agf, |
| @@ -1152,77 +1194,80 @@ TRACE_EVENT(xfs_free_extent, | |||
| 1152 | 1194 | ||
| 1153 | ); | 1195 | ); |
| 1154 | 1196 | ||
| 1155 | #define DEFINE_ALLOC_EVENT(name) \ | 1197 | DECLARE_EVENT_CLASS(xfs_alloc_class, |
| 1156 | TRACE_EVENT(name, \ | 1198 | TP_PROTO(struct xfs_alloc_arg *args), |
| 1157 | TP_PROTO(struct xfs_alloc_arg *args), \ | 1199 | TP_ARGS(args), |
| 1158 | TP_ARGS(args), \ | 1200 | TP_STRUCT__entry( |
| 1159 | TP_STRUCT__entry( \ | 1201 | __field(dev_t, dev) |
| 1160 | __field(dev_t, dev) \ | 1202 | __field(xfs_agnumber_t, agno) |
| 1161 | __field(xfs_agnumber_t, agno) \ | 1203 | __field(xfs_agblock_t, agbno) |
| 1162 | __field(xfs_agblock_t, agbno) \ | 1204 | __field(xfs_extlen_t, minlen) |
| 1163 | __field(xfs_extlen_t, minlen) \ | 1205 | __field(xfs_extlen_t, maxlen) |
| 1164 | __field(xfs_extlen_t, maxlen) \ | 1206 | __field(xfs_extlen_t, mod) |
| 1165 | __field(xfs_extlen_t, mod) \ | 1207 | __field(xfs_extlen_t, prod) |
| 1166 | __field(xfs_extlen_t, prod) \ | 1208 | __field(xfs_extlen_t, minleft) |
| 1167 | __field(xfs_extlen_t, minleft) \ | 1209 | __field(xfs_extlen_t, total) |
| 1168 | __field(xfs_extlen_t, total) \ | 1210 | __field(xfs_extlen_t, alignment) |
| 1169 | __field(xfs_extlen_t, alignment) \ | 1211 | __field(xfs_extlen_t, minalignslop) |
| 1170 | __field(xfs_extlen_t, minalignslop) \ | 1212 | __field(xfs_extlen_t, len) |
| 1171 | __field(xfs_extlen_t, len) \ | 1213 | __field(short, type) |
| 1172 | __field(short, type) \ | 1214 | __field(short, otype) |
| 1173 | __field(short, otype) \ | 1215 | __field(char, wasdel) |
| 1174 | __field(char, wasdel) \ | 1216 | __field(char, wasfromfl) |
| 1175 | __field(char, wasfromfl) \ | 1217 | __field(char, isfl) |
| 1176 | __field(char, isfl) \ | 1218 | __field(char, userdata) |
| 1177 | __field(char, userdata) \ | 1219 | __field(xfs_fsblock_t, firstblock) |
| 1178 | __field(xfs_fsblock_t, firstblock) \ | 1220 | ), |
| 1179 | ), \ | 1221 | TP_fast_assign( |
| 1180 | TP_fast_assign( \ | 1222 | __entry->dev = args->mp->m_super->s_dev; |
| 1181 | __entry->dev = args->mp->m_super->s_dev; \ | 1223 | __entry->agno = args->agno; |
| 1182 | __entry->agno = args->agno; \ | 1224 | __entry->agbno = args->agbno; |
| 1183 | __entry->agbno = args->agbno; \ | 1225 | __entry->minlen = args->minlen; |
| 1184 | __entry->minlen = args->minlen; \ | 1226 | __entry->maxlen = args->maxlen; |
| 1185 | __entry->maxlen = args->maxlen; \ | 1227 | __entry->mod = args->mod; |
| 1186 | __entry->mod = args->mod; \ | 1228 | __entry->prod = args->prod; |
| 1187 | __entry->prod = args->prod; \ | 1229 | __entry->minleft = args->minleft; |
| 1188 | __entry->minleft = args->minleft; \ | 1230 | __entry->total = args->total; |
| 1189 | __entry->total = args->total; \ | 1231 | __entry->alignment = args->alignment; |
| 1190 | __entry->alignment = args->alignment; \ | 1232 | __entry->minalignslop = args->minalignslop; |
| 1191 | __entry->minalignslop = args->minalignslop; \ | 1233 | __entry->len = args->len; |
| 1192 | __entry->len = args->len; \ | 1234 | __entry->type = args->type; |
| 1193 | __entry->type = args->type; \ | 1235 | __entry->otype = args->otype; |
| 1194 | __entry->otype = args->otype; \ | 1236 | __entry->wasdel = args->wasdel; |
| 1195 | __entry->wasdel = args->wasdel; \ | 1237 | __entry->wasfromfl = args->wasfromfl; |
| 1196 | __entry->wasfromfl = args->wasfromfl; \ | 1238 | __entry->isfl = args->isfl; |
| 1197 | __entry->isfl = args->isfl; \ | 1239 | __entry->userdata = args->userdata; |
| 1198 | __entry->userdata = args->userdata; \ | 1240 | __entry->firstblock = args->firstblock; |
| 1199 | __entry->firstblock = args->firstblock; \ | 1241 | ), |
| 1200 | ), \ | 1242 | TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u " |
| 1201 | TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u " \ | 1243 | "prod %u minleft %u total %u alignment %u minalignslop %u " |
| 1202 | "prod %u minleft %u total %u alignment %u minalignslop %u " \ | 1244 | "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d " |
| 1203 | "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d " \ | 1245 | "userdata %d firstblock 0x%llx", |
| 1204 | "userdata %d firstblock 0x%llx", \ | 1246 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 1205 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 1247 | __entry->agno, |
| 1206 | __entry->agno, \ | 1248 | __entry->agbno, |
| 1207 | __entry->agbno, \ | 1249 | __entry->minlen, |
| 1208 | __entry->minlen, \ | 1250 | __entry->maxlen, |
| 1209 | __entry->maxlen, \ | 1251 | __entry->mod, |
| 1210 | __entry->mod, \ | 1252 | __entry->prod, |
| 1211 | __entry->prod, \ | 1253 | __entry->minleft, |
| 1212 | __entry->minleft, \ | 1254 | __entry->total, |
| 1213 | __entry->total, \ | 1255 | __entry->alignment, |
| 1214 | __entry->alignment, \ | 1256 | __entry->minalignslop, |
| 1215 | __entry->minalignslop, \ | 1257 | __entry->len, |
| 1216 | __entry->len, \ | 1258 | __print_symbolic(__entry->type, XFS_ALLOC_TYPES), |
| 1217 | __print_symbolic(__entry->type, XFS_ALLOC_TYPES), \ | 1259 | __print_symbolic(__entry->otype, XFS_ALLOC_TYPES), |
| 1218 | __print_symbolic(__entry->otype, XFS_ALLOC_TYPES), \ | 1260 | __entry->wasdel, |
| 1219 | __entry->wasdel, \ | 1261 | __entry->wasfromfl, |
| 1220 | __entry->wasfromfl, \ | 1262 | __entry->isfl, |
| 1221 | __entry->isfl, \ | 1263 | __entry->userdata, |
| 1222 | __entry->userdata, \ | 1264 | __entry->firstblock) |
| 1223 | __entry->firstblock) \ | ||
| 1224 | ) | 1265 | ) |
| 1225 | 1266 | ||
| 1267 | #define DEFINE_ALLOC_EVENT(name) \ | ||
| 1268 | DEFINE_EVENT(xfs_alloc_class, name, \ | ||
| 1269 | TP_PROTO(struct xfs_alloc_arg *args), \ | ||
| 1270 | TP_ARGS(args)) | ||
| 1226 | DEFINE_ALLOC_EVENT(xfs_alloc_exact_done); | 1271 | DEFINE_ALLOC_EVENT(xfs_alloc_exact_done); |
| 1227 | DEFINE_ALLOC_EVENT(xfs_alloc_exact_error); | 1272 | DEFINE_ALLOC_EVENT(xfs_alloc_exact_error); |
| 1228 | DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft); | 1273 | DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft); |
| @@ -1245,92 +1290,100 @@ DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp); | |||
| 1245 | DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed); | 1290 | DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed); |
| 1246 | DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed); | 1291 | DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed); |
| 1247 | 1292 | ||
| 1248 | #define DEFINE_DIR2_TRACE(tname) \ | 1293 | DECLARE_EVENT_CLASS(xfs_dir2_class, |
| 1249 | TRACE_EVENT(tname, \ | 1294 | TP_PROTO(struct xfs_da_args *args), |
| 1295 | TP_ARGS(args), | ||
| 1296 | TP_STRUCT__entry( | ||
| 1297 | __field(dev_t, dev) | ||
| 1298 | __field(xfs_ino_t, ino) | ||
| 1299 | __dynamic_array(char, name, args->namelen) | ||
| 1300 | __field(int, namelen) | ||
| 1301 | __field(xfs_dahash_t, hashval) | ||
| 1302 | __field(xfs_ino_t, inumber) | ||
| 1303 | __field(int, op_flags) | ||
| 1304 | ), | ||
| 1305 | TP_fast_assign( | ||
| 1306 | __entry->dev = VFS_I(args->dp)->i_sb->s_dev; | ||
| 1307 | __entry->ino = args->dp->i_ino; | ||
| 1308 | if (args->namelen) | ||
| 1309 | memcpy(__get_str(name), args->name, args->namelen); | ||
| 1310 | __entry->namelen = args->namelen; | ||
| 1311 | __entry->hashval = args->hashval; | ||
| 1312 | __entry->inumber = args->inumber; | ||
| 1313 | __entry->op_flags = args->op_flags; | ||
| 1314 | ), | ||
| 1315 | TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x " | ||
| 1316 | "inumber 0x%llx op_flags %s", | ||
| 1317 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 1318 | __entry->ino, | ||
| 1319 | __entry->namelen, | ||
| 1320 | __entry->namelen ? __get_str(name) : NULL, | ||
| 1321 | __entry->namelen, | ||
| 1322 | __entry->hashval, | ||
| 1323 | __entry->inumber, | ||
| 1324 | __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) | ||
| 1325 | ) | ||
| 1326 | |||
| 1327 | #define DEFINE_DIR2_EVENT(name) \ | ||
| 1328 | DEFINE_EVENT(xfs_dir2_class, name, \ | ||
| 1250 | TP_PROTO(struct xfs_da_args *args), \ | 1329 | TP_PROTO(struct xfs_da_args *args), \ |
| 1251 | TP_ARGS(args), \ | 1330 | TP_ARGS(args)) |
| 1252 | TP_STRUCT__entry( \ | 1331 | DEFINE_DIR2_EVENT(xfs_dir2_sf_addname); |
| 1253 | __field(dev_t, dev) \ | 1332 | DEFINE_DIR2_EVENT(xfs_dir2_sf_create); |
| 1254 | __field(xfs_ino_t, ino) \ | 1333 | DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup); |
| 1255 | __dynamic_array(char, name, args->namelen) \ | 1334 | DEFINE_DIR2_EVENT(xfs_dir2_sf_replace); |
| 1256 | __field(int, namelen) \ | 1335 | DEFINE_DIR2_EVENT(xfs_dir2_sf_removename); |
| 1257 | __field(xfs_dahash_t, hashval) \ | 1336 | DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4); |
| 1258 | __field(xfs_ino_t, inumber) \ | 1337 | DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8); |
| 1259 | __field(int, op_flags) \ | 1338 | DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block); |
| 1260 | ), \ | 1339 | DEFINE_DIR2_EVENT(xfs_dir2_block_addname); |
| 1261 | TP_fast_assign( \ | 1340 | DEFINE_DIR2_EVENT(xfs_dir2_block_lookup); |
| 1262 | __entry->dev = VFS_I(args->dp)->i_sb->s_dev; \ | 1341 | DEFINE_DIR2_EVENT(xfs_dir2_block_replace); |
| 1263 | __entry->ino = args->dp->i_ino; \ | 1342 | DEFINE_DIR2_EVENT(xfs_dir2_block_removename); |
| 1264 | if (args->namelen) \ | 1343 | DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf); |
| 1265 | memcpy(__get_str(name), args->name, args->namelen); \ | 1344 | DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf); |
| 1266 | __entry->namelen = args->namelen; \ | 1345 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname); |
| 1267 | __entry->hashval = args->hashval; \ | 1346 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup); |
| 1268 | __entry->inumber = args->inumber; \ | 1347 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace); |
| 1269 | __entry->op_flags = args->op_flags; \ | 1348 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename); |
| 1270 | ), \ | 1349 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block); |
| 1271 | TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x " \ | 1350 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node); |
| 1272 | "inumber 0x%llx op_flags %s", \ | 1351 | DEFINE_DIR2_EVENT(xfs_dir2_node_addname); |
| 1273 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 1352 | DEFINE_DIR2_EVENT(xfs_dir2_node_lookup); |
| 1274 | __entry->ino, \ | 1353 | DEFINE_DIR2_EVENT(xfs_dir2_node_replace); |
| 1275 | __entry->namelen, \ | 1354 | DEFINE_DIR2_EVENT(xfs_dir2_node_removename); |
| 1276 | __entry->namelen ? __get_str(name) : NULL, \ | 1355 | DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf); |
| 1277 | __entry->namelen, \ | 1356 | |
| 1278 | __entry->hashval, \ | 1357 | DECLARE_EVENT_CLASS(xfs_dir2_space_class, |
| 1279 | __entry->inumber, \ | 1358 | TP_PROTO(struct xfs_da_args *args, int idx), |
| 1280 | __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) \ | 1359 | TP_ARGS(args, idx), |
| 1360 | TP_STRUCT__entry( | ||
| 1361 | __field(dev_t, dev) | ||
| 1362 | __field(xfs_ino_t, ino) | ||
| 1363 | __field(int, op_flags) | ||
| 1364 | __field(int, idx) | ||
| 1365 | ), | ||
| 1366 | TP_fast_assign( | ||
| 1367 | __entry->dev = VFS_I(args->dp)->i_sb->s_dev; | ||
| 1368 | __entry->ino = args->dp->i_ino; | ||
| 1369 | __entry->op_flags = args->op_flags; | ||
| 1370 | __entry->idx = idx; | ||
| 1371 | ), | ||
| 1372 | TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d", | ||
| 1373 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
| 1374 | __entry->ino, | ||
| 1375 | __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS), | ||
| 1376 | __entry->idx) | ||
| 1281 | ) | 1377 | ) |
| 1282 | DEFINE_DIR2_TRACE(xfs_dir2_sf_addname); | ||
| 1283 | DEFINE_DIR2_TRACE(xfs_dir2_sf_create); | ||
| 1284 | DEFINE_DIR2_TRACE(xfs_dir2_sf_lookup); | ||
| 1285 | DEFINE_DIR2_TRACE(xfs_dir2_sf_replace); | ||
| 1286 | DEFINE_DIR2_TRACE(xfs_dir2_sf_removename); | ||
| 1287 | DEFINE_DIR2_TRACE(xfs_dir2_sf_toino4); | ||
| 1288 | DEFINE_DIR2_TRACE(xfs_dir2_sf_toino8); | ||
| 1289 | DEFINE_DIR2_TRACE(xfs_dir2_sf_to_block); | ||
| 1290 | DEFINE_DIR2_TRACE(xfs_dir2_block_addname); | ||
| 1291 | DEFINE_DIR2_TRACE(xfs_dir2_block_lookup); | ||
| 1292 | DEFINE_DIR2_TRACE(xfs_dir2_block_replace); | ||
| 1293 | DEFINE_DIR2_TRACE(xfs_dir2_block_removename); | ||
| 1294 | DEFINE_DIR2_TRACE(xfs_dir2_block_to_sf); | ||
| 1295 | DEFINE_DIR2_TRACE(xfs_dir2_block_to_leaf); | ||
| 1296 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_addname); | ||
| 1297 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_lookup); | ||
| 1298 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_replace); | ||
| 1299 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_removename); | ||
| 1300 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_to_block); | ||
| 1301 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_to_node); | ||
| 1302 | DEFINE_DIR2_TRACE(xfs_dir2_node_addname); | ||
| 1303 | DEFINE_DIR2_TRACE(xfs_dir2_node_lookup); | ||
| 1304 | DEFINE_DIR2_TRACE(xfs_dir2_node_replace); | ||
| 1305 | DEFINE_DIR2_TRACE(xfs_dir2_node_removename); | ||
| 1306 | DEFINE_DIR2_TRACE(xfs_dir2_node_to_leaf); | ||
| 1307 | 1378 | ||
| 1308 | #define DEFINE_DIR2_SPACE_TRACE(tname) \ | 1379 | #define DEFINE_DIR2_SPACE_EVENT(name) \ |
| 1309 | TRACE_EVENT(tname, \ | 1380 | DEFINE_EVENT(xfs_dir2_space_class, name, \ |
| 1310 | TP_PROTO(struct xfs_da_args *args, int idx), \ | 1381 | TP_PROTO(struct xfs_da_args *args, int idx), \ |
| 1311 | TP_ARGS(args, idx), \ | 1382 | TP_ARGS(args, idx)) |
| 1312 | TP_STRUCT__entry( \ | 1383 | DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add); |
| 1313 | __field(dev_t, dev) \ | 1384 | DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove); |
| 1314 | __field(xfs_ino_t, ino) \ | 1385 | DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode); |
| 1315 | __field(int, op_flags) \ | 1386 | DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode); |
| 1316 | __field(int, idx) \ | ||
| 1317 | ), \ | ||
| 1318 | TP_fast_assign( \ | ||
| 1319 | __entry->dev = VFS_I(args->dp)->i_sb->s_dev; \ | ||
| 1320 | __entry->ino = args->dp->i_ino; \ | ||
| 1321 | __entry->op_flags = args->op_flags; \ | ||
| 1322 | __entry->idx = idx; \ | ||
| 1323 | ), \ | ||
| 1324 | TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d", \ | ||
| 1325 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
| 1326 | __entry->ino, \ | ||
| 1327 | __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS), \ | ||
| 1328 | __entry->idx) \ | ||
| 1329 | ) | ||
| 1330 | DEFINE_DIR2_SPACE_TRACE(xfs_dir2_leafn_add); | ||
| 1331 | DEFINE_DIR2_SPACE_TRACE(xfs_dir2_leafn_remove); | ||
| 1332 | DEFINE_DIR2_SPACE_TRACE(xfs_dir2_grow_inode); | ||
| 1333 | DEFINE_DIR2_SPACE_TRACE(xfs_dir2_shrink_inode); | ||
| 1334 | 1387 | ||
| 1335 | TRACE_EVENT(xfs_dir2_leafn_moveents, | 1388 | TRACE_EVENT(xfs_dir2_leafn_moveents, |
| 1336 | TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count), | 1389 | TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count), |
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index a1c65fc6d9c4..275b1f4f9430 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
| @@ -2563,43 +2563,41 @@ xfs_alloc_search_busy(xfs_trans_t *tp, | |||
| 2563 | xfs_mount_t *mp; | 2563 | xfs_mount_t *mp; |
| 2564 | xfs_perag_busy_t *bsy; | 2564 | xfs_perag_busy_t *bsy; |
| 2565 | xfs_agblock_t uend, bend; | 2565 | xfs_agblock_t uend, bend; |
| 2566 | xfs_lsn_t lsn; | 2566 | xfs_lsn_t lsn = 0; |
| 2567 | int cnt; | 2567 | int cnt; |
| 2568 | 2568 | ||
| 2569 | mp = tp->t_mountp; | 2569 | mp = tp->t_mountp; |
| 2570 | 2570 | ||
| 2571 | spin_lock(&mp->m_perag[agno].pagb_lock); | 2571 | spin_lock(&mp->m_perag[agno].pagb_lock); |
| 2572 | cnt = mp->m_perag[agno].pagb_count; | ||
| 2573 | 2572 | ||
| 2574 | uend = bno + len - 1; | 2573 | uend = bno + len - 1; |
| 2575 | 2574 | ||
| 2576 | /* search pagb_list for this slot, skipping open slots */ | 2575 | /* |
| 2577 | for (bsy = mp->m_perag[agno].pagb_list; cnt; bsy++) { | 2576 | * search pagb_list for this slot, skipping open slots. We have to |
| 2577 | * search the entire array as there may be multiple overlaps and | ||
| 2578 | * we have to get the most recent LSN for the log force to push out | ||
| 2579 | * all the transactions that span the range. | ||
| 2580 | */ | ||
| 2581 | for (cnt = 0; cnt < mp->m_perag[agno].pagb_count; cnt++) { | ||
| 2582 | bsy = &mp->m_perag[agno].pagb_list[cnt]; | ||
| 2583 | if (!bsy->busy_tp) | ||
| 2584 | continue; | ||
| 2578 | 2585 | ||
| 2579 | /* | 2586 | bend = bsy->busy_start + bsy->busy_length - 1; |
| 2580 | * (start1,length1) within (start2, length2) | 2587 | if (bno > bend || uend < bsy->busy_start) |
| 2581 | */ | 2588 | continue; |
| 2582 | if (bsy->busy_tp != NULL) { | ||
| 2583 | bend = bsy->busy_start + bsy->busy_length - 1; | ||
| 2584 | if ((bno > bend) || (uend < bsy->busy_start)) { | ||
| 2585 | cnt--; | ||
| 2586 | } else { | ||
| 2587 | break; | ||
| 2588 | } | ||
| 2589 | } | ||
| 2590 | } | ||
| 2591 | 2589 | ||
| 2592 | trace_xfs_alloc_busysearch(mp, agno, bno, len, !!cnt); | 2590 | /* (start1,length1) within (start2, length2) */ |
| 2591 | if (XFS_LSN_CMP(bsy->busy_tp->t_commit_lsn, lsn) > 0) | ||
| 2592 | lsn = bsy->busy_tp->t_commit_lsn; | ||
| 2593 | } | ||
| 2594 | spin_unlock(&mp->m_perag[agno].pagb_lock); | ||
| 2595 | trace_xfs_alloc_busysearch(tp->t_mountp, agno, bno, len, lsn); | ||
| 2593 | 2596 | ||
| 2594 | /* | 2597 | /* |
| 2595 | * If a block was found, force the log through the LSN of the | 2598 | * If a block was found, force the log through the LSN of the |
| 2596 | * transaction that freed the block | 2599 | * transaction that freed the block |
| 2597 | */ | 2600 | */ |
| 2598 | if (cnt) { | 2601 | if (lsn) |
| 2599 | lsn = bsy->busy_tp->t_commit_lsn; | ||
| 2600 | spin_unlock(&mp->m_perag[agno].pagb_lock); | ||
| 2601 | xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); | 2602 | xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); |
| 2602 | } else { | ||
| 2603 | spin_unlock(&mp->m_perag[agno].pagb_lock); | ||
| 2604 | } | ||
| 2605 | } | 2603 | } |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ce278b3ae7fc..391d36b0e68c 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -2841,10 +2841,14 @@ xfs_iflush( | |||
| 2841 | mp = ip->i_mount; | 2841 | mp = ip->i_mount; |
| 2842 | 2842 | ||
| 2843 | /* | 2843 | /* |
| 2844 | * If the inode isn't dirty, then just release the inode | 2844 | * If the inode isn't dirty, then just release the inode flush lock and |
| 2845 | * flush lock and do nothing. | 2845 | * do nothing. Treat stale inodes the same; we cannot rely on the |
| 2846 | * backing buffer remaining stale in cache for the remaining life of | ||
| 2847 | * the stale inode and so xfs_itobp() below may give us a buffer that | ||
| 2848 | * no longer contains inodes below. Doing this stale check here also | ||
| 2849 | * avoids forcing the log on pinned, stale inodes. | ||
| 2846 | */ | 2850 | */ |
| 2847 | if (xfs_inode_clean(ip)) { | 2851 | if (xfs_inode_clean(ip) || xfs_iflags_test(ip, XFS_ISTALE)) { |
| 2848 | xfs_ifunlock(ip); | 2852 | xfs_ifunlock(ip); |
| 2849 | return 0; | 2853 | return 0; |
| 2850 | } | 2854 | } |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 6558ffd8d140..6f268756bf36 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
| @@ -70,7 +70,6 @@ xfs_setattr( | |||
| 70 | uint commit_flags=0; | 70 | uint commit_flags=0; |
| 71 | uid_t uid=0, iuid=0; | 71 | uid_t uid=0, iuid=0; |
| 72 | gid_t gid=0, igid=0; | 72 | gid_t gid=0, igid=0; |
| 73 | int timeflags = 0; | ||
| 74 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; | 73 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; |
| 75 | int need_iolock = 1; | 74 | int need_iolock = 1; |
| 76 | 75 | ||
| @@ -135,16 +134,13 @@ xfs_setattr( | |||
| 135 | if (flags & XFS_ATTR_NOLOCK) | 134 | if (flags & XFS_ATTR_NOLOCK) |
| 136 | need_iolock = 0; | 135 | need_iolock = 0; |
| 137 | if (!(mask & ATTR_SIZE)) { | 136 | if (!(mask & ATTR_SIZE)) { |
| 138 | if ((mask != (ATTR_CTIME|ATTR_ATIME|ATTR_MTIME)) || | 137 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); |
| 139 | (mp->m_flags & XFS_MOUNT_WSYNC)) { | 138 | commit_flags = 0; |
| 140 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); | 139 | code = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), |
| 141 | commit_flags = 0; | 140 | 0, 0, 0); |
| 142 | if ((code = xfs_trans_reserve(tp, 0, | 141 | if (code) { |
| 143 | XFS_ICHANGE_LOG_RES(mp), 0, | 142 | lock_flags = 0; |
| 144 | 0, 0))) { | 143 | goto error_return; |
| 145 | lock_flags = 0; | ||
| 146 | goto error_return; | ||
| 147 | } | ||
| 148 | } | 144 | } |
| 149 | } else { | 145 | } else { |
| 150 | if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) && | 146 | if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) && |
| @@ -295,15 +291,23 @@ xfs_setattr( | |||
| 295 | * or we are explicitly asked to change it. This handles | 291 | * or we are explicitly asked to change it. This handles |
| 296 | * the semantic difference between truncate() and ftruncate() | 292 | * the semantic difference between truncate() and ftruncate() |
| 297 | * as implemented in the VFS. | 293 | * as implemented in the VFS. |
| 294 | * | ||
| 295 | * The regular truncate() case without ATTR_CTIME and ATTR_MTIME | ||
| 296 | * is a special case where we need to update the times despite | ||
| 297 | * not having these flags set. For all other operations the | ||
| 298 | * VFS set these flags explicitly if it wants a timestamp | ||
| 299 | * update. | ||
| 298 | */ | 300 | */ |
| 299 | if (iattr->ia_size != ip->i_size || (mask & ATTR_CTIME)) | 301 | if (iattr->ia_size != ip->i_size && |
| 300 | timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; | 302 | (!(mask & (ATTR_CTIME | ATTR_MTIME)))) { |
| 303 | iattr->ia_ctime = iattr->ia_mtime = | ||
| 304 | current_fs_time(inode->i_sb); | ||
| 305 | mask |= ATTR_CTIME | ATTR_MTIME; | ||
| 306 | } | ||
| 301 | 307 | ||
| 302 | if (iattr->ia_size > ip->i_size) { | 308 | if (iattr->ia_size > ip->i_size) { |
| 303 | ip->i_d.di_size = iattr->ia_size; | 309 | ip->i_d.di_size = iattr->ia_size; |
| 304 | ip->i_size = iattr->ia_size; | 310 | ip->i_size = iattr->ia_size; |
| 305 | if (!(flags & XFS_ATTR_DMI)) | ||
| 306 | xfs_ichgtime(ip, XFS_ICHGTIME_CHG); | ||
| 307 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 311 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
| 308 | } else if (iattr->ia_size <= ip->i_size || | 312 | } else if (iattr->ia_size <= ip->i_size || |
| 309 | (iattr->ia_size == 0 && ip->i_d.di_nextents)) { | 313 | (iattr->ia_size == 0 && ip->i_d.di_nextents)) { |
| @@ -374,9 +378,6 @@ xfs_setattr( | |||
| 374 | ip->i_d.di_gid = gid; | 378 | ip->i_d.di_gid = gid; |
| 375 | inode->i_gid = gid; | 379 | inode->i_gid = gid; |
| 376 | } | 380 | } |
| 377 | |||
| 378 | xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); | ||
| 379 | timeflags |= XFS_ICHGTIME_CHG; | ||
| 380 | } | 381 | } |
| 381 | 382 | ||
| 382 | /* | 383 | /* |
| @@ -393,51 +394,37 @@ xfs_setattr( | |||
| 393 | 394 | ||
| 394 | inode->i_mode &= S_IFMT; | 395 | inode->i_mode &= S_IFMT; |
| 395 | inode->i_mode |= mode & ~S_IFMT; | 396 | inode->i_mode |= mode & ~S_IFMT; |
| 396 | |||
| 397 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
| 398 | timeflags |= XFS_ICHGTIME_CHG; | ||
| 399 | } | 397 | } |
| 400 | 398 | ||
| 401 | /* | 399 | /* |
| 402 | * Change file access or modified times. | 400 | * Change file access or modified times. |
| 403 | */ | 401 | */ |
| 404 | if (mask & (ATTR_ATIME|ATTR_MTIME)) { | 402 | if (mask & ATTR_ATIME) { |
| 405 | if (mask & ATTR_ATIME) { | 403 | inode->i_atime = iattr->ia_atime; |
| 406 | inode->i_atime = iattr->ia_atime; | 404 | ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec; |
| 407 | ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec; | 405 | ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec; |
| 408 | ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec; | 406 | ip->i_update_core = 1; |
| 409 | ip->i_update_core = 1; | ||
| 410 | } | ||
| 411 | if (mask & ATTR_MTIME) { | ||
| 412 | inode->i_mtime = iattr->ia_mtime; | ||
| 413 | ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec; | ||
| 414 | ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec; | ||
| 415 | timeflags &= ~XFS_ICHGTIME_MOD; | ||
| 416 | timeflags |= XFS_ICHGTIME_CHG; | ||
| 417 | } | ||
| 418 | if (tp && (mask & (ATTR_MTIME_SET|ATTR_ATIME_SET))) | ||
| 419 | xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); | ||
| 420 | } | 407 | } |
| 421 | 408 | if (mask & ATTR_CTIME) { | |
| 422 | /* | ||
| 423 | * Change file inode change time only if ATTR_CTIME set | ||
| 424 | * AND we have been called by a DMI function. | ||
| 425 | */ | ||
| 426 | |||
| 427 | if ((flags & XFS_ATTR_DMI) && (mask & ATTR_CTIME)) { | ||
| 428 | inode->i_ctime = iattr->ia_ctime; | 409 | inode->i_ctime = iattr->ia_ctime; |
| 429 | ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec; | 410 | ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec; |
| 430 | ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec; | 411 | ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec; |
| 431 | ip->i_update_core = 1; | 412 | ip->i_update_core = 1; |
| 432 | timeflags &= ~XFS_ICHGTIME_CHG; | 413 | } |
| 414 | if (mask & ATTR_MTIME) { | ||
| 415 | inode->i_mtime = iattr->ia_mtime; | ||
| 416 | ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec; | ||
| 417 | ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec; | ||
| 418 | ip->i_update_core = 1; | ||
| 433 | } | 419 | } |
| 434 | 420 | ||
| 435 | /* | 421 | /* |
| 436 | * Send out timestamp changes that need to be set to the | 422 | * And finally, log the inode core if any attribute in it |
| 437 | * current time. Not done when called by a DMI function. | 423 | * has been changed. |
| 438 | */ | 424 | */ |
| 439 | if (timeflags && !(flags & XFS_ATTR_DMI)) | 425 | if (mask & (ATTR_UID|ATTR_GID|ATTR_MODE| |
| 440 | xfs_ichgtime(ip, timeflags); | 426 | ATTR_ATIME|ATTR_CTIME|ATTR_MTIME)) |
| 427 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
| 441 | 428 | ||
| 442 | XFS_STATS_INC(xs_ig_attrchg); | 429 | XFS_STATS_INC(xs_ig_attrchg); |
| 443 | 430 | ||
| @@ -452,12 +439,10 @@ xfs_setattr( | |||
| 452 | * mix so this probably isn't worth the trouble to optimize. | 439 | * mix so this probably isn't worth the trouble to optimize. |
| 453 | */ | 440 | */ |
| 454 | code = 0; | 441 | code = 0; |
| 455 | if (tp) { | 442 | if (mp->m_flags & XFS_MOUNT_WSYNC) |
| 456 | if (mp->m_flags & XFS_MOUNT_WSYNC) | 443 | xfs_trans_set_sync(tp); |
| 457 | xfs_trans_set_sync(tp); | ||
| 458 | 444 | ||
| 459 | code = xfs_trans_commit(tp, commit_flags); | 445 | code = xfs_trans_commit(tp, commit_flags); |
| 460 | } | ||
| 461 | 446 | ||
| 462 | xfs_iunlock(ip, lock_flags); | 447 | xfs_iunlock(ip, lock_flags); |
| 463 | 448 | ||
