Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Benny Halevy and committed by
Boaz Harrosh
778b5502 707ed5fd

+12 -9
+2 -2
fs/nfs/callback_proc.c
··· 139 139 spin_lock(&ino->i_lock); 140 140 if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) || 141 141 mark_matching_lsegs_invalid(lo, &free_me_list, 142 - args->cbl_range.iomode)) 142 + &args->cbl_range)) 143 143 rv = NFS4ERR_DELAY; 144 144 else 145 145 rv = NFS4ERR_NOMATCHING_LAYOUT; ··· 184 184 ino = lo->plh_inode; 185 185 spin_lock(&ino->i_lock); 186 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 188 rv = NFS4ERR_DELAY; 189 189 list_del_init(&lo->plh_bulk_recall); 190 190 spin_unlock(&ino->i_lock);
+9 -6
fs/nfs/pnfs.c
··· 321 321 } 322 322 323 323 static bool 324 - should_free_lseg(u32 lseg_iomode, u32 recall_iomode) 324 + should_free_lseg(struct pnfs_layout_range *lseg_range, 325 + struct pnfs_layout_range *recall_range) 325 326 { 326 - return (recall_iomode == IOMODE_ANY || 327 - lseg_iomode == recall_iomode); 327 + return (recall_range->iomode == IOMODE_ANY || 328 + lseg_range->iomode == recall_range->iomode) && 329 + lo_seg_intersecting(lseg_range, recall_range); 328 330 } 329 331 330 332 /* Returns 1 if lseg is removed from list, 0 otherwise */ ··· 357 355 int 358 356 mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, 359 357 struct list_head *tmp_list, 360 - u32 iomode) 358 + struct pnfs_layout_range *recall_range) 361 359 { 362 360 struct pnfs_layout_segment *lseg, *next; 363 361 int invalid = 0, removed = 0; ··· 370 368 return 0; 371 369 } 372 370 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) 373 - if (should_free_lseg(lseg->pls_range.iomode, iomode)) { 371 + if (!recall_range || 372 + should_free_lseg(&lseg->pls_range, recall_range)) { 374 373 dprintk("%s: freeing lseg %p iomode %d " 375 374 "offset %llu length %llu\n", __func__, 376 375 lseg, lseg->pls_range.iomode, lseg->pls_range.offset, ··· 420 417 lo = nfsi->layout; 421 418 if (lo) { 422 419 lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */ 423 - mark_matching_lsegs_invalid(lo, &tmp_list, IOMODE_ANY); 420 + mark_matching_lsegs_invalid(lo, &tmp_list, NULL); 424 421 } 425 422 spin_unlock(&nfsi->vfs_inode.i_lock); 426 423 pnfs_free_lseg_list(&tmp_list);
+1 -1
fs/nfs/pnfs.h
··· 154 154 struct nfs4_state *open_state); 155 155 int mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, 156 156 struct list_head *tmp_list, 157 - u32 iomode); 157 + struct pnfs_layout_range *recall_range); 158 158 bool pnfs_roc(struct inode *ino); 159 159 void pnfs_roc_release(struct inode *ino); 160 160 void pnfs_roc_set_barrier(struct inode *ino, u32 barrier);