* [Lustre-devel] LNET:where in the code dose the file obeject's private data gets filled up.
@ 2010-05-25 18:07 ankit sharma
2010-05-25 20:04 ` Andreas Dilger
2010-05-26 5:21 ` Liang Zhen
0 siblings, 2 replies; 3+ messages in thread
From: ankit sharma @ 2010-05-25 18:07 UTC (permalink / raw)
To: lustre-devel
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;
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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20100525/7af34465/attachment.htm>
^ permalink raw reply [flat|nested] 3+ messages in thread* [Lustre-devel] LNET:where in the code dose the file obeject's private data gets filled up.
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
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Dilger @ 2010-05-25 20:04 UTC (permalink / raw)
To: lustre-devel
On 2010-05-25, at 12:07, ankit sharma wrote:
> 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).
If this is related to porting Lustre to a newer kernel, please search bugzilla for the RHEL6 and/or SLES11 SP1 kernel patches, since it fixes up this bit of code already.
Cheers, Andreas
--
Andreas Dilger
Lustre Technical Lead
Oracle Corporation Canada Inc.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Lustre-devel] LNET:where in the code dose the file obeject's private data gets filled up.
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
1 sibling, 0 replies; 3+ messages in thread
From: Liang Zhen @ 2010-05-26 5:21 UTC (permalink / raw)
To: lustre-devel
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-26 5:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.