* Use fsck to free the space used by dir?
@ 2012-08-03 14:19 Wang Sheng-Hui
2012-08-03 15:18 ` Eric Sandeen
0 siblings, 1 reply; 4+ messages in thread
From: Wang Sheng-Hui @ 2012-08-03 14:19 UTC (permalink / raw)
To: ext4 development
Dear all,
I read through the namei.c code recently, but didn't notice any code to
reduce the size of a dir file (append can increase its size though).
I wonder if I create large amount of files under dir A, then remove all
the sub items, do I need to run fsck to free the disk space used by the
dir file?
Please help confirm or if I missed some points.
Regards,
Sheng-Hui
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Use fsck to free the space used by dir?
2012-08-03 14:19 Use fsck to free the space used by dir? Wang Sheng-Hui
@ 2012-08-03 15:18 ` Eric Sandeen
2012-08-03 17:57 ` Theodore Ts'o
0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2012-08-03 15:18 UTC (permalink / raw)
To: Wang Sheng-Hui; +Cc: ext4 development
On 8/3/12 9:19 AM, Wang Sheng-Hui wrote:
> Dear all,
>
> I read through the namei.c code recently, but didn't notice any code to
> reduce the size of a dir file (append can increase its size though).
Right, AFAIK nothing in kernelspace will reduce the size.
> I wonder if I create large amount of files under dir A, then remove all
> the sub items, do I need to run fsck to free the disk space used by the
> dir file?
Yes, e2fsck -fD should compress them again.
-Eric
> Please help confirm or if I missed some points.
>
>
> Regards,
> Sheng-Hui
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Use fsck to free the space used by dir?
2012-08-03 15:18 ` Eric Sandeen
@ 2012-08-03 17:57 ` Theodore Ts'o
2012-08-04 4:25 ` Wang Sheng-Hui
0 siblings, 1 reply; 4+ messages in thread
From: Theodore Ts'o @ 2012-08-03 17:57 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Wang Sheng-Hui, ext4 development
On Fri, Aug 03, 2012 at 10:18:57AM -0500, Eric Sandeen wrote:
> On 8/3/12 9:19 AM, Wang Sheng-Hui wrote:
> > Dear all,
> >
> > I read through the namei.c code recently, but didn't notice any code to
> > reduce the size of a dir file (append can increase its size though).
>
> Right, AFAIK nothing in kernelspace will reduce the size.
In theory, if the dir_index (htree) support is enabled, it would be
possible for the kernel to reorganize the directory dynamically.
If dir_index is not enabled, reorganizing the directory would would
break any open readdir() sessions and any NFS server file handles.
(Which means if the file system has been exported by NFS in the past,
and expects to be exported by NFS in the future, reorg'ing a directory
will seriously confuse any clients which have cached NFS handles.)
For that reason, historically we've never bothered to try to implement
ways of decreasing the size of a directory --- especially since in
most cases, sysadmins can do something like:
mkdir foo.new ; mv foo/* foo.new ; mv foo.new foo
which while isn't perfect, works most of the time.
Regards,
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Use fsck to free the space used by dir?
2012-08-03 17:57 ` Theodore Ts'o
@ 2012-08-04 4:25 ` Wang Sheng-Hui
0 siblings, 0 replies; 4+ messages in thread
From: Wang Sheng-Hui @ 2012-08-04 4:25 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Eric Sandeen, ext4 development
On 2012年08月04日 01:57, Theodore Ts'o wrote:
> On Fri, Aug 03, 2012 at 10:18:57AM -0500, Eric Sandeen wrote:
>> On 8/3/12 9:19 AM, Wang Sheng-Hui wrote:
>>> Dear all,
>>>
>>> I read through the namei.c code recently, but didn't notice any code to
>>> reduce the size of a dir file (append can increase its size though).
>>
>> Right, AFAIK nothing in kernelspace will reduce the size.
>
> In theory, if the dir_index (htree) support is enabled, it would be
> possible for the kernel to reorganize the directory dynamically.
>
> If dir_index is not enabled, reorganizing the directory would would
> break any open readdir() sessions and any NFS server file handles.
> (Which means if the file system has been exported by NFS in the past,
> and expects to be exported by NFS in the future, reorg'ing a directory
> will seriously confuse any clients which have cached NFS handles.)
>
> For that reason, historically we've never bothered to try to implement
> ways of decreasing the size of a directory --- especially since in
> most cases, sysadmins can do something like:
>
> mkdir foo.new ; mv foo/* foo.new ; mv foo.new foo
>
> which while isn't perfect, works most of the time.
>
> Regards,
>
> - Ted
Thanks for your patient explanations, Eric & Ted!
Regards,
Wang Sheng-Hui
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-04 4:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-03 14:19 Use fsck to free the space used by dir? Wang Sheng-Hui
2012-08-03 15:18 ` Eric Sandeen
2012-08-03 17:57 ` Theodore Ts'o
2012-08-04 4:25 ` Wang Sheng-Hui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).