提交 7dc0ac70 编写于 作者: T Trond Myklebust

NFSv4.1: Clean up layout segment comparison helper names

Give them names that are a bit more consistent with the general
pNFS naming scheme.

 - lo_seg_contained -> pnfs_lseg_range_contained
 - lo_seg_intersecting -> pnfs_lseg_range_intersecting
 - cmp_layout -> pnfs_lseg_range_cmp
 - is_matching_lseg -> pnfs_lseg_range_match
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 3cb2df17
...@@ -377,7 +377,7 @@ end_offset(u64 start, u64 len) ...@@ -377,7 +377,7 @@ end_offset(u64 start, u64 len)
* [----------------) * [----------------)
*/ */
static bool static bool
lo_seg_contained(const struct pnfs_layout_range *l1, pnfs_lseg_range_contained(const struct pnfs_layout_range *l1,
const struct pnfs_layout_range *l2) const struct pnfs_layout_range *l2)
{ {
u64 start1 = l1->offset; u64 start1 = l1->offset;
...@@ -396,7 +396,7 @@ lo_seg_contained(const struct pnfs_layout_range *l1, ...@@ -396,7 +396,7 @@ lo_seg_contained(const struct pnfs_layout_range *l1,
* [----------------) * [----------------)
*/ */
static bool static bool
lo_seg_intersecting(const struct pnfs_layout_range *l1, pnfs_lseg_range_intersecting(const struct pnfs_layout_range *l1,
const struct pnfs_layout_range *l2) const struct pnfs_layout_range *l2)
{ {
u64 start1 = l1->offset; u64 start1 = l1->offset;
...@@ -414,7 +414,7 @@ should_free_lseg(const struct pnfs_layout_range *lseg_range, ...@@ -414,7 +414,7 @@ should_free_lseg(const struct pnfs_layout_range *lseg_range,
{ {
return (recall_range->iomode == IOMODE_ANY || return (recall_range->iomode == IOMODE_ANY ||
lseg_range->iomode == recall_range->iomode) && lseg_range->iomode == recall_range->iomode) &&
lo_seg_intersecting(lseg_range, recall_range); pnfs_lseg_range_intersecting(lseg_range, recall_range);
} }
static bool pnfs_lseg_dec_and_remove_zero(struct pnfs_layout_segment *lseg, static bool pnfs_lseg_dec_and_remove_zero(struct pnfs_layout_segment *lseg,
...@@ -986,7 +986,7 @@ bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task) ...@@ -986,7 +986,7 @@ bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task)
* are seen first. * are seen first.
*/ */
static s64 static s64
cmp_layout(const struct pnfs_layout_range *l1, pnfs_lseg_range_cmp(const struct pnfs_layout_range *l1,
const struct pnfs_layout_range *l2) const struct pnfs_layout_range *l2)
{ {
s64 d; s64 d;
...@@ -1014,7 +1014,7 @@ pnfs_layout_insert_lseg(struct pnfs_layout_hdr *lo, ...@@ -1014,7 +1014,7 @@ pnfs_layout_insert_lseg(struct pnfs_layout_hdr *lo,
dprintk("%s:Begin\n", __func__); dprintk("%s:Begin\n", __func__);
list_for_each_entry(lp, &lo->plh_segs, pls_list) { list_for_each_entry(lp, &lo->plh_segs, pls_list) {
if (cmp_layout(&lseg->pls_range, &lp->pls_range) > 0) if (pnfs_lseg_range_cmp(&lseg->pls_range, &lp->pls_range) > 0)
continue; continue;
list_add_tail(&lseg->pls_list, &lp->pls_list); list_add_tail(&lseg->pls_list, &lp->pls_list);
dprintk("%s: inserted lseg %p " dprintk("%s: inserted lseg %p "
...@@ -1094,20 +1094,20 @@ pnfs_find_alloc_layout(struct inode *ino, ...@@ -1094,20 +1094,20 @@ pnfs_find_alloc_layout(struct inode *ino,
* READ RW true * READ RW true
*/ */
static bool static bool
is_matching_lseg(const struct pnfs_layout_range *ls_range, pnfs_lseg_range_match(const struct pnfs_layout_range *ls_range,
const struct pnfs_layout_range *range) const struct pnfs_layout_range *range)
{ {
struct pnfs_layout_range range1; struct pnfs_layout_range range1;
if ((range->iomode == IOMODE_RW && if ((range->iomode == IOMODE_RW &&
ls_range->iomode != IOMODE_RW) || ls_range->iomode != IOMODE_RW) ||
!lo_seg_intersecting(ls_range, range)) !pnfs_lseg_range_intersecting(ls_range, range))
return 0; return 0;
/* range1 covers only the first byte in the range */ /* range1 covers only the first byte in the range */
range1 = *range; range1 = *range;
range1.length = 1; range1.length = 1;
return lo_seg_contained(ls_range, &range1); return pnfs_lseg_range_contained(ls_range, &range1);
} }
/* /*
...@@ -1123,7 +1123,7 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo, ...@@ -1123,7 +1123,7 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo,
list_for_each_entry(lseg, &lo->plh_segs, pls_list) { list_for_each_entry(lseg, &lo->plh_segs, pls_list) {
if (test_bit(NFS_LSEG_VALID, &lseg->pls_flags) && if (test_bit(NFS_LSEG_VALID, &lseg->pls_flags) &&
is_matching_lseg(&lseg->pls_range, range)) { pnfs_lseg_range_match(&lseg->pls_range, range)) {
ret = pnfs_get_lseg(lseg); ret = pnfs_get_lseg(lseg);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册