reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* reiser4: FITRIM ioctl -- how to grab the space?
@ 2014-07-31 20:47 Ivan Shapovalov
  2014-07-31 22:03 ` Edward Shishkin
  0 siblings, 1 reply; 20+ messages in thread
From: Ivan Shapovalov @ 2014-07-31 20:47 UTC (permalink / raw)
  To: reiserfs-devel

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

...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 #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-08-16 20:13 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-31 20:47 reiser4: FITRIM ioctl -- how to grab the space? Ivan Shapovalov
2014-07-31 22:03 ` Edward Shishkin
2014-07-31 22:16   ` Ivan Shapovalov
     [not found]     ` <53DACEE9.8000802@gmail.com>
2014-08-10 18:52       ` Ivan Shapovalov
2014-08-10 19:48         ` Edward Shishkin
2014-08-10 20:37           ` Ivan Shapovalov
2014-08-10 23:29             ` Edward Shishkin
2014-08-11  9:39               ` Ivan Shapovalov
2014-08-16  0:44                 ` Ivan Shapovalov
2014-08-16  8:09                   ` Edward Shishkin
2014-08-16  8:23                     ` Edward Shishkin
2014-08-16 11:27                       ` Ivan Shapovalov
2014-08-16 13:35                         ` Edward Shishkin
2014-08-16 17:05                           ` Ivan Shapovalov
2014-08-16 20:13                             ` Edward Shishkin
2014-08-16 11:17                     ` Ivan Shapovalov
2014-08-16 12:15                       ` Edward Shishkin
2014-08-16 17:02                         ` Ivan Shapovalov
2014-08-16 19:54                           ` Edward Shishkin
2014-08-02 16:40   ` Edward Shishkin

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).