Messages in this thread | | | Subject | Re: [PATCH 5/9] writeback: introduce the pageout work | From | Artem Bityutskiy <> | Date | Mon, 12 Mar 2012 16:21:49 +0200 |
| |
On Mon, 2012-03-12 at 15:02 +0100, Jan Kara wrote: > > The second part of the overall deletion job will be when we commit - the > > updated version of the FS index will be written to the flash media. > Oh, I see. This is what I was missing. And I presume you always make sure > to have enough space for new FS index so it cannot deadlock when trying to > push out dirty pages.
Yes, this is one of the hardest part and this is what the budgeting subsystem does. Every VFS call (even unlink()) first invokes something like 'ubifs_budget_space()' with arguments describing the space needs, and the budgeting subsystem will account for the space, including the possibility of the index growth. And the budgeting subsystem actually forces write-back when it sees that there is not enough free space for the operation. Because all the calculations are pessimistic, write-back helps: the data nodes are compressed, and so on. The budgeting subsystem may also force commit, which will clarify many unclarities and make the calculations more precise. If nothing helps - ENOSPC is reported. For deletions we also have a bit of reserve space to prevent -ENOSPC when you actually want to delete a file on full file-system.
But the shorted answer: yes, we reserve 2 times the current index size of the space for the index growths.
Long time ago I tried to describe this and the surrounding issues here: http://www.linux-mtd.infradead.org/doc/ubifs.html#L_spaceacc
-- Best Regards, Artem Bityutskiy
| |