Re: [PATCH v4] xfs_io: support -c "open foo" command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 7, 2016 at 12:51 AM, Dave Chinner <david@xxxxxxxxxxxxx> wrote:
...
> Again, you've defined the solution to meet only your immediate
> needs.  The git history will tells us what is "proper", and I'm
> pretty sure what I suggested first up (use of CMD_FLAG_GLOBAL) will
> be close to the mark....
>

True, I've defined the solution to meet my needs, though I believe my
needs are not crazy and serve a greater good.
The reason I did not go for the "proper" solution is because I did not
understand how your suggestion aims to solve the problem defined
by my test. And by solve I don't mean just avoid the endless loop.

> So the initial fix for the current problem is to mark all the
> "one-shot" commands with CMD_FLAG_GLOBAL so they don't iterate the
> file table and behave sanely by default. I'd rename CMD_FLAG_GLOBAL
> to something more appropriate as well,

CMD_FLAG_ONESHOT?

> and probably rework the main
> command loop to get this check out of the main loop and into the
> args_command() function where we can do single shot command
> control cleanly.
>


And I would gladly follow your suggestion to fix endless loop issue,
but first I would like to understood where this is going to end up in terms
of "expected behavior" (see below).

> The next fix is to be able to control iteration directly, so if we
> want to stat all or just the current file we can. I'd suggest that
> we should introduce a "-C <cmd>" option to indicate that the command
> should only be run on the current active file. That will allow new
> tests that use multiple files to control behaviour appropriately...
>

So that is what I was missing in your first reply.
I realized that a new semantic must be added to be able to both
keep existing behavior and enable the desired functionality.

But I am not sure that -C <cmd> does the job.
See the example below from test overlay/016.
It's a perfectly valid use case that cannot be described with
existing semantics.

#
# case #1:
# open file for read (rofd)
# open file for write (rwfd)
# write to rwfd
# read from rofd
#
$XFS_IO_PROG \
        -c "open -r foo" \
        -c "open foo" \
        -c "pwrite -S 0x61 0 16" \
        -c "file 0" \
        -c "pread -v 0 16" \

With the suggested -C <cmd> semantics,
it would look something like this:
$XFS_IO_PROG \
        -c "open -r foo" \
        -c "open foo" \
        -C "pwrite -S 0x61 0 16" \
        -c "file 0" \
        -C "pread -v 0 16" \


This could work out if -C meant to mark that cmd CMD_FLAG_ONESHOT
and run it only once. It suffice for the use case of writing a script, but
not sure if that is what you meant.

I assert that any usage containing multiple files and -C commands is
going to be confusing to read, but if that is the price we have to pay
for not getting the semantics clear from the start, so be it.

I am hoping you are able to clarify that we are on the same page,
so I can go on with implementation.

Thanks,
Amir.
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux