On Wed, Jun 12, 2024 at 04:06:34PM +0800, Zorro Lang wrote: > On Mon, Jun 10, 2024 at 08:01:59PM -0700, Luis Chamberlain wrote: > > +mwrite() > > +{ > > + local file=$1 > > + local offset=$2 > > + local length=$3 > > + local map_len=${4:-$(_round_up_to_page_boundary $(_get_filesize $file)) } > > + > > + # Some callers expect xfs_io to crash with SIGBUS due to the mread, > > + # causing the shell to print "Bus error" to stderr. To allow this > > + # message to be redirected, execute xfs_io in a new shell instance. > > + # However, for this to work reliably, we also need to prevent the new > > + # shell instance from optimizing out the fork and directly exec'ing > > + # xfs_io. The easiest way to do that is to append 'true' to the > > + # commands, so that xfs_io is no longer the last command the shell sees. > > + bash -c "trap '' SIGBUS; ulimit -c 0; \ > > + $XFS_IO_PROG $file \ > > + -c 'mmap -w 0 $map_len' \ > > + -c 'mwrite $offset $length'; \ > > + true" > > +} > > As you've moved the _mread to common/rc, why not do the same for this mwrite? I didn't move it as this mwrite() is only used by one test. Let me know if you want me to move it. Luis