diff options
author | Fred Isaman <iisaman@netapp.com> | 2011-01-06 06:36:22 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-01-06 14:46:31 -0500 |
commit | fd6002e9b8a93220d5f53b93d9624caf73cdc8a2 (patch) | |
tree | f45c22c9ec855949b1ec0488162229df4eb3f5ed /fs/nfs/pnfs.h | |
parent | b7edfaa1983362842351e425adeb8e297b4c11fb (diff) |
pnfs: change layout state seqlock to a spinlock
This prepares for future changes, where the layout state needs
to change atomically with several other variables. In particular,
it will need to know if lo->segs is empty, as we test that instead
of manipulating the NFS_LAYOUT_STATEID_SET bit. Moreover, the
layoutstateid is not really a read-mostly structure, as it is
written almost as often as it is read.
The behavior of pnfs_get_layout_stateid is also slightly changed, so that
it no longer changes the stateid. Its name is changed to +pnfs_choose_layoutget_stateid.
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pnfs.h')
-rw-r--r-- | fs/nfs/pnfs.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index c2f108640fc4..10937203d236 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -44,7 +44,6 @@ struct pnfs_layout_segment { | |||
44 | enum { | 44 | enum { |
45 | NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ | 45 | NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ |
46 | NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ | 46 | NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ |
47 | NFS_LAYOUT_STATEID_SET, /* have a valid layout stateid */ | ||
48 | }; | 47 | }; |
49 | 48 | ||
50 | /* Per-layout driver specific registration structure */ | 49 | /* Per-layout driver specific registration structure */ |
@@ -63,7 +62,6 @@ struct pnfs_layout_hdr { | |||
63 | unsigned long plh_refcount; | 62 | unsigned long plh_refcount; |
64 | struct list_head plh_layouts; /* other client layouts */ | 63 | struct list_head plh_layouts; /* other client layouts */ |
65 | struct list_head plh_segs; /* layout segments list */ | 64 | struct list_head plh_segs; /* layout segments list */ |
66 | seqlock_t plh_seqlock; /* Protects the stateid */ | ||
67 | nfs4_stateid plh_stateid; | 65 | nfs4_stateid plh_stateid; |
68 | unsigned long plh_flags; | 66 | unsigned long plh_flags; |
69 | struct inode *plh_inode; | 67 | struct inode *plh_inode; |
@@ -143,8 +141,9 @@ int pnfs_layout_process(struct nfs4_layoutget *lgp); | |||
143 | void pnfs_destroy_layout(struct nfs_inode *); | 141 | void pnfs_destroy_layout(struct nfs_inode *); |
144 | void pnfs_destroy_all_layouts(struct nfs_client *); | 142 | void pnfs_destroy_all_layouts(struct nfs_client *); |
145 | void put_layout_hdr(struct inode *inode); | 143 | void put_layout_hdr(struct inode *inode); |
146 | void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_hdr *lo, | 144 | int pnfs_choose_layoutget_stateid(nfs4_stateid *dst, |
147 | struct nfs4_state *open_state); | 145 | struct pnfs_layout_hdr *lo, |
146 | struct nfs4_state *open_state); | ||
148 | 147 | ||
149 | 148 | ||
150 | static inline int lo_fail_bit(u32 iomode) | 149 | static inline int lo_fail_bit(u32 iomode) |