I took a simple first pass this, by simply allowing "precache" to behave
similar to commands like "bypassthreshold" and "storebehind".   This seemed
like it would be a simple matter of copying the approach used by other
functions.

Based on how bypassthreshold is implemented, I tried the function pasted
below, and it simply doesn't work, and I wonder if the issue is in the code
that implements the pioctl call (and I can't even find that....)

The resulting fs binary does two things I don't understand.  First, when no
argument is given, I expected the pioctl call to set the value of blob.out,
but instead I get this error:

fs: server or network not responding

If I try to set the value to, say, 100000, then I'm getting a completely
different value back:

Precache size 1101949910

Is this a matter of the pioctl() call not supporting returning the value,
perhaps?  I'm guessing that the error occurs because the pioctl() code is
written to expect an input value, and the strange integer value is just
random noise, because the same pioctl() code isn't setting the return value
in blob.out at all.

I'm not familiar with how the pioctl code is organized at all.  Can someone
point me to the place that actually handles:

    code = pioctl(0, VIOCPRECACHE, &blob, 1);

so I can figure this out?

Thanks....

----

static int
PreCacheCmd(struct cmd_syndesc *as, void *arock)
{
    afs_int32 code;
    struct ViceIoctl blob;
    afs_int32 precache_i, precache_o;

    if (as->parms[0].items) {
code = util_GetInt32(as->parms[0].items->data, &precache_i);
if (code) {
    fprintf(stderr, "%s: bad integer specified for precache size.\n",
    pn);
    return 1;
}
        blob.in = (char *)&precache_i;
        blob.in_size = sizeof(precache_i);
    } else {
        blob.in = NULL;
        blob.in_size = 0;
    }

    blob.out = (char *)&precache_o;
    blob.out_size = sizeof(precache_o);
    code = pioctl(0, VIOCPRECACHE, &blob, 1);
    if (code) {
Die(errno, NULL);
return 1;
    }

    printf("Precache size %d\n", precache_o);
    return 0;
}


On Tue, Oct 19, 2010 at 8:52 AM, Derrick Brashear <[email protected]> wrote:

> On Tue, Oct 19, 2010 at 7:27 AM, Phillip Moore
> <[email protected]> wrote:
> >
> > Would you accept a patch that introduces two new fs commands:
> >
> >     fs getprecache
> >     fs setprecache
> > and that "hides" the precache command?  IOW, precache will work, but it
> will
> > not show up in fs help output.  This introduces a new pair of get/set
> > commands, and would give admins the ability to query the value, and
> > therefore manage it.
> > Alternately, fs precache can be modified to display the value when no
> > arguments are provided, instead of generate a syntax error like it does
> > right now.
>
> Either is fine. A hidden deprecated command might be better in 1.6
> (documented as existing but deprecated) and the master can simply not
> have the command at all so that when 1.next hits, ti's already gone.
>
> > There's a lack of consistency in the fs commands, but my personal
> preference
> > is for get/set commands when we add new features, as opposed to a single
> > command for both setting and querying something.
> > On Mon, Oct 18, 2010 at 1:50 PM, Derrick Brashear <[email protected]>
> wrote:
> >>
> >> On Mon, Oct 18, 2010 at 1:45 PM, Phillip Moore
> >> <[email protected]> wrote:
> >> > Another fs command I can't find any documentation for:  fs precache
> >> > In this case, it appears that there's no way to query the value.
> This
> >> > seems like bad interface design to me.  If there's a mechanism for
> >> > setting
> >> > an important value that changes the behavior of the client, there has
> to
> >> > be
> >> > a mechanism for querying that value.  Otherwise, you can't manage it.
> >> >  Write-only, read-never parameters are very bad.
> >> > Looking at the code in src/venus/fs.c, it looks to me like this
> *should*
> >> > have been implemented as a pair of CLI commands: setprecache and
> >> > getprecache, and in fact, that should be straight forward, and fully
> >> > backwards compatible.
> >>
> >> Probably. And I take blame for that.
> >>
> >> > Is this another bleeding edge feature that the authors thought wasn't
> >> > important enough to write a man page for?
> >>
> >> No.
> >>
> >>
> >>
> >> --
> >> Derrick
> >
> >
>
>
>
> --
> Derrick
>

Reply via email to