lkml.org 
[lkml]   [2009]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Report file size for deleted files; was Re: Counters in df, du
> 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.


\
 
 \ /
  Last update: 2009-07-13 14:01    [W:0.112 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site