Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argSUSed: lib (so also the bit of module that is built for lib), include #12844

Closed
wants to merge 24 commits into from

Conversation

nabijaczleweli
Copy link
Contributor

@nabijaczleweli nabijaczleweli commented Dec 12, 2021

Motivation and Context

There are 2 unused arguments among us.

Description

Draft because on top of #12835 and #12067, otherwise should be g2g except as indicated below.

The main revelation over my previous attempt at this was making ASSERTs et al do (void)sizeof(args)...: this doesn't ODR-use the arguments, so they get elided as usual, but it marks them as used (and actually verifies that they compile, which is a nice bonus), bringing the total diffstat to just

113 files changed, 446 insertions(+), 331 deletions(-)

across 97 commits, which is more than fine, imo
These are sequestered to the first two commits.

Commits that start with a ! are more than purely editorial. In zfs sendrecv, I think this was a bug that I fixed. In arc.c I removed the mutex argument, which the comment says is used but isn't, and is only used by the caller?

In rdwr_efi.c, do we want efi_type() anymore? All it is right now is some #if 0ed Solaris code that returns ENOSYS, and is only applicable for the Solaris blockdev layer. In the Illumos gate, there's a single user: rmformat(1); I recommend a read of the manual as a blast from the past, but, well.

How Has This Been Tested?

make -C lib/ builds clean on clang 14 when configured with -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers in CFLAGS

git -C lib grep -i argsused and the equivalent invocations for include and module/{avl,icp,lua,nvpair,spl,unicode,zcommon,zstd} are empty. The keen-eyed observer will note that this leaves only module/zfs and module/os (f/s, f/z, and l/z). (Well, and cstyle.pl.)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the OpenZFS code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes. – none should apply
  • I have run the ZFS Test Suite with this change applied. – CI take my hand
  • All commit messages are properly formatted and contain Signed-off-by. – needs mass replacing on ; when ready

@nabijaczleweli nabijaczleweli changed the title argSUSed: lib (so also the bit of module that is built for lib) argSUSed: lib (so also the bit of module that is built for lib), include Dec 12, 2021
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Dec 16, 2021
@nabijaczleweli nabijaczleweli force-pushed the lib-ARGSUSED branch 3 times, most recently from f9cb23e to 16aeed5 Compare December 21, 2021 17:48
@behlendorf behlendorf self-requested a review December 22, 2021 00:56
@nabijaczleweli nabijaczleweli marked this pull request as ready for review December 22, 2021 01:57
@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Dec 22, 2021

Rebased with full commit messages, should be g2g, but see notes in OP

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good. In order to move this forward what I'd like to do is move the commits which include functional changes, or I commented on specifically, in to their own PRs. We'll want to round up additional reviewers for those.

For the rest it would be nice to squash the patch stack a bit. One option would be merging similar commits together by library/module or header.

abd_return_buf_copy(zio->io_abd, buf, size);
} else {
buf = abd_borrow_buf_copy(zio->io_abd, zio->io_size);
err = zfs_file_pwrite(vf->vf_file, buf, size, off, &resid);
(void) zfs_file_pwrite(vf->vf_file, buf, size, off, &resid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bug. err should be assigned to zio->io_error after the conditional, see the Linux version of vdev_file_io_strategy. Can you move the updated fix for this to its own PR for review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


for (i = 0; i < sizeof (zlfid->zf_setid); i++)
objsetid |= ((uint64_t)zlfid->zf_setid[i]) << (8 * i);

for (i = 0; i < sizeof (zlfid->zf_setgen); i++)
setgen |= ((uint64_t)zlfid->zf_setgen[i]) << (8 * i);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a good chance this is bug, the Linux counterpart to this function zfs_vget does make use of setgen for an error case. This would also be a good candidate to move to it's own PR so we can get the FreeBSD folks to take a closer look.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1947,7 +1948,7 @@ arc_fill_hdr_crypt(arc_buf_hdr_t *hdr, kmutex_t *hash_lock, spa_t *spa,
* arc_buf_fill().
*/
static void
arc_buf_untransform_in_place(arc_buf_t *buf, kmutex_t *hash_lock)
arc_buf_untransform_in_place(arc_buf_t *buf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for context the hash_lock still actually may be checked here through the HDR_EMPTY_OR_LOCKED() check. It doesn't need so this looks fine.

@@ -249,6 +249,6 @@ zfs_dev_flush(int fd __unused)
}

void
update_vdevs_config_dev_sysfs_path(nvlist_t *config)
update_vdevs_config_dev_sysfs_path(nvlist_t *config __unused)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why __unused here and not (void) config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there's __unused above, too, but fair point, I've changed them both to void casts.

module/zfs/dnode.c Show resolved Hide resolved
@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Dec 22, 2021

Updated. Moved the remaining one (libzfs/sendrecv) to #12906, others as noted.

As it stands, here's all the sus commits (sorted by amount of commits per section for demonstration purposes):

include: dmu.h
libefi: efi_type
libzfs_core
libshare: nfs: is_shared_cb
libshare: platform: nfs: disable_share_impl
libzpool: util
libzpool: kernel
libzpool: taskq
libzutil: import: find_import_impl
libzutil: import: platform
libzutil: import: platform: is_mpath_whole_disk
libnvpair: alloc_fixed: free
libnvpair: main: print_list_*
libnvpair: alloc_system: free
libnvpair: fnvpair: free
libnvpair: nvpair
libzfs: util: linux
libzfs: changelist
libzfs: config: node_compare
libzfs: crypto
libzfs: dataset: userquota_propname_decode
libzfs: mountpoint
libzfs: status
libzfs: mount: platforms
libzfs: fletcher
libzfs: iter
module: avl
module: zcommon: zprop
module: zfs: linux: abd
module: zfs: linux: arc
module: zfs: debug: linux
module: zfs: freebsd: znode
module: zfs: freebsd: spa_os
module: zfs: bpobj
module: zfs: bptree
module: zfs: dmu
module: zfs: dmu: diff
module: zfs: dmu: objset
module: zfs: dmu: redact
module: zfs: dmu: send
module: zfs: dmu: traverse
module: zfs: dmu: zfetch
module: zfs: dnode
module: zfs: dsl: bookmark
module: zfs: dsl: dataset
module: zfs: dsl: destroy
module: zfs: dsl: dir
module: zfs: dsl: pool
module: zfs: dsl: prop
module: zfs: dsl: scan
module: zfs: dsl: synctask: null_checkfunc
module: zfs: fm
module: zfs: gzip
module: zfs: lz4
module: zfs: lzjb
module: zfs: metaslab
module: zfs: range_tree
module: zfs: sa
module: zfs: sha256
module: zfs: spa
module: zfs: spa: checkpoint
module: zfs: spa: history
module: zfs: spa: misc
module: zfs: spa: vdev
module: zfs: vdev: draid
module: zfs: vdev: file: platforms
module: zfs: vdev: indirect
module: zfs: vdev: initialize
module: zfs: vdev: mirror
module: zfs: vdev: missing
module: zfs: vdev: raidz
module: zfs: vdev: removal
module: zfs: vdev: trim
module: zfs: zcp
module: zfs: zcp: synctask
module: zfs: racct: platforms
module: zfs: zil
module: zfs: zio
module: zfs: zio: checksum
module: zfs: zio: compress
module: zfs: zio: crypt: platforms
module: zfs: abd
module: zfs: arc
module: zfs: dbuf
module: zfs: zfs_fm
module: icp: algs: gcm
module: icp: algs: ccm
module: icp: io: aes
module: icp: io: sha1_mod
module: icp: core: kcf: mech_tabs
module: icp: core: kcf: prov_lib
module: icp: io: sha2_mod
module: icp: os: modhash
module: icp: os: modconf
module: icp: core: kcf: sched
module: icp: io: skein_mod
module: icp: remaining

Here's variant lite (libraries grouped, modules grouped by the subsystem):

include: dmu.h
libefi: efi_type
libzfs_core
libshare: nfs: is_shared_cb
libzpool
libzutil: import
libnvpair
libzfs
module: avl
module: zcommon: zprop
module: zfs: linux
module: zfs: freebsd
module: zfs: bpobj
module: zfs: bptree
module: zfs: dmu
module: zfs: dnode
module: zfs: dsl
module: zfs: fm
module: zfs: gzip
module: zfs: lz4
module: zfs: lzjb
module: zfs: metaslab
module: zfs: range_tree
module: zfs: sa
module: zfs: sha256
module: zfs: spa
module: zfs: vdev
module: zfs: zcp
module: zfs: racct: platforms
module: zfs: zil
module: zfs: zio
module: zfs: abd
module: zfs: arc
module: zfs: dbuf
module: zfs: zfs_fm
module: icp: algs
module: icp: io
module: icp: core: kcf
module: icp: os: modhash
module: icp: os: modconf
module: icp: remaining

Or variant heavy (grouped by module, I kept the linux/freebsd bits separate because I usually do but in variant heavy+, let's say, these can also meld together):

include: dmu.h
libefi: efi_type
libzfs_core
libshare: nfs: is_shared_cb
libzpool
libzutil: import
libnvpair
libzfs
module: avl
module: zcommon: zprop
module: zfs: linux
module: zfs: freebsd
module: zfs
module: icp

Which one strikes you best?

@behlendorf
Copy link
Contributor

Let's go with the last variant, that seems like a sufficient level of granularity for this kind of change. The module: zfs commit I imagine with be substantially larger than the others but that's not a problem.

include: dmu.h
libefi: efi_type
libzfs_core
libshare: nfs: is_shared_cb
libzpool
libzutil: import
libnvpair
libzfs
module: avl
module: zcommon: zprop
module: zfs: linux
module: zfs: freebsd
module: zfs
module: icp

nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Fix from openzfs#12844 (comment)

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12905
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
All it is right now is some #if 0ed Solaris code that returns ENOSYS,
and is only applicable for the Solaris blockdev layer.
In the Illumos gate, there's a single user: rmformat(1);
I recommend a read of the manual as a blast from the past, but, well

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Issue openzfs#12844
Closes openzfs#12969
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12844
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Fix from openzfs#12844 (comment)

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12905
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
All it is right now is some #if 0ed Solaris code that returns ENOSYS,
and is only applicable for the Solaris blockdev layer.
In the Illumos gate, there's a single user: rmformat(1);
I recommend a read of the manual as a blast from the past, but, well

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Issue openzfs#12844
Closes openzfs#12969
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Code Review Needed Ready for review and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants