More old stuff, this time UFS one. Part of that is yet another kmap_local_page() conversion, part - assorted cleanups. It seems to survive local beating, but it needs more review and testing. The branch is available in vfs.git #work.ufs; individual patches in followups. Shortlog: Al Viro (8): ufs: fix handling of delete_entry and set_link failures ufs: untangle ubh_...block...() macros, part 1 ufs: untangle ubh_...block...(), part 2 ufs: untangle ubh_...block...(), part 3 ufs_clusteracct(): switch to passing fragment number ufs_inode_getfrag(): remove junk comment ufs: get rid of ubh_{ubhcpymem,memcpyubh}() clean ufs_trunc_direct() up a bit... Fabio M. De Francesco (4): fs/ufs: Use the offset_in_page() helper fs/ufs: Change the signature of ufs_get_page() fs/ufs: Use ufs_put_page() in ufs_rename() fs/ufs: Replace kmap() with kmap_local_page() Diffstat: fs/ufs/balloc.c | 29 +++++------ fs/ufs/dir.c | 156 +++++++++++++++++++++++++++++--------------------------- fs/ufs/inode.c | 144 ++++++++++++++++++++++----------------------------- fs/ufs/namei.c | 52 ++++++++----------- fs/ufs/super.c | 45 ++++++---------- fs/ufs/ufs.h | 2 +- fs/ufs/util.c | 46 ----------------- fs/ufs/util.h | 61 +++++++++++----------- 8 files changed, 222 insertions(+), 313 deletions(-) Beginning of the series is the kmap_local_page() conversion and fixes, parallel to what's been done for sysv/ext2/minixfs: 1/12) fs/ufs: Use the offset_in_page() helper 2/12) fs/ufs: Change the signature of ufs_get_page() 3/12) fs/ufs: Use ufs_put_page() in ufs_rename() 4/12) fs/ufs: Replace kmap() with kmap_local_page() 5/12) ufs: fix handling of delete_entry and set_link failures After that it's assorted cleanups; there's quite a bit of obfuscation caused by trying to hide the fragment numbers behind a forest of macros, presumably in attempt to make it more similar to ext2 et.al. These patches untangle some of that. 6/12) ufs: untangle ubh_...block...() macros, part 1 passing implicit argument to a macro by having it in a variable with special name is Not Nice(tm); just pass it explicitly. kill an unused macro, while we are at it... 7/12) ufs: untangle ubh_...block...(), part 2 pass cylinder group descriptor instead of its buffer head (ubh, always UCPI_UBH(ucpi)) and its ->c_freeoff. 8/12) ufs: untangle ubh_...block...(), part 3 Pass fragment number instead of a block one. It's available in all callers and it makes the logics inside those helpers much simpler. The bitmap they operate upon is with bit per fragment, block being an aligned group of 1, 2, 4 or 8 adjacent fragments. We still need a switch by the number of fragments in block (== number of bits to check/set/clear), but finding the byte we need to work with becomes uniform and that makes the things easier to follow. 9/12) ufs_clusteracct(): switch to passing fragment number 10/12) ufs_inode_getfrag(): remove junk comment It used to be a stubbed out beginning of ufs2 support, which had been implemented differently quite a while ago. Remove the commented-out (pseudo-)code. 11/12) ufs: get rid of ubh_{ubhcpymem,memcpyubh}() used only in ufs_read_cylinder_structures()/ufs_put_super_internal() and there we can just as well avoid bothering with ufs_buffer_head and just deal with it fragment-by-fragment. 12/12) clean ufs_trunc_direct() up a bit... For short files (== no indirect blocks needed) UFS allows the last block to be a partial one. That creates some complications for truncation down to "short file" lengths. ufs_trunc_direct() is called when we'd already made sure that new EOF is not in a hole; nothing needs to be done if we are extending the file and in case we are shrinking the file it needs to * shrink or free the old final block. * free all full direct blocks between the new and old EOF. * possibly shrink the new final block. The logics is needlessly complicated by trying to keep all cases handled by the same sequence of operations. if not shrinking nothing to do else if number of full blocks unchanged free the tail of possibly partial last block else free the tail of (full) new last block free all present (full) blocks in between free the (possibly partial) old last block is easier to follow than the result of trying to unify these cases.