@@ -152,7 +152,7 @@ void pnfs_clear_device_notify(struct nfs4_client *clp)
{
struct nfs4_layout_state *new;
- new = kmem_cache_alloc(layout_state_slab, GFP_KERNEL);
+ new = layoutstateid(nfs4_alloc_stid(clp, layout_state_slab));
if (!new)
return new;
kref_init(&new->ls_ref);
@@ -302,7 +302,7 @@ void nfsd4_init_stid(struct nfs4_stid *stid, struct nfs4_client *cl, unsigned ch
s->si_generation = 0;
}
-static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab)
+struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab)
{
struct idr *stateids = &cl->cl_stateids;
@@ -42,8 +42,8 @@
/* outstanding layout stateid */
struct nfs4_layout_state {
+ struct nfs4_stid ls_stid; /* must be first field */
struct kref ls_ref;
- struct nfs4_stid ls_stid;
struct list_head ls_perfile;
bool ls_roc;
};
@@ -134,6 +134,11 @@ int nfsd_device_notify_cb(struct super_block *,
void pnfs_set_device_notify(clientid_t *, unsigned int types);
void pnfs_clear_device_notify(struct nfs4_client *);
+static inline struct nfs4_layout_state *layoutstateid(struct nfs4_stid *s)
+{
+ return container_of(s, struct nfs4_layout_state, ls_stid);
+}
+
#if defined(CONFIG_PNFSD_LOCAL_EXPORT)
extern struct sockaddr_storage pnfsd_lexp_addr;
extern size_t pnfs_lexp_addr_len;
@@ -507,6 +507,7 @@ extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
extern void put_nfs4_file(struct nfs4_file *);
extern void get_nfs4_file(struct nfs4_file *);
extern struct nfs4_client *find_confirmed_client(clientid_t *);
+extern struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab);
extern void nfsd4_init_stid(struct nfs4_stid *, struct nfs4_client *, unsigned char type);
extern void nfsd4_unhash_stid(struct nfs4_stid *);
extern struct nfs4_stid *find_stateid(struct nfs4_client *, stateid_t *);