Issue 90: Use of global variables
Status:  In-progress
Owner:
Reported by rishi.b....@gmail.com, Jul 17, 2009
Hello All,

As far as I see the user space code has many global variables which I think
are not required at all.

Try to remove the global variables.
Jul 17, 2009
Project Member #1 sandeepksinha
Have you checked up with the latest code that we have in v1.1
I have already tried to remove a lot of them.

Kindly re-verify. and if you still feel there is a need, go ahead with it.

Jul 20, 2009
#2 rishi.b....@gmail.com
Closing the issue

Wontfix
Status: WontFix
Labels: -Priority-Medium Priority-Low
Aug 2, 2009
Project Member #3 charles....@gmail.com
There are three global variables defined

struct ohsm_reloc_policy *relocpol; //include/ohsm.h

struct ohsm_tier_dev_info *dev_info; //include/ohsm.h

struct ohsm_allocation_policy *allocpol;  //userspace/ohsm_u.h

int ohsm_fd; //userspace/ohsm.c 


Out of all these ohsm_fd has reduced the efforts of coding a bit but that can also be
handled by passing the fd to the called function in ohsm.c

I think we should be removing the global variables wherever we can, but it will
require the a lot of modification of the code.


Comments/suggestions??
Status: In-progress
Owner: charles.drawin
Aug 2, 2009
Project Member #4 charles....@gmail.com
Copying what Manish Wrote on the fscops group:

It would be good if we can remove as much global variables as
possible. Lot of code modification is possible at this stage but might
not be feasible once the code base becomes significantly big. So let
us do it as early as possible.

I haven't yet thought about how we are going to handle multiple ohsm
instances, but these global variables will definitely hurt then. In
the long term probably we will need variables as instance specific.
and each ohsm instance will be tied to a file system. something like

struct ohsm_main_structure {
       int seq_no => tied to a filesystem/identifier or anything of that sort.
       ............
       /* All the ohsm variables specific to a filesystem */
}

And then each instance will be have one copy of such structure which
are distinguishable from each other.

Thanks -
Manish