From patchwork Sat Nov 22 16:54:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 5359651 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2A2E8C11AC for ; Sat, 22 Nov 2014 16:54:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2081F200E0 for ; Sat, 22 Nov 2014 16:54:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BB9D20149 for ; Sat, 22 Nov 2014 16:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751988AbaKVQyj (ORCPT ); Sat, 22 Nov 2014 11:54:39 -0500 Received: from imap.thunk.org ([74.207.234.97]:45346 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750809AbaKVQyg (ORCPT ); Sat, 22 Nov 2014 11:54:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=eCbIGTttQhJzF2s0qMQbhiYbzYUJcahTbVClhtOTQro=; b=WxORGa9jJQlT8Cv9ZroZGvCkonJjEDQSN+5aDt9dZQKQ/zrEThL1gckhBsgJj3m0cets4KxY7UxDwy4CyDzKUvDB8A8/t9Da5vi4RB4yu2krS5axAPiNIptiRBudFp4sexvXxM649lcJR9TMWsmVblgXHezVhV0iZdvWYD9wc9U=; Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.80) (envelope-from ) id 1XsDxB-0004Db-MA; Sat, 22 Nov 2014 16:54:33 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id D63205803BD; Sat, 22 Nov 2014 11:54:31 -0500 (EST) From: Theodore Ts'o To: linux-fsdevel@vger.kernel.org Cc: Ext4 Developers List , xfs@oss.sgi.com, linux-btrfs@vger.kernel.org, Theodore Ts'o Subject: [PATCH-v2 4/5] vfs: add lazytime tracepoints for better debugging Date: Sat, 22 Nov 2014 11:54:26 -0500 Message-Id: <1416675267-2191-5-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1416675267-2191-1-git-send-email-tytso@mit.edu> References: <1416675267-2191-1-git-send-email-tytso@mit.edu> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Theodore Ts'o --- fs/fs-writeback.c | 5 ++++- fs/inode.c | 5 +++++ include/trace/events/fs.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 include/trace/events/fs.h diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index eb04277..cab2d6d 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "internal.h" /* @@ -1304,8 +1305,10 @@ static void flush_sb_dirty_time(struct super_block *sb) iput(old_inode); old_inode = inode; - if (dirty_time) + if (dirty_time) { + trace_fs_lazytime_flush(inode); mark_inode_dirty(inode); + } cond_resched(); spin_lock(&inode_sb_list_lock); } diff --git a/fs/inode.c b/fs/inode.c index 0d939a8..5a9a7b0 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -20,6 +20,9 @@ #include #include "internal.h" +#define CREATE_TRACE_POINTS +#include + /* * Inode locking rules: * @@ -544,6 +547,7 @@ static void evict(struct inode *inode) mark_inode_dirty(inode); inode->i_sb->s_op->write_inode(inode, &wbc); } + trace_fs_lazytime_evict(inode); } if (!list_empty(&inode->i_wb_list)) @@ -1546,6 +1550,7 @@ static int update_time(struct inode *inode, struct timespec *time, int flags) inode->i_state |= I_DIRTY_TIME; spin_unlock(&inode->i_lock); inode->i_ts_dirty_day = days_since_boot; + trace_fs_lazytime_defer(inode); return 0; } inode->i_ts_dirty_day = 0; diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h new file mode 100644 index 0000000..ca06d5c --- /dev/null +++ b/include/trace/events/fs.h @@ -0,0 +1,56 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fs + +#if !defined(_TRACE_FS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FS_H + +#include + +DECLARE_EVENT_CLASS(fs__inode, + TP_PROTO(struct inode *inode), + + TP_ARGS(inode), + + TP_STRUCT__entry( + __field( dev_t, dev ) + __field( ino_t, ino ) + __field( uid_t, uid ) + __field( gid_t, gid ) + __field( __u16, mode ) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->uid = i_uid_read(inode); + __entry->gid = i_gid_read(inode); + __entry->mode = inode->i_mode; + ), + + TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->mode, + __entry->uid, __entry->gid) +); + +DEFINE_EVENT(fs__inode, fs_lazytime_defer, + TP_PROTO(struct inode *inode), + + TP_ARGS(inode) +); + +DEFINE_EVENT(fs__inode, fs_lazytime_evict, + TP_PROTO(struct inode *inode), + + TP_ARGS(inode) +); + +DEFINE_EVENT(fs__inode, fs_lazytime_flush, + TP_PROTO(struct inode *inode), + + TP_ARGS(inode) +); +#endif /* _TRACE_FS_H */ + +/* This part must be outside protection */ +#include