Global variable in FSD

Dear All,

I’m using a Global variable in FSD which is been modified in many functions. The problem is I’m not getting the latest value of the variable as some of the functions are blocked on I/O operation. I know using a Global variable is a Bad idea. Is there any alternative for this problem.

Thanks in advance…

Sincerely
ML

Hello Nagaraja M.L,
I see this as a problem of synchronization. Check whether you have
serialized the access to these global variables, if you are accessing these
from multiple threads(in FSDs it is typically the case).
Also, using global variables need not be a bad idea always, provided you
understand the implications behind them.
thanks
-Kiran
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Nagaraja M.L
Sent: Tuesday, October 28, 2003 11:04 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Global variable in FSD

Dear All,

I’m using a Global variable in FSD which is been modified in many
functions. The problem is I’m not getting the latest value of the variable
as some of the functions are blocked on I/O operation. I know using a Global
variable is a Bad idea. Is there any alternative for this problem.

Thanks in advance…

Sincerely
ML

You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Synchronization is one implication. What are the others? I never had any
issues with globals, although I use them frequently.

Tobias

----- Original Message -----
From: “Kiran Joshi”
To: “Windows File Systems Devs Interest List”
Sent: Tuesday, October 28, 2003 7:26 AM
Subject: [ntfsd] RE: Global variable in FSD

> Hello Nagaraja M.L,
> I see this as a problem of synchronization. Check whether you have
> serialized the access to these global variables, if you are accessing
these
> from multiple threads(in FSDs it is typically the case).
> Also, using global variables need not be a bad idea always, provided
you
> understand the implications behind them.
> thanks
> -Kiran
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Nagaraja M.L
> Sent: Tuesday, October 28, 2003 11:04 AM
> To: Windows File Systems Devs Interest List
> Subject: [ntfsd] Global variable in FSD
>
>
> Dear All,
>
> I’m using a Global variable in FSD which is been modified in many
> functions. The problem is I’m not getting the latest value of the variable
> as some of the functions are blocked on I/O operation. I know using a
Global
> variable is a Bad idea. Is there any alternative for this problem.
>
> Thanks in advance…
>
> Sincerely
> ML
> —
> You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@linkwave.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Yes you are right, there aren’t many implications. Synchronization is one
major, and the other is that global variables are allocated from non paged
pool, unless explicitly made them pageable( now u might want to take IRQLs
into consideration here). But generally they are small in size, so it should
be acceptable to have them in non-paged pool

thanks
-Kiran

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Tobias
Sent: Tuesday, October 28, 2003 12:24 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] RE: Global variable in FSD

Synchronization is one implication. What are the others? I never had any
issues with globals, although I use them frequently.

Tobias

----- Original Message -----
From: “Kiran Joshi”
To: “Windows File Systems Devs Interest List”
Sent: Tuesday, October 28, 2003 7:26 AM
Subject: [ntfsd] RE: Global variable in FSD

> Hello Nagaraja M.L,
> I see this as a problem of synchronization. Check whether you have
> serialized the access to these global variables, if you are accessing
these
> from multiple threads(in FSDs it is typically the case).
> Also, using global variables need not be a bad idea always, provided
you
> understand the implications behind them.
> thanks
> -Kiran
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Nagaraja M.L
> Sent: Tuesday, October 28, 2003 11:04 AM
> To: Windows File Systems Devs Interest List
> Subject: [ntfsd] Global variable in FSD
>
>
> Dear All,
>
> I’m using a Global variable in FSD which is been modified in many
> functions. The problem is I’m not getting the latest value of the variable
> as some of the functions are blocked on I/O operation. I know using a
Global
> variable is a Bad idea. Is there any alternative for this problem.
>
> Thanks in advance…
>
> Sincerely
> ML
> —
> You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@linkwave.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Ofcourse using global variables need not always be a bad idea, but one more good alternative to the global variables is to have these variables in the Device Extension structure. This option is only useful if these variables are not used as shared resources by all devices supported by your driver, because we create separate copies of device extension for all device objects. Even though you create multiple copies of variables in nonPaged memory (using device extension), advantage of this method is: you gain the performance by avoiding unnecessary lockings that will be used otherwise to synchronize between all device object request.But again this method is valid if you don’t want to use these variables as sharing resources between all device objects.

HTH,
~rushikesh.

Kiran Joshi wrote:

Hello Nagaraja M.L,
I see this as a problem of synchronization. Check whether you have serialized the access to these global variables, if you are accessing these from multiple threads(in FSDs it is typically the case).
Also, using global variables need not be a bad idea always, provided you understand the implications behind them.
thanks
-Kiran
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]On Behalf Of Nagaraja M.L
Sent: Tuesday, October 28, 2003 11:04 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Global variable in FSD

Dear All,

I’m using a Global variable in FSD which is been modified in many functions. The problem is I’m not getting the latest value of the variable as some of the functions are blocked on I/O operation. I know using a Global variable is a Bad idea. Is there any alternative for this problem.

Thanks in advance…

Sincerely
ML

You are currently subscribed to ntfsd as: xxxxx@calsoftinc.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
You are currently subscribed to ntfsd as: xxxxx@yahoo.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

better declare the variable under device extension of device object.

-GP
----- Original Message -----
From: Nagaraja M.L
To: Windows File Systems Devs Interest List
Sent: Tuesday, October 28, 2003 11:03 AM
Subject: [ntfsd] Global variable in FSD

Dear All,

I’m using a Global variable in FSD which is been modified in many functions. The problem is I’m not getting the latest value of the variable as some of the functions are blocked on I/O operation. I know using a Global variable is a Bad idea. Is there any alternative for this problem.

Thanks in advance…

Sincerely
ML

You are currently subscribed to ntfsd as: xxxxx@visualsoft-tech.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Actually, it depend on what you are doing if a global is a bad idea or not.
Tables and statistic counters shared across devices are examples of where a
global is fine. Don’t fall into the trap of everything in the device
extension no matter what, I once saw a driver that walked its list of device
ovjects to collect overall statistics since the DDK documentation had stated
globals are bad. Like everything else in driver writing, there is a
judgement call here.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: GnanaPrakash.R
To: Windows File Systems Devs Interest List
Sent: Thursday, October 30, 2003 7:41 AM
Subject: [ntfsd] Re: Global variable in FSD

better declare the variable under device extension of device object.

-GP
----- Original Message -----
From: Nagaraja M.L
To: Windows File Systems Devs Interest List
Sent: Tuesday, October 28, 2003 11:03 AM
Subject: [ntfsd] Global variable in FSD

Dear All,

I’m using a Global variable in FSD which is been modified in many functions.
The problem is I’m not getting the latest value of the variable as some of
the functions are blocked on I/O operation. I know using a Global variable
is a Bad idea. Is there any alternative for this problem.

Thanks in advance…

Sincerely
ML

You are currently subscribed to ntfsd as: xxxxx@visualsoft-tech.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@acm.org
To unsubscribe send a blank email to xxxxx@lists.osr.com