public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Cc: Evgeniy Dushistov <dushistov@mail.ru>,
	"Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Subject: [patches][cft] ufs stuff
Date: Wed, 13 Dec 2023 03:16:39 +0000	[thread overview]
Message-ID: <20231213031639.GJ1674809@ZenIV> (raw)

	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.

             reply	other threads:[~2023-12-13  3:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13  3:16 Al Viro [this message]
2023-12-13  3:18 ` [PATCH 01/12] fs/ufs: Use the offset_in_page() helper Al Viro
2023-12-13  3:18   ` [PATCH 02/12] fs/ufs: Change the signature of ufs_get_page() Al Viro
2023-12-13  3:18   ` [PATCH 03/12] fs/ufs: Use ufs_put_page() in ufs_rename() Al Viro
2023-12-13  3:18   ` [PATCH 04/12] fs/ufs: Replace kmap() with kmap_local_page() Al Viro
2023-12-13  3:18   ` [PATCH 05/12] ufs: fix handling of delete_entry and set_link failures Al Viro
2023-12-13  3:18   ` [PATCH 06/12] ufs: untangle ubh_...block...() macros, part 1 Al Viro
2023-12-13  3:18   ` [PATCH 07/12] ufs: untangle ubh_...block...(), part 2 Al Viro
2023-12-13  3:18   ` [PATCH 08/12] ufs: untangle ubh_...block...(), part 3 Al Viro
2023-12-13  3:18   ` [PATCH 09/12] ufs_clusteracct(): switch to passing fragment number Al Viro
2023-12-13  3:18   ` [PATCH 10/12] ufs_inode_getfrag(): remove junk comment Al Viro
2023-12-13  3:18   ` [PATCH 11/12] ufs: get rid of ubh_{ubhcpymem,memcpyubh}() Al Viro
2023-12-13  3:18   ` [PATCH 12/12] clean ufs_trunc_direct() up a bit Al Viro
2023-12-13  6:53 ` [patches][cft] ufs stuff Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231213031639.GJ1674809@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=dushistov@mail.ru \
    --cc=fmdefrancesco@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox