Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 229226
b: refs/heads/master
c: 566052c
h: refs/heads/master
v: v3
  • Loading branch information
Fred Isaman authored and Trond Myklebust committed Jan 6, 2011
1 parent e6b1a3c commit 92d03df
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: daaa82d1c72e10dc16cad3a810e225f9188dc7aa
refs/heads/master: 566052c53b5146e23a99ab95fb5c11f8a295a084
2 changes: 1 addition & 1 deletion trunk/fs/nfs/nfs4filelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
static void
filelayout_free_lseg(struct pnfs_layout_segment *lseg)
{
struct nfs_server *nfss = NFS_SERVER(lseg->layout->inode);
struct nfs_server *nfss = NFS_SERVER(lseg->pls_layout->inode);
struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);

dprintk("--> %s\n", __func__);
Expand Down
66 changes: 33 additions & 33 deletions trunk/fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,18 @@ put_layout_hdr(struct inode *inode)
static void
init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg)
{
INIT_LIST_HEAD(&lseg->fi_list);
kref_init(&lseg->kref);
lseg->layout = lo;
INIT_LIST_HEAD(&lseg->pls_list);
kref_init(&lseg->pls_refcount);
lseg->pls_layout = lo;
}

/* Called without i_lock held, as the free_lseg call may sleep */
static void
destroy_lseg(struct kref *kref)
{
struct pnfs_layout_segment *lseg =
container_of(kref, struct pnfs_layout_segment, kref);
struct inode *ino = lseg->layout->inode;
container_of(kref, struct pnfs_layout_segment, pls_refcount);
struct inode *ino = lseg->pls_layout->inode;

dprintk("--> %s\n", __func__);
NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg);
Expand All @@ -236,8 +236,8 @@ put_lseg(struct pnfs_layout_segment *lseg)
return;

dprintk("%s: lseg %p ref %d\n", __func__, lseg,
atomic_read(&lseg->kref.refcount));
kref_put(&lseg->kref, destroy_lseg);
atomic_read(&lseg->pls_refcount.refcount));
kref_put(&lseg->pls_refcount, destroy_lseg);
}

static void
Expand All @@ -249,17 +249,17 @@ pnfs_clear_lseg_list(struct pnfs_layout_hdr *lo, struct list_head *tmp_list)
dprintk("%s:Begin lo %p\n", __func__, lo);

assert_spin_locked(&lo->inode->i_lock);
list_for_each_entry_safe(lseg, next, &lo->segs, fi_list) {
list_for_each_entry_safe(lseg, next, &lo->segs, pls_list) {
dprintk("%s: freeing lseg %p\n", __func__, lseg);
list_move(&lseg->fi_list, tmp_list);
list_move(&lseg->pls_list, tmp_list);
}
clp = NFS_SERVER(lo->inode)->nfs_client;
spin_lock(&clp->cl_lock);
/* List does not take a reference, so no need for put here */
list_del_init(&lo->layouts);
spin_unlock(&clp->cl_lock);
write_seqlock(&lo->seqlock);
clear_bit(NFS_LAYOUT_STATEID_SET, &lo->state);
clear_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags);
write_sequnlock(&lo->seqlock);

dprintk("%s:Return\n", __func__);
Expand All @@ -272,9 +272,9 @@ pnfs_free_lseg_list(struct list_head *tmp_list)

while (!list_empty(tmp_list)) {
lseg = list_entry(tmp_list->next, struct pnfs_layout_segment,
fi_list);
pls_list);
dprintk("%s calling put_lseg on %p\n", __func__, lseg);
list_del(&lseg->fi_list);
list_del(&lseg->pls_list);
put_lseg(lseg);
}
}
Expand Down Expand Up @@ -331,7 +331,7 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo,
bool overwrite = false;

write_seqlock(&lo->seqlock);
if (!test_bit(NFS_LAYOUT_STATEID_SET, &lo->state) ||
if (!test_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags) ||
memcmp(old->stateid.other, new->stateid.other, sizeof(new->stateid.other)))
overwrite = true;
else {
Expand Down Expand Up @@ -360,7 +360,7 @@ pnfs_layout_from_open_stateid(struct pnfs_layout_hdr *lo,
memcpy(lo->stateid.data, state->stateid.data,
sizeof(state->stateid.data));
} while (read_seqretry(&state->seqlock, seq));
set_bit(NFS_LAYOUT_STATEID_SET, &lo->state);
set_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags);
write_sequnlock(&lo->seqlock);
dprintk("<-- %s\n", __func__);
}
Expand All @@ -374,7 +374,7 @@ pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_hdr *lo,
dprintk("--> %s\n", __func__);
do {
seq = read_seqbegin(&lo->seqlock);
if (!test_bit(NFS_LAYOUT_STATEID_SET, &lo->state)) {
if (!test_bit(NFS_LAYOUT_STATEID_SET, &lo->plh_flags)) {
/* This will trigger retry of the read */
pnfs_layout_from_open_stateid(lo, open_state);
} else
Expand Down Expand Up @@ -424,7 +424,7 @@ send_layoutget(struct pnfs_layout_hdr *lo,
nfs4_proc_layoutget(lgp);
if (!lseg) {
/* remember that LAYOUTGET failed and suspend trying */
set_bit(lo_fail_bit(iomode), &lo->state);
set_bit(lo_fail_bit(iomode), &lo->plh_flags);
}
return lseg;
}
Expand Down Expand Up @@ -459,26 +459,26 @@ pnfs_insert_layout(struct pnfs_layout_hdr *lo,
list_add_tail(&lo->layouts, &clp->cl_layouts);
spin_unlock(&clp->cl_lock);
}
list_for_each_entry(lp, &lo->segs, fi_list) {
if (cmp_layout(lp->range.iomode, lseg->range.iomode) > 0)
list_for_each_entry(lp, &lo->segs, pls_list) {
if (cmp_layout(lp->pls_range.iomode, lseg->pls_range.iomode) > 0)
continue;
list_add_tail(&lseg->fi_list, &lp->fi_list);
list_add_tail(&lseg->pls_list, &lp->pls_list);
dprintk("%s: inserted lseg %p "
"iomode %d offset %llu length %llu before "
"lp %p iomode %d offset %llu length %llu\n",
__func__, lseg, lseg->range.iomode,
lseg->range.offset, lseg->range.length,
lp, lp->range.iomode, lp->range.offset,
lp->range.length);
__func__, lseg, lseg->pls_range.iomode,
lseg->pls_range.offset, lseg->pls_range.length,
lp, lp->pls_range.iomode, lp->pls_range.offset,
lp->pls_range.length);
found = 1;
break;
}
if (!found) {
list_add_tail(&lseg->fi_list, &lo->segs);
list_add_tail(&lseg->pls_list, &lo->segs);
dprintk("%s: inserted lseg %p "
"iomode %d offset %llu length %llu at tail\n",
__func__, lseg, lseg->range.iomode,
lseg->range.offset, lseg->range.length);
__func__, lseg, lseg->pls_range.iomode,
lseg->pls_range.offset, lseg->pls_range.length);
}
get_layout_hdr_locked(lo);

Expand Down Expand Up @@ -538,7 +538,7 @@ pnfs_find_alloc_layout(struct inode *ino)
static int
is_matching_lseg(struct pnfs_layout_segment *lseg, u32 iomode)
{
return (iomode != IOMODE_RW || lseg->range.iomode == IOMODE_RW);
return (iomode != IOMODE_RW || lseg->pls_range.iomode == IOMODE_RW);
}

/*
Expand All @@ -552,17 +552,17 @@ pnfs_has_layout(struct pnfs_layout_hdr *lo, u32 iomode)
dprintk("%s:Begin\n", __func__);

assert_spin_locked(&lo->inode->i_lock);
list_for_each_entry(lseg, &lo->segs, fi_list) {
list_for_each_entry(lseg, &lo->segs, pls_list) {
if (is_matching_lseg(lseg, iomode)) {
ret = lseg;
break;
}
if (cmp_layout(iomode, lseg->range.iomode) > 0)
if (cmp_layout(iomode, lseg->pls_range.iomode) > 0)
break;
}

dprintk("%s:Return lseg %p ref %d\n",
__func__, ret, ret ? atomic_read(&ret->kref.refcount) : 0);
__func__, ret, ret ? atomic_read(&ret->pls_refcount.refcount) : 0);
return ret;
}

Expand Down Expand Up @@ -597,7 +597,7 @@ pnfs_update_layout(struct inode *ino,
}

/* if LAYOUTGET already failed once we don't try again */
if (test_bit(lo_fail_bit(iomode), &nfsi->layout->state))
if (test_bit(lo_fail_bit(iomode), &nfsi->layout->plh_flags))
goto out_unlock;

get_layout_hdr_locked(lo); /* Matched in nfs4_layoutget_release */
Expand All @@ -606,7 +606,7 @@ pnfs_update_layout(struct inode *ino,
lseg = send_layoutget(lo, ctx, iomode);
out:
dprintk("%s end, state 0x%lx lseg %p\n", __func__,
nfsi->layout->state, lseg);
nfsi->layout->plh_flags, lseg);
return lseg;
out_unlock:
spin_unlock(&ino->i_lock);
Expand Down Expand Up @@ -636,7 +636,7 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)

spin_lock(&ino->i_lock);
init_lseg(lo, lseg);
lseg->range = res->range;
lseg->pls_range = res->range;
*lgp->lsegpp = lseg;
pnfs_insert_layout(lo, lseg);

Expand Down
10 changes: 5 additions & 5 deletions trunk/fs/nfs/pnfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
#define FS_NFS_PNFS_H

struct pnfs_layout_segment {
struct list_head fi_list;
struct pnfs_layout_range range;
struct kref kref;
struct pnfs_layout_hdr *layout;
struct list_head pls_list;
struct pnfs_layout_range pls_range;
struct kref pls_refcount;
struct pnfs_layout_hdr *pls_layout;
};

#ifdef CONFIG_NFS_V4_1
Expand Down Expand Up @@ -65,7 +65,7 @@ struct pnfs_layout_hdr {
struct list_head segs; /* layout segments list */
seqlock_t seqlock; /* Protects the stateid */
nfs4_stateid stateid;
unsigned long state;
unsigned long plh_flags;
struct inode *inode;
};

Expand Down

0 comments on commit 92d03df

Please sign in to comment.