Fwd: reiser4: FITRIM ioctl -- how to grab the space?

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

 



(resend -- forgot the Cc:, sorry for spamming)

...and here is volume 2 of my neverending question series :)

A stub ioctl, placed as I described, seems to work and log a warning each time
I invoke `fstrim` on anything mounted.

Now on to space allocation. This seems pretty easy in the first approximation:
reiser4_alloc_blocks_bitmap() seems to do what's needed, finding the nearest
free extent, not the biggest one. So we could just call reiser4_alloc_blocks()
plus reiser4_dealloc_blocks(BA_DEFER) repeatedly, while allocations succeed.

However, I suppose we need to grab all free space before proceeding. There is
no primitive for grabbing all free space, so we need to read block counters,
calculate amount of space to grab and then call reiser4_grab_reserved()
(as we want to allocate everything, including the reserved space. This creates
two problems (as I see it):
- there is a race between reading block counters (under sb spinlock) and
  performing the grab (which takes the spinlock on its own);
- if anything will try to grab space during discarding, it will get an ENOSPC,
  while it's better to make the process wait until discarding is completed.

I'm not sure whether the last problem really exists (there is BA_CAN_COMMIT,
but I don't know whether is it used consistently where possible).

Could you explain these things?

Thanks,
-- 
Ivan Shapovalov / intelfx /

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux