refactorings and reordering in _fs.c