xfs
[Top] [All Lists]

Blocks deallocation routine when file is deleted

To: linux-xfs@xxxxxxxxxxx
Subject: Blocks deallocation routine when file is deleted
From: Adil Mujeeb <mujeeb.adil@xxxxxxxxx>
Date: Fri, 11 May 2012 20:01:20 +0530
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Fb2d81gRTSzKSkUqosgMe/EG5Mz03ywPZbIV8YgFNiM=; b=Lljdqr/UE0hpyJ9QsW3HZahZAVi4E9btsfRaVd30gsoujNf5m4L1ICmE4WJ2ey+Z6l AZ8yYly3pL/hBNv6pz0yn6VVrkNIPxaRP14A22P8S1rAutoJFtG8TneYr3zMpyLTD4iY FtV5Qrp3ONIHY8mDODFAGr8iCWoQyj/d+VHoHdzgsmEMr0FIqWh6cu+4DGr1hGFH3/WH okWvrH9xdD/IwIB0oVSZfxUqwlZVmRBkfKbezEE43pf0XxLea/elHjGsCgLbJYr30HY0 0GbufVlGqEUKh+X0FWsr0NGdKCGa/7ThLrTMjypjWUniIUuRzqCBsg4LWarec9S00KhH fIyw==
Hi list,

I wanted to understand the routine of block deallocation when a file
is deleted from XFS.

Suppose initial state of the XFS partition is:

-----------------8<------------------------
localhost:/home/adil # df /mnt/test/
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_lv_test
                      67055628      5280  67050348   1% /mnt/test
-----------------8<------------------------

The Used value is 5280. What it (5280) signifies? Number of FSB?

Now a 1MB size file is being created named xyz. After file creation
checked the filesystem usage:

-----------------8<------------------------
localhost:/home/adil # df /mnt/test/
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_lv_test
                      67055628      6304  67049324   1% /mnt/test
localhost:/mnt/test # xfs_io xyz
xfs_io> stat
fd.path = "xyz"
fd.flags = non-sync,non-direct,read-write
stat.ino = 132
stat.type = regular file
stat.size = 1048576
stat.blocks = 2048
fsxattr.xflags = 0x0 [--------------]
fsxattr.projid = 0
fsxattr.extsize = 0
fsxattr.nextents = 1
fsxattr.naextents = 0
dioattr.mem = 0x200
dioattr.miniosz = 512
dioattr.maxiosz = 2147483136
-----------------8<------------------------

The used count has increased from 5280 to 6304 i.e. by 1024. What it
(1024) signifies?

Now deleted the file and checked the blocks and other information
whether the blocks allocated returned back or not:

-----------------8<------------------------
localhost:/mnt/test # rm xyz
localhost:/home/adil # df /mnt/test/
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_lv_test
                      67055628      5280  67050348   1% /mnt/test
-----------------8<------------------------

So here we see that the used count is decreased to original value (5280).

I would like to know where this deallocation is being done in the
code. I appreciate if anyone can help me in giving the code flow hint.

Thanks and Best Regards,
Adil

<Prev in Thread] Current Thread [Next in Thread>
  • Blocks deallocation routine when file is deleted, Adil Mujeeb <=