aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2011-05-22 12:48:02 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2011-05-29 13:52:34 -0400
commit778b5502fdba5b183553f3f2ef1672ba78ac58b6 (patch)
treedc37bf3b4f9cdfab7ee16a2b776b6ea2d7653210 /fs/nfs
parent707ed5fdb587c71fdb7ad224ba1d80231f33c974 (diff)
pnfs: Use byte-range for cb_layoutrecall
Use recalled range to invalidate particular layout segments in the layout cache. Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/callback_proc.c4
-rw-r--r--fs/nfs/pnfs.c15
-rw-r--r--fs/nfs/pnfs.h2
3 files changed, 12 insertions, 9 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index c73e7b2fb8e2..d4d1954e9bb9 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -139,7 +139,7 @@ static u32 initiate_file_draining(struct nfs_client *clp,
139 spin_lock(&ino->i_lock); 139 spin_lock(&ino->i_lock);
140 if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) || 140 if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
141 mark_matching_lsegs_invalid(lo, &free_me_list, 141 mark_matching_lsegs_invalid(lo, &free_me_list,
142 args->cbl_range.iomode)) 142 &args->cbl_range))
143 rv = NFS4ERR_DELAY; 143 rv = NFS4ERR_DELAY;
144 else 144 else
145 rv = NFS4ERR_NOMATCHING_LAYOUT; 145 rv = NFS4ERR_NOMATCHING_LAYOUT;
@@ -184,7 +184,7 @@ static u32 initiate_bulk_draining(struct nfs_client *clp,
184 ino = lo->plh_inode; 184 ino = lo->plh_inode;
185 spin_lock(&ino->i_lock); 185 spin_lock(&ino->i_lock);
186 set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); 186 set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);
187 if (mark_matching_lsegs_invalid(lo, &free_me_list, range.iomode)) 187 if (mark_matching_lsegs_invalid(lo, &free_me_list, &range))
188 rv = NFS4ERR_DELAY; 188 rv = NFS4ERR_DELAY;
189 list_del_init(&lo->plh_bulk_recall); 189 list_del_init(&lo->plh_bulk_recall);
190 spin_unlock(&ino->i_lock); 190 spin_unlock(&ino->i_lock);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 2357ee343f4a..20436a5e76cd 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -321,10 +321,12 @@ lo_seg_intersecting(struct pnfs_layout_range *l1,
321} 321}
322 322
323static bool 323static bool
324should_free_lseg(u32 lseg_iomode, u32 recall_iomode) 324should_free_lseg(struct pnfs_layout_range *lseg_range,
325 struct pnfs_layout_range *recall_range)
325{ 326{
326 return (recall_iomode == IOMODE_ANY || 327 return (recall_range->iomode == IOMODE_ANY ||
327 lseg_iomode == recall_iomode); 328 lseg_range->iomode == recall_range->iomode) &&
329 lo_seg_intersecting(lseg_range, recall_range);
328} 330}
329 331
330/* Returns 1 if lseg is removed from list, 0 otherwise */ 332/* Returns 1 if lseg is removed from list, 0 otherwise */
@@ -355,7 +357,7 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg,
355int 357int
356mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, 358mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
357 struct list_head *tmp_list, 359 struct list_head *tmp_list,
358 u32 iomode) 360 struct pnfs_layout_range *recall_range)
359{ 361{
360 struct pnfs_layout_segment *lseg, *next; 362 struct pnfs_layout_segment *lseg, *next;
361 int invalid = 0, removed = 0; 363 int invalid = 0, removed = 0;
@@ -368,7 +370,8 @@ mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
368 return 0; 370 return 0;
369 } 371 }
370 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) 372 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
371 if (should_free_lseg(lseg->pls_range.iomode, iomode)) { 373 if (!recall_range ||
374 should_free_lseg(&lseg->pls_range, recall_range)) {
372 dprintk("%s: freeing lseg %p iomode %d " 375 dprintk("%s: freeing lseg %p iomode %d "
373 "offset %llu length %llu\n", __func__, 376 "offset %llu length %llu\n", __func__,
374 lseg, lseg->pls_range.iomode, lseg->pls_range.offset, 377 lseg, lseg->pls_range.iomode, lseg->pls_range.offset,
@@ -417,7 +420,7 @@ pnfs_destroy_layout(struct nfs_inode *nfsi)
417 lo = nfsi->layout; 420 lo = nfsi->layout;
418 if (lo) { 421 if (lo) {
419 lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */ 422 lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */
420 mark_matching_lsegs_invalid(lo, &tmp_list, IOMODE_ANY); 423 mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
421 } 424 }
422 spin_unlock(&nfsi->vfs_inode.i_lock); 425 spin_unlock(&nfsi->vfs_inode.i_lock);
423 pnfs_free_lseg_list(&tmp_list); 426 pnfs_free_lseg_list(&tmp_list);
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 78f8a4a171b3..f37ab3539cbf 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -154,7 +154,7 @@ int pnfs_choose_layoutget_stateid(nfs4_stateid *dst,
154 struct nfs4_state *open_state); 154 struct nfs4_state *open_state);
155int mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, 155int mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
156 struct list_head *tmp_list, 156 struct list_head *tmp_list,
157 u32 iomode); 157 struct pnfs_layout_range *recall_range);
158bool pnfs_roc(struct inode *ino); 158bool pnfs_roc(struct inode *ino);
159void pnfs_roc_release(struct inode *ino); 159void pnfs_roc_release(struct inode *ino);
160void pnfs_roc_set_barrier(struct inode *ino, u32 barrier); 160void pnfs_roc_set_barrier(struct inode *ino, u32 barrier);