Re: Question about xfs/440

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

 



On Fri, Dec 16, 2022 at 01:02:18PM +0000, yangx.jy@xxxxxxxxxxx wrote:
> Hi Darrick,
> 
> As you know, the following steps comes from xfs/440. I have two
> questions about these steps.
> The first one:
> Why repquota -u command shows "128" rather than "64" for fsgqa user
> after cp --reflink command is completed?

Quota resource usage are charged for each file, even for shared blocks.
There's no easy way to amortize the cost of a shared block among its
owners unless you can walk backwards from a piece of storage back to its
owners, which is too much work to make it worth the effort.

Hence reflinking a 64k file to another file creates 128k worth of usage.

> The second one:
> Why repquota -u command shows "1152" for fsgqa user after CoW(Copy on
> Write) is completed?

The space extents used to stage COW operations are separate space
allocations, which means they're charged to the quota and hang around
until writeback happens.  In xfs/440, we set a cow extent size hint of
1mb, so we've actually staged 1mb of cow so that appending writes to /b
will end up in contiguous space.  That's why usage goes from 128 to
1152.

--D

> 
> How does the kernel process reflink and CoW?
> How does the kernel calculate the number(e.g. 128,1152)?
> 
> # mount -o usrquota,grpquota /dev/pmem1 /mnt/scratch/
> # touch /mnt/scratch/a /mnt/scratch/force_fsgqa
> # chown fsgqa /mnt/scratch/a /mnt/scratch/force_fsgqa
> # xfs_io -c "pwrite -S 0x58 0 64k" /mnt/scratch/a
> # repquota -u /mnt/scratch/
> ...
>                         Block limits                File limits
> User            used    soft    hard  grace    used  soft  hard  grace
> ----------------------------------------------------------------------
> root      --       0       0       0              3     0     0
> fsgqa     --      64       0       0              2     0     0
> 
> # cp --reflink=always -p /mnt/scratch/a /mnt/scratch/b
> # repquota -u /mnt/scratch/
> ...
>                         Block limits                File limits
> User            used    soft    hard  grace    used  soft  hard  grace
> ----------------------------------------------------------------------
> root      --       0       0       0              3     0     0
> fsgqa     --     128       0       0              3     0     0
> 
> # xfs_io -c "pwrite -S 0x59 0 64k" /mnt/scratch/a
> # repquota -u /mnt/scratch/
> ...
>                         Block limits                File limits
> User            used    soft    hard  grace    used  soft  hard  grace
> ----------------------------------------------------------------------
> root      --       0       0       0              3     0     0
> fsgqa     --    1152       0       0              3     0     0
> 
> Best Regards,
> Xiao Yang



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux