|
@@ -321,10 +321,12 @@ lo_seg_intersecting(struct pnfs_layout_range *l1,
|
|
}
|
|
}
|
|
|
|
|
|
static bool
|
|
static bool
|
|
-should_free_lseg(u32 lseg_iomode, u32 recall_iomode)
|
|
|
|
|
|
+should_free_lseg(struct pnfs_layout_range *lseg_range,
|
|
|
|
+ struct pnfs_layout_range *recall_range)
|
|
{
|
|
{
|
|
- return (recall_iomode == IOMODE_ANY ||
|
|
|
|
- lseg_iomode == recall_iomode);
|
|
|
|
|
|
+ return (recall_range->iomode == IOMODE_ANY ||
|
|
|
|
+ lseg_range->iomode == recall_range->iomode) &&
|
|
|
|
+ lo_seg_intersecting(lseg_range, recall_range);
|
|
}
|
|
}
|
|
|
|
|
|
/* Returns 1 if lseg is removed from list, 0 otherwise */
|
|
/* Returns 1 if lseg is removed from list, 0 otherwise */
|
|
@@ -355,7 +357,7 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg,
|
|
int
|
|
int
|
|
mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
|
|
mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
|
|
struct list_head *tmp_list,
|
|
struct list_head *tmp_list,
|
|
- u32 iomode)
|
|
|
|
|
|
+ struct pnfs_layout_range *recall_range)
|
|
{
|
|
{
|
|
struct pnfs_layout_segment *lseg, *next;
|
|
struct pnfs_layout_segment *lseg, *next;
|
|
int invalid = 0, removed = 0;
|
|
int invalid = 0, removed = 0;
|
|
@@ -368,7 +370,8 @@ mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
|
|
list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
|
|
- if (should_free_lseg(lseg->pls_range.iomode, iomode)) {
|
|
|
|
|
|
+ if (!recall_range ||
|
|
|
|
+ should_free_lseg(&lseg->pls_range, recall_range)) {
|
|
dprintk("%s: freeing lseg %p iomode %d "
|
|
dprintk("%s: freeing lseg %p iomode %d "
|
|
"offset %llu length %llu\n", __func__,
|
|
"offset %llu length %llu\n", __func__,
|
|
lseg, lseg->pls_range.iomode, lseg->pls_range.offset,
|
|
lseg, lseg->pls_range.iomode, lseg->pls_range.offset,
|
|
@@ -417,7 +420,7 @@ pnfs_destroy_layout(struct nfs_inode *nfsi)
|
|
lo = nfsi->layout;
|
|
lo = nfsi->layout;
|
|
if (lo) {
|
|
if (lo) {
|
|
lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */
|
|
lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */
|
|
- mark_matching_lsegs_invalid(lo, &tmp_list, IOMODE_ANY);
|
|
|
|
|
|
+ mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
|
|
}
|
|
}
|
|
spin_unlock(&nfsi->vfs_inode.i_lock);
|
|
spin_unlock(&nfsi->vfs_inode.i_lock);
|
|
pnfs_free_lseg_list(&tmp_list);
|
|
pnfs_free_lseg_list(&tmp_list);
|