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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>