From: Andi Kleen <andi@firstfloor.org>
To: Alexey Vlasov <renton@renton.name>
Cc: Andi Kleen <andi@firstfloor.org>,
linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk
Subject: [PATCH] Report file size for deleted files; was Re: Counters in df, du
Date: Mon, 13 Jul 2009 13:59:17 +0200 [thread overview]
Message-ID: <20090713115917.GA27684@basil.fritz.box> (raw)
In-Reply-To: <20090713113252.GB5569@beaver.vrungel.ru>
> But you can see the file date, these are new files and by next search
I appended a patch that reports the size.
-Andi
---
VFS: Report file size for deleted files in /proc
It's useful to know how big deleted files are, in case a file system
is filled up unexpectedly and the admin wants to track down which
process is the culprit. This patch reports the file size
in addition to (deleted) for /proc/*/fd links.
This modifies a public interface, but it's reasonable to assume
that noone relies on the particular format here.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
fs/dcache.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
Index: linux-2.6.31-rc1-ak/fs/dcache.c
===================================================================
--- linux-2.6.31-rc1-ak.orig/fs/dcache.c
+++ linux-2.6.31-rc1-ak/fs/dcache.c
@@ -1910,9 +1910,19 @@ char *__d_path(const struct path *path,
spin_lock(&vfsmount_lock);
prepend(&end, &buflen, "\0", 1);
- if (d_unlinked(dentry) &&
- (prepend(&end, &buflen, " (deleted)", 10) != 0))
+ if (d_unlinked(dentry)) {
+ char buf[40];
+ int n;
+ if (dentry->d_inode) { /* check needed? */
+ n = snprintf(buf, sizeof buf, " (deleted; size %lluK)",
+ dentry->d_inode->i_size >> 10);
+ } else {
+ strcpy(buf, " (deleted)");
+ n = 10;
+ }
+ if (prepend(&end, &buflen, buf, n) != 0)
goto Elong;
+ }
if (buflen < 1)
goto Elong;
--
ak@linux.intel.com -- Speaking for myself only.
next prev parent reply other threads:[~2009-07-13 11:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 8:11 Counters in df, du Alexey Vlasov
2009-07-13 9:09 ` Andi Kleen
2009-07-13 11:32 ` Alexey Vlasov
2009-07-13 11:59 ` Andi Kleen [this message]
2009-07-13 13:13 ` [PATCH] Report file size for deleted files; was " Andreas Schwab
2009-07-13 13:20 ` Andi Kleen
2009-09-03 12:32 ` Alexey Vlasov
2009-07-13 13:54 ` Bryan Donlan
2009-07-13 19:55 ` Alexey Vlasov
2009-07-13 19:58 ` Bryan Donlan
2009-07-13 20:11 ` Alexey Vlasov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090713115917.GA27684@basil.fritz.box \
--to=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=renton@renton.name \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox