aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2011-01-06 06:36:21 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-01-06 14:46:31 -0500
commitb7edfaa1983362842351e425adeb8e297b4c11fb (patch)
treeb0c05e48ecc4d14a72a7e4b704c27a1080d745fb /fs/nfs
parent566052c53b5146e23a99ab95fb5c11f8a295a084 (diff)
pnfs: add prefix to struct pnfs_layout_hdr fields
Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4filelayout.c6
-rw-r--r--fs/nfs/pnfs.c94
-rw-r--r--fs/nfs/pnfs.h12
3 files changed, 56 insertions, 56 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 738d6a4e77fe..23f930caf1e2 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -82,7 +82,7 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo,
82{ 82{
83 struct nfs4_file_layout_dsaddr *dsaddr; 83 struct nfs4_file_layout_dsaddr *dsaddr;
84 int status = -EINVAL; 84 int status = -EINVAL;
85 struct nfs_server *nfss = NFS_SERVER(lo->inode); 85 struct nfs_server *nfss = NFS_SERVER(lo->plh_inode);
86 86
87 dprintk("--> %s\n", __func__); 87 dprintk("--> %s\n", __func__);
88 88
@@ -101,7 +101,7 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo,
101 /* find and reference the deviceid */ 101 /* find and reference the deviceid */
102 dsaddr = nfs4_fl_find_get_deviceid(nfss->nfs_client, id); 102 dsaddr = nfs4_fl_find_get_deviceid(nfss->nfs_client, id);
103 if (dsaddr == NULL) { 103 if (dsaddr == NULL) {
104 dsaddr = get_device_info(lo->inode, id); 104 dsaddr = get_device_info(lo->plh_inode, id);
105 if (dsaddr == NULL) 105 if (dsaddr == NULL)
106 goto out; 106 goto out;
107 } 107 }
@@ -243,7 +243,7 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
243static void 243static void
244filelayout_free_lseg(struct pnfs_layout_segment *lseg) 244filelayout_free_lseg(struct pnfs_layout_segment *lseg)
245{ 245{
246 struct nfs_server *nfss = NFS_SERVER(lseg->pls_layout->inode); 246 struct nfs_server *nfss = NFS_SERVER(lseg->pls_layout->plh_inode);
247 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); 247 struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
248 248
249 dprintk("--> %s\n", __func__); 249 dprintk("--> %s\n", __func__);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index c3ca5fe1f3bd..6736f9e4f2e1 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -180,21 +180,21 @@ EXPORT_SYMBOL_GPL(pnfs_unregister_layoutdriver);
180static void 180static void
181get_layout_hdr_locked(struct pnfs_layout_hdr *lo) 181get_layout_hdr_locked(struct pnfs_layout_hdr *lo)
182{ 182{
183 assert_spin_locked(&lo->inode->i_lock); 183 assert_spin_locked(&lo->plh_inode->i_lock);
184 lo->refcount++; 184 lo->plh_refcount++;
185} 185}
186 186
187static void 187static void
188put_layout_hdr_locked(struct pnfs_layout_hdr *lo) 188put_layout_hdr_locked(struct pnfs_layout_hdr *lo)
189{ 189{
190 assert_spin_locked(&lo->inode->i_lock); 190 assert_spin_locked(&lo->plh_inode->i_lock);
191 BUG_ON(lo->refcount == 0); 191 BUG_ON(lo->plh_refcount == 0);
192 192
193 lo->refcount--; 193 lo->plh_refcount--;
194 if (!lo->refcount) { 194 if (!lo->plh_refcount) {
195 dprintk("%s: freeing layout cache %p\n", __func__, lo); 195 dprintk("%s: freeing layout cache %p\n", __func__, lo);
196 BUG_ON(!list_empty(&lo->layouts)); 196 BUG_ON(!list_empty(&lo->plh_layouts));
197 NFS_I(lo->inode)->layout = NULL; 197 NFS_I(lo->plh_inode)->layout = NULL;
198 kfree(lo); 198 kfree(lo);
199 } 199 }
200} 200}
@@ -221,7 +221,7 @@ destroy_lseg(struct kref *kref)
221{ 221{
222 struct pnfs_layout_segment *lseg = 222 struct pnfs_layout_segment *lseg =
223 container_of(kref, struct pnfs_layout_segment, pls_refcount); 223 container_of(kref, struct pnfs_layout_segment, pls_refcount);
224 struct inode *ino = lseg->pls_layout->inode; 224 struct inode *ino = lseg->pls_layout->plh_inode;
225 225
226 dprintk("--> %s\n", __func__); 226 dprintk("--> %s\n", __func__);
227 NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); 227 NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
@@ -248,19 +248,19 @@ pnfs_clear_lseg_list(struct pnfs_layout_hdr *lo, struct list_head *tmp_list)
248 248
249 dprintk("%s:Begin lo %p\n", __func__, lo); 249 dprintk("%s:Begin lo %p\n", __func__, lo);
250 250
251 assert_spin_locked(&lo->inode->i_lock); 251 assert_spin_locked(&lo->plh_inode->i_lock);
252 list_for_each_entry_safe(lseg, next, &lo->segs, pls_list) { 252 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) {
253 dprintk("%s: freeing lseg %p\n", __func__, lseg); 253 dprintk("%s: freeing lseg %p\n", __func__, lseg);
254 list_move(&lseg->pls_list, tmp_list); 254 list_move(&lseg->pls_list, tmp_list);
255 } 255 }
256 clp = NFS_SERVER(lo->inode)->nfs_client; 256 clp = NFS_SERVER(lo->plh_inode)->nfs_client;
257 spin_lock(&clp->cl_lock); 257 spin_lock(&clp->cl_lock);
258 /* List does not take a reference, so no need for put here */ 258 /* List does not take a reference, so no need for put here */
259 list_del_init(&lo->layouts); 259 list_del_init(&lo->plh_layouts);
260 spin_unlock(&clp->cl_lock); 260 spin_unlock(&clp->cl_lock);
261 write_seqlock(&lo->seqlock); 261 write_seqlock(&lo->plh_seqlock);
262 clear_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags); 262 clear_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags);
263 write_sequnlock(&lo->seqlock); 263 write_sequnlock(&lo->plh_seqlock);
264 264
265 dprintk("%s:Return\n", __func__); 265 dprintk("%s:Return\n", __func__);
266} 266}
@@ -312,25 +312,25 @@ pnfs_destroy_all_layouts(struct nfs_client *clp)
312 312
313 while (!list_empty(&tmp_list)) { 313 while (!list_empty(&tmp_list)) {
314 lo = list_entry(tmp_list.next, struct pnfs_layout_hdr, 314 lo = list_entry(tmp_list.next, struct pnfs_layout_hdr,
315 layouts); 315 plh_layouts);
316 dprintk("%s freeing layout for inode %lu\n", __func__, 316 dprintk("%s freeing layout for inode %lu\n", __func__,
317 lo->inode->i_ino); 317 lo->plh_inode->i_ino);
318 pnfs_destroy_layout(NFS_I(lo->inode)); 318 pnfs_destroy_layout(NFS_I(lo->plh_inode));
319 } 319 }
320} 320}
321 321
322/* update lo->stateid with new if is more recent 322/* update lo->plh_stateid with new if is more recent
323 * 323 *
324 * lo->stateid could be the open stateid, in which case we just use what given. 324 * lo->plh_stateid could be the open stateid, in which case we just use what given.
325 */ 325 */
326static void 326static void
327pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, 327pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo,
328 const nfs4_stateid *new) 328 const nfs4_stateid *new)
329{ 329{
330 nfs4_stateid *old = &lo->stateid; 330 nfs4_stateid *old = &lo->plh_stateid;
331 bool overwrite = false; 331 bool overwrite = false;
332 332
333 write_seqlock(&lo->seqlock); 333 write_seqlock(&lo->plh_seqlock);
334 if (!test_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags) || 334 if (!test_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags) ||
335 memcmp(old->stateid.other, new->stateid.other, sizeof(new->stateid.other))) 335 memcmp(old->stateid.other, new->stateid.other, sizeof(new->stateid.other)))
336 overwrite = true; 336 overwrite = true;
@@ -344,7 +344,7 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo,
344 } 344 }
345 if (overwrite) 345 if (overwrite)
346 memcpy(&old->stateid, &new->stateid, sizeof(new->stateid)); 346 memcpy(&old->stateid, &new->stateid, sizeof(new->stateid));
347 write_sequnlock(&lo->seqlock); 347 write_sequnlock(&lo->plh_seqlock);
348} 348}
349 349
350static void 350static void
@@ -354,14 +354,14 @@ pnfs_layout_from_open_stateid(struct pnfs_layout_hdr *lo,
354 int seq; 354 int seq;
355 355
356 dprintk("--> %s\n", __func__); 356 dprintk("--> %s\n", __func__);
357 write_seqlock(&lo->seqlock); 357 write_seqlock(&lo->plh_seqlock);
358 do { 358 do {
359 seq = read_seqbegin(&state->seqlock); 359 seq = read_seqbegin(&state->seqlock);
360 memcpy(lo->stateid.data, state->stateid.data, 360 memcpy(lo->plh_stateid.data, state->stateid.data,
361 sizeof(state->stateid.data)); 361 sizeof(state->stateid.data));
362 } while (read_seqretry(&state->seqlock, seq)); 362 } while (read_seqretry(&state->seqlock, seq));
363 set_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags); 363 set_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags);
364 write_sequnlock(&lo->seqlock); 364 write_sequnlock(&lo->plh_seqlock);
365 dprintk("<-- %s\n", __func__); 365 dprintk("<-- %s\n", __func__);
366} 366}
367 367
@@ -373,14 +373,14 @@ pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_hdr *lo,
373 373
374 dprintk("--> %s\n", __func__); 374 dprintk("--> %s\n", __func__);
375 do { 375 do {
376 seq = read_seqbegin(&lo->seqlock); 376 seq = read_seqbegin(&lo->plh_seqlock);
377 if (!test_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags)) { 377 if (!test_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags)) {
378 /* This will trigger retry of the read */ 378 /* This will trigger retry of the read */
379 pnfs_layout_from_open_stateid(lo, open_state); 379 pnfs_layout_from_open_stateid(lo, open_state);
380 } else 380 } else
381 memcpy(dst->data, lo->stateid.data, 381 memcpy(dst->data, lo->plh_stateid.data,
382 sizeof(lo->stateid.data)); 382 sizeof(lo->plh_stateid.data));
383 } while (read_seqretry(&lo->seqlock, seq)); 383 } while (read_seqretry(&lo->plh_seqlock, seq));
384 dprintk("<-- %s\n", __func__); 384 dprintk("<-- %s\n", __func__);
385} 385}
386 386
@@ -395,7 +395,7 @@ send_layoutget(struct pnfs_layout_hdr *lo,
395 struct nfs_open_context *ctx, 395 struct nfs_open_context *ctx,
396 u32 iomode) 396 u32 iomode)
397{ 397{
398 struct inode *ino = lo->inode; 398 struct inode *ino = lo->plh_inode;
399 struct nfs_server *server = NFS_SERVER(ino); 399 struct nfs_server *server = NFS_SERVER(ino);
400 struct nfs4_layoutget *lgp; 400 struct nfs4_layoutget *lgp;
401 struct pnfs_layout_segment *lseg = NULL; 401 struct pnfs_layout_segment *lseg = NULL;
@@ -405,7 +405,7 @@ send_layoutget(struct pnfs_layout_hdr *lo,
405 BUG_ON(ctx == NULL); 405 BUG_ON(ctx == NULL);
406 lgp = kzalloc(sizeof(*lgp), GFP_KERNEL); 406 lgp = kzalloc(sizeof(*lgp), GFP_KERNEL);
407 if (lgp == NULL) { 407 if (lgp == NULL) {
408 put_layout_hdr(lo->inode); 408 put_layout_hdr(lo->plh_inode);
409 return NULL; 409 return NULL;
410 } 410 }
411 lgp->args.minlength = NFS4_MAX_UINT64; 411 lgp->args.minlength = NFS4_MAX_UINT64;
@@ -450,16 +450,16 @@ pnfs_insert_layout(struct pnfs_layout_hdr *lo,
450 450
451 dprintk("%s:Begin\n", __func__); 451 dprintk("%s:Begin\n", __func__);
452 452
453 assert_spin_locked(&lo->inode->i_lock); 453 assert_spin_locked(&lo->plh_inode->i_lock);
454 if (list_empty(&lo->segs)) { 454 if (list_empty(&lo->plh_segs)) {
455 struct nfs_client *clp = NFS_SERVER(lo->inode)->nfs_client; 455 struct nfs_client *clp = NFS_SERVER(lo->plh_inode)->nfs_client;
456 456
457 spin_lock(&clp->cl_lock); 457 spin_lock(&clp->cl_lock);
458 BUG_ON(!list_empty(&lo->layouts)); 458 BUG_ON(!list_empty(&lo->plh_layouts));
459 list_add_tail(&lo->layouts, &clp->cl_layouts); 459 list_add_tail(&lo->plh_layouts, &clp->cl_layouts);
460 spin_unlock(&clp->cl_lock); 460 spin_unlock(&clp->cl_lock);
461 } 461 }
462 list_for_each_entry(lp, &lo->segs, pls_list) { 462 list_for_each_entry(lp, &lo->plh_segs, pls_list) {
463 if (cmp_layout(lp->pls_range.iomode, lseg->pls_range.iomode) > 0) 463 if (cmp_layout(lp->pls_range.iomode, lseg->pls_range.iomode) > 0)
464 continue; 464 continue;
465 list_add_tail(&lseg->pls_list, &lp->pls_list); 465 list_add_tail(&lseg->pls_list, &lp->pls_list);
@@ -474,7 +474,7 @@ pnfs_insert_layout(struct pnfs_layout_hdr *lo,
474 break; 474 break;
475 } 475 }
476 if (!found) { 476 if (!found) {
477 list_add_tail(&lseg->pls_list, &lo->segs); 477 list_add_tail(&lseg->pls_list, &lo->plh_segs);
478 dprintk("%s: inserted lseg %p " 478 dprintk("%s: inserted lseg %p "
479 "iomode %d offset %llu length %llu at tail\n", 479 "iomode %d offset %llu length %llu at tail\n",
480 __func__, lseg, lseg->pls_range.iomode, 480 __func__, lseg, lseg->pls_range.iomode,
@@ -493,11 +493,11 @@ alloc_init_layout_hdr(struct inode *ino)
493 lo = kzalloc(sizeof(struct pnfs_layout_hdr), GFP_KERNEL); 493 lo = kzalloc(sizeof(struct pnfs_layout_hdr), GFP_KERNEL);
494 if (!lo) 494 if (!lo)
495 return NULL; 495 return NULL;
496 lo->refcount = 1; 496 lo->plh_refcount = 1;
497 INIT_LIST_HEAD(&lo->layouts); 497 INIT_LIST_HEAD(&lo->plh_layouts);
498 INIT_LIST_HEAD(&lo->segs); 498 INIT_LIST_HEAD(&lo->plh_segs);
499 seqlock_init(&lo->seqlock); 499 seqlock_init(&lo->plh_seqlock);
500 lo->inode = ino; 500 lo->plh_inode = ino;
501 return lo; 501 return lo;
502} 502}
503 503
@@ -551,8 +551,8 @@ pnfs_has_layout(struct pnfs_layout_hdr *lo, u32 iomode)
551 551
552 dprintk("%s:Begin\n", __func__); 552 dprintk("%s:Begin\n", __func__);
553 553
554 assert_spin_locked(&lo->inode->i_lock); 554 assert_spin_locked(&lo->plh_inode->i_lock);
555 list_for_each_entry(lseg, &lo->segs, pls_list) { 555 list_for_each_entry(lseg, &lo->plh_segs, pls_list) {
556 if (is_matching_lseg(lseg, iomode)) { 556 if (is_matching_lseg(lseg, iomode)) {
557 ret = lseg; 557 ret = lseg;
558 break; 558 break;
@@ -619,7 +619,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
619 struct pnfs_layout_hdr *lo = NFS_I(lgp->args.inode)->layout; 619 struct pnfs_layout_hdr *lo = NFS_I(lgp->args.inode)->layout;
620 struct nfs4_layoutget_res *res = &lgp->res; 620 struct nfs4_layoutget_res *res = &lgp->res;
621 struct pnfs_layout_segment *lseg; 621 struct pnfs_layout_segment *lseg;
622 struct inode *ino = lo->inode; 622 struct inode *ino = lo->plh_inode;
623 int status = 0; 623 int status = 0;
624 624
625 /* Inject layout blob into I/O device driver */ 625 /* Inject layout blob into I/O device driver */
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 6fcc07353004..c2f108640fc4 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -60,13 +60,13 @@ struct pnfs_layoutdriver_type {
60}; 60};
61 61
62struct pnfs_layout_hdr { 62struct pnfs_layout_hdr {
63 unsigned long refcount; 63 unsigned long plh_refcount;
64 struct list_head layouts; /* other client layouts */ 64 struct list_head plh_layouts; /* other client layouts */
65 struct list_head segs; /* layout segments list */ 65 struct list_head plh_segs; /* layout segments list */
66 seqlock_t seqlock; /* Protects the stateid */ 66 seqlock_t plh_seqlock; /* Protects the stateid */
67 nfs4_stateid stateid; 67 nfs4_stateid plh_stateid;
68 unsigned long plh_flags; 68 unsigned long plh_flags;
69 struct inode *inode; 69 struct inode *plh_inode;
70}; 70};
71 71
72struct pnfs_device { 72struct pnfs_device {