Re: The value displayed by 'ls -s' command is strange.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 7, 2010 at 10:44 AM, Chris Mason <chris.mason@xxxxxxxxxx> wrote:
> Excerpts from Tsutomu Itoh's message of 2010-12-07 02:59:52 -0500:
>> Hi,
>>
>> I think that the disk allocation size of each file becomes a monotone increase
>> when the file is made.
>> But, it sometimes return to 0. ÂIs it correct?
>
> Well, there's a window during the processing of delayed allocation where
> we don't have the bytes recorded as delalloc and we don't have the bytes
> recorded in the inode yet. ÂThat's why they are showing up as zero.
>
> We don't call inode_add_bytes() until after we insert the extent, but we
> drop the delalloc byte count on the file before the IO is done.
>
> Fixing it will be a little tricky because all the extent accounting
> assumes the inode_add_bytes happens at extent insertion time.
>

How does opening the inode with O_APPEND during this window know where
to write the bytes?  If it's a pointer/cursor to the EOF then that
size could be used during the window.  Is that right?

>>
>>
>> The result of the test at 2.6.37-rc4 is shown below.
>> (see inode no. 291)
>>
>> Â Â # df -T /test14
>>   Filesystem  ÂType  1K-blocks   ÂUsed Available Use% Mounted on
>>   /dev/sdd14  btrfs   4162560   Â8736  3709440  1% /test14
>> Â Â # dd if=/dev/zero of=/test14/dir/as001.26603 bs=1M count=100
>> Â Â # dd if=/dev/zero of=/test14/dir/as002.26603 bs=1M count=200
>> Â Â # dd if=/dev/zero of=/test14/dir/sy001.26603 bs=1M count=300 oflag=direct
>> Â Â # dd if=/dev/zero of=/test14/dir/as003.26603 bs=1M count=400
>> Â Â # ls -lis /test14/dir
>> Â Â total 406528
>> Â Â 288 Â Â Â0 -rw-r--r-- 1 root root 104857600 Dec Â7 15:07 as001.26603
>> Â Â 289 Â Â Â0 -rw-r--r-- 1 root root 209715200 Dec Â7 15:07 as002.26603
>> Â-> 291 Â99328 -rw-r--r-- 1 root root 419430400 Dec Â7 15:08 as003.26603
>> Â Â 290 307200 -rw-r--r-- 1 root root 314572800 Dec Â7 15:08 sy001.26603
>> Â Â # sleep 3
>> Â Â # ls -lis /test14/dir
>> Â Â total 406528
>> Â Â 288 Â Â Â0 -rw-r--r-- 1 root root 104857600 Dec Â7 15:07 as001.26603
>> Â Â 289 Â Â Â0 -rw-r--r-- 1 root root 209715200 Dec Â7 15:07 as002.26603
>> Â-> 291 Â99328 -rw-r--r-- 1 root root 419430400 Dec Â7 15:08 as003.26603
>> Â Â 290 307200 -rw-r--r-- 1 root root 314572800 Dec Â7 15:08 sy001.26603
>> Â Â # sleep 3
>> Â Â # ls -lis /test14/dir
>> Â Â total 307200
>> Â Â 288 Â Â Â0 -rw-r--r-- 1 root root 104857600 Dec Â7 15:07 as001.26603
>> Â Â 289 Â Â Â0 -rw-r--r-- 1 root root 209715200 Dec Â7 15:07 as002.26603
>> Â-> 291 Â Â Â0 -rw-r--r-- 1 root root 419430400 Dec Â7 15:08 as003.26603
>> Â Â 290 307200 -rw-r--r-- 1 root root 314572800 Dec Â7 15:08 sy001.26603
>> Â Â # sleep 3
>> Â Â # ls -lis /test14/dir
>> Â Â total 409600
>> Â Â 288 102400 -rw-r--r-- 1 root root 104857600 Dec Â7 15:07 as001.26603
>> Â Â 289 Â Â Â0 -rw-r--r-- 1 root root 209715200 Dec Â7 15:07 as002.26603
>> Â-> 291 Â Â Â0 -rw-r--r-- 1 root root 419430400 Dec Â7 15:08 as003.26603
>> Â Â 290 307200 -rw-r--r-- 1 root root 314572800 Dec Â7 15:08 sy001.26603
>> Â Â # sync
>> Â Â # ls -lis /test14/dir
>> Â Â total 1024000
>> Â Â 288 102400 -rw-r--r-- 1 root root 104857600 Dec Â7 15:07 as001.26603
>> Â Â 289 204800 -rw-r--r-- 1 root root 209715200 Dec Â7 15:07 as002.26603
>> Â-> 291 409600 -rw-r--r-- 1 root root 419430400 Dec Â7 15:08 as003.26603
>> Â Â 290 307200 -rw-r--r-- 1 root root 314572800 Dec Â7 15:08 sy001.26603
>>
>> The trace result of btrfs_getattr() is shown below.
>>
>> ÂDec Â7 15:08:03 luna kernel: ino:291 blocks:198656 i_blocks:0 i_bytes:0 delalloc_bytes:101711872
>> ÂDec Â7 15:08:06 luna kernel: ino:291 blocks:198656 i_blocks:0 i_bytes:0 delalloc_bytes:101711872
>> ÂDec Â7 15:08:09 luna kernel: ino:291 blocks:0 i_blocks:0 i_bytes:0 delalloc_bytes:0
>> ÂDec Â7 15:08:12 luna kernel: ino:291 blocks:0 i_blocks:0 i_bytes:0 delalloc_bytes:0
>> ÂDec Â7 15:08:18 luna kernel: ino:291 blocks:819200 i_blocks:819200 i_bytes:0 delalloc_bytes:0
>>
>>
>> Regards,
>> Itoh
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux