freebsd-nq/sys/ufs/ffs
Kirk McKusick efbf396426 This change is some refactoring of Mark Johnston's changes in r329375
to fix the memory leak that I introduced in r328426. Instead of
trying to clear up the possible memory leak in all the clients, I
ensure that it gets cleaned up in the source (e.g., ffs_sbget ensures
that memory is always freed if it returns an error).

The original change in r328426 was a bit sparse in its description.
So I am expanding on its description here (thanks cem@ and rgrimes@
for your encouragement for my longer commit messages).

In preparation for adding check hashing to superblocks, r328426 is
a refactoring of the code to get the reading/writing of the superblock
into one place. Unlike the cylinder group reading/writing which
ends up in two places (ffs_getcg/ffs_geom_strategy in the kernel
and cgget/cgput in libufs), I have the core superblock functions
just in the kernel (ffs_sbfetch/ffs_sbput in ffs_subr.c which is
already imported into utilities like fsck_ffs as well as libufs to
implement sbget/sbput). The ffs_sbfetch and ffs_sbput functions
take a function pointer to do the actual I/O for which there are
four variants:

    ffs_use_bread / ffs_use_bwrite for the in-kernel filesystem

    g_use_g_read_data / g_use_g_write_data for kernel geom clients

    ufs_use_sa_read for the standalone code (stand/libsa/ufs.c
	but not stand/libsa/ufsread.c which is size constrained)

    use_pread / use_pwrite for libufs

Uses of these interfaces are in the UFS filesystem, geoms journal &
label, libsa changes, and libufs. They also permeate out into the
filesystem utilities fsck_ffs, newfs, growfs, clri, dump, quotacheck,
fsirand, fstyp, and quot. Some of these utilities should probably be
converted to directly use libufs (like dumpfs was for example), but
there does not seem to be much win in doing so.

Tested by: Peter Holm (pho@)
2018-03-02 04:34:53 +00:00
..
ffs_alloc.c Occasional cylinder-group check-hash errors were being reported on 2018-02-06 00:19:46 +00:00
ffs_balloc.c SPDX: Complete License ID tags for UFS. 2017-12-27 19:13:50 +00:00
ffs_extern.h Refactoring of reading and writing of the UFS/FFS superblock. 2018-01-26 00:58:32 +00:00
ffs_inode.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ffs_rawread.c sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
ffs_snapshot.c Revert r327781, r328093, r328056: 2018-01-24 16:44:57 +00:00
ffs_softdep.c ffs: softdep_disk_write_complete: Quiesce spurious Coverity warning 2018-03-01 00:29:52 +00:00
ffs_subr.c This change is some refactoring of Mark Johnston's changes in r329375 2018-03-02 04:34:53 +00:00
ffs_suspend.c sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
ffs_tables.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ffs_vfsops.c This change is some refactoring of Mark Johnston's changes in r329375 2018-03-02 04:34:53 +00:00
ffs_vnops.c SPDX: Complete License ID tags for UFS. 2017-12-27 19:13:50 +00:00
fs.h The goal of this change is to prevent accidental foot shooting by 2018-02-08 23:06:58 +00:00
softdep.h sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00