From: Liang Zhen <Zhen.Liang@Sun.COM>
To: lustre-devel@lists.lustre.org
Subject: [Lustre-devel] LNET:where in the code dose the file obeject's private data gets filled up.
Date: Wed, 26 May 2010 13:21:18 +0800 [thread overview]
Message-ID: <4BFCAFCE.7060505@sun.com> (raw)
In-Reply-To: <AANLkTikhDg6RYGCmi0jmwCNerJtc5Y_7oqxkpaq7YhFV@mail.gmail.com>
ankit sharma wrote:
> Hi all,
> I am new to Lustre code. So i am sorry if my question is
> trivial or silly.
>
> My question:
>
> On line number 116 of the file lnet/lnet/router_proc.c
> variable ver_p is getting set from the proc file object's private data.
>
> Can any one tell me which part of the lustre code dose this file
> object private data
> gets initialized / set .
>
> conceptually in can imagine it should (correct me if I am worng) be
> set in open call of the file ( /proc/sys/lnet/routers )
>
> BUT I cant locate the Lustre code that dose that(sets the private data
> of file object).
>
>
> code snippet form lnet/lnet/router_proc.c
>
> int LL_PROC_PROTO(proc_lnet_routes)
> {
> int rc = 0;
> char *tmpstr;
> char *s;
> const int tmpsiz = 256;
> int len;
> int *ver_p = (unsigned int *)(&filp->private_data);
>
> DECLARE_LL_PROC_PPOS_DECL;
>
> LASSERT (!write);
>
> if (*lenp == 0)
> return 0;
>
> LIBCFS_ALLOC(tmpstr, tmpsiz);
> if (tmpstr == NULL)
> return -ENOMEM;
>
> s = tmpstr; /* points to current position in tmpstr[] */
>
> if (*ppos == 0) {
> s += snprintf(s, tmpstr + tmpsiz - s, "Routing %s\n",
> the_lnet.ln_routing ? "enabled" :
> "disabled");
> LASSERT (tmpstr + tmpsiz - s > 0);
>
> s += snprintf(s, tmpstr + tmpsiz - s, "%-8s %4s %7s %s\n",
> "net", "hops", "state", "router");
> LASSERT (tmpstr + tmpsiz - s > 0);
>
> LNET_LOCK();
> *ver_p = (unsigned int)the_lnet.ln_remote_nets_version;
It's initialized at here, because we have "*ppos == 0" while starting,
so it's actually same as
filp->private_data = (void *)the_lnet.ln_remote_nets_version;
Regards
Liang
> LNET_UNLOCK();
>
> } else {
> struct list_head *n;
> struct list_head *r;
> lnet_route_t *route = NULL;
> lnet_remotenet_t *rnet = NULL;
> int skip = *ppos - 1;
>
> LNET_LOCK();
>
> if (*ver_p != (unsigned
> int)the_lnet.ln_remote_nets_version) {
> LNET_UNLOCK();
> LIBCFS_FREE(tmpstr, tmpsiz);
> return -ESTALE;
> }
>
> n = the_lnet.ln_remote_nets.next;
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Lustre-devel mailing list
> Lustre-devel at lists.lustre.org
> http://lists.lustre.org/mailman/listinfo/lustre-devel
>
prev parent reply other threads:[~2010-05-26 5:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-25 18:07 [Lustre-devel] LNET:where in the code dose the file obeject's private data gets filled up ankit sharma
2010-05-25 20:04 ` Andreas Dilger
2010-05-26 5:21 ` Liang Zhen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BFCAFCE.7060505@sun.com \
--to=zhen.liang@sun.com \
--cc=lustre-devel@lists.lustre.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.