-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
zio: rename "ioctl" to "flush"; remove zio_ioctl()
#16064
Conversation
zio_ioctl()
f5d0ad5
to
064edaf
Compare
064edaf
to
af00474
Compare
It only had one user, zio_flush(), and there are no other vdev ioctls anyway. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
There's no other options, so we can just always assume its a flush. Includes some light refactoring where a switch statement was doing control flow that no longer works. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Without DKIOCFLUSHWRITECACHE, we no longer need the compat header. Note that we're keeping the userspace SPL compat header, which is used by libefi. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
The only possible ioctl is a flush, and any other kind of meta-operation introduced in the future is likely to have different semantics (much like trim did). So, lets just call it what it is. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
af00474
to
070d554
Compare
@@ -1053,7 +1053,7 @@ vdev_geom_io_intr(struct bio *bp) | |||
/* | |||
* We have to split bio freeing into two parts, because the ABD code | |||
* cannot be called in this context and vdev_op_io_done is not called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this PR vdev_op_io_done
is now called for ZIO_TYPE_FLUSH
, so this comment is wrong. I didn't want to just remove it, because maybe its pointing to a cleanup opportunity if this is no longer necessary. But I also don't know enough right now to just make the change. I'll come back to it soon, but if a FreeBSDer wants to step in and propose a change, that'd be even better!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This context is indeed not sleepable. Primarily it means no waiting memory allocations, etc, which would not be a problem here. But it also means no sleepable locks, and on FreeBSD ZFS' mutex_enter() called, for example, by zfs_refcount_remove_many(), called by abd_return_buf() is mapped into sleepable sx_xlock(). Since vdev_op_io_done() is now called for ZIO_TYPE_FLUSH, I guess it should be easier to remove this special case here and make vdev_geom_io_done() do everything.
Feedback addressed, rebased to master, and updated following #16061. |
There's no other options, so we can just always assume its a flush. Includes some light refactoring where a switch statement was doing control flow that no longer works. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16064
Without DKIOCFLUSHWRITECACHE, we no longer need the compat header. Note that we're keeping the userspace SPL compat header, which is used by libefi. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16064
The only possible ioctl is a flush, and any other kind of meta-operation introduced in the future is likely to have different semantics (much like trim did). So, lets just call it what it is. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16064
It only had one user, zio_flush(), and there are no other vdev ioctls anyway. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#16064
There's no other options, so we can just always assume its a flush. Includes some light refactoring where a switch statement was doing control flow that no longer works. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#16064
Without DKIOCFLUSHWRITECACHE, we no longer need the compat header. Note that we're keeping the userspace SPL compat header, which is used by libefi. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#16064
The only possible ioctl is a flush, and any other kind of meta-operation introduced in the future is likely to have different semantics (much like trim did). So, lets just call it what it is. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#16064
Motivation and Context
ZIO_TYPE_IOCTL
has always been confusingly-named, as its only used for device flush, and really couldn't be used for anything else anyway. The presence ofzio_ioctl
andzio_flush
compounded this confusion.I'd had low-key plans to fix it up someday maybe, but then @amotin raised it in #16061, so here we are.
Description
ZIO_TYPE_IOCTL
andZIO_PIPELINE_IOCTL
toZIO_TYPE_FLUSH
andZIO_PIPELINE_FLUSH
z_ioctl
IO queue toz_flush
io_cmd
field fromstruct zio
DKIOCFLUSHWRITECACHE
, since we now know what all these requests arezio_ioctl()
, folds its functionality intozio_flush()
I've tried to maintain the userspace API, not that there's much of it involved.
The use of
X
as the flag for flush inzio_impl.h
andzpool-events.8
is kinda dubious, but I don't have any obviously better choice, and given the number of drive-by fixes I've done to these two docs in the last year or so I doubt many people will notice or care anyway.How Has This Been Tested?
Compiled on Linux and FreeBSD, basic sanity check run completed.
Types of changes
Checklist:
Signed-off-by
.