diff options
author | Tom Haynes <loghyr@primarydata.com> | 2014-12-11 17:02:04 -0500 |
---|---|---|
committer | Tom Haynes <loghyr@primarydata.com> | 2015-02-03 14:06:52 -0500 |
commit | d67ae825a59d639e4d8b82413af84d854617a87e (patch) | |
tree | 6b11fc9afb214e02b9cf0b66a14817c57f0f9a05 /fs/nfs/pnfs.c | |
parent | 5fadeb47dcc5c30d4b6cf481b4a78689eab59443 (diff) |
pnfs/flexfiles: Add the FlexFile Layout Driver
The flexfile layout is a new layout that extends the
file layout. It is currently being drafted as a specification at
https://datatracker.ietf.org/doc/draft-ietf-nfsv4-layout-types/
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Signed-off-by: Tao Peng <bergwolf@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index c4c9fe606ae6..0fb0f1920a1f 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -910,7 +910,9 @@ send_layoutget(struct pnfs_layout_hdr *lo, | |||
910 | pnfs_layout_io_set_failed(lo, range->iomode); | 910 | pnfs_layout_io_set_failed(lo, range->iomode); |
911 | } | 911 | } |
912 | return NULL; | 912 | return NULL; |
913 | } | 913 | } else |
914 | pnfs_layout_clear_fail_bit(lo, | ||
915 | pnfs_iomode_to_fail_bit(range->iomode)); | ||
914 | 916 | ||
915 | return lseg; | 917 | return lseg; |
916 | } | 918 | } |
@@ -930,6 +932,13 @@ static void pnfs_clear_layoutcommit(struct inode *inode, | |||
930 | } | 932 | } |
931 | } | 933 | } |
932 | 934 | ||
935 | void pnfs_clear_layoutreturn_waitbit(struct pnfs_layout_hdr *lo) | ||
936 | { | ||
937 | clear_bit_unlock(NFS_LAYOUT_RETURN, &lo->plh_flags); | ||
938 | smp_mb__after_atomic(); | ||
939 | wake_up_bit(&lo->plh_flags, NFS_LAYOUT_RETURN); | ||
940 | } | ||
941 | |||
933 | static int | 942 | static int |
934 | pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, | 943 | pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, |
935 | enum pnfs_iomode iomode, bool sync) | 944 | enum pnfs_iomode iomode, bool sync) |
@@ -943,6 +952,7 @@ pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, | |||
943 | status = -ENOMEM; | 952 | status = -ENOMEM; |
944 | spin_lock(&ino->i_lock); | 953 | spin_lock(&ino->i_lock); |
945 | lo->plh_block_lgets--; | 954 | lo->plh_block_lgets--; |
955 | pnfs_clear_layoutreturn_waitbit(lo); | ||
946 | rpc_wake_up(&NFS_SERVER(ino)->roc_rpcwaitq); | 956 | rpc_wake_up(&NFS_SERVER(ino)->roc_rpcwaitq); |
947 | spin_unlock(&ino->i_lock); | 957 | spin_unlock(&ino->i_lock); |
948 | pnfs_put_layout_hdr(lo); | 958 | pnfs_put_layout_hdr(lo); |
@@ -1418,6 +1428,15 @@ static bool pnfs_prepare_to_retry_layoutget(struct pnfs_layout_hdr *lo) | |||
1418 | TASK_UNINTERRUPTIBLE); | 1428 | TASK_UNINTERRUPTIBLE); |
1419 | } | 1429 | } |
1420 | 1430 | ||
1431 | static void pnfs_clear_first_layoutget(struct pnfs_layout_hdr *lo) | ||
1432 | { | ||
1433 | unsigned long *bitlock = &lo->plh_flags; | ||
1434 | |||
1435 | clear_bit_unlock(NFS_LAYOUT_FIRST_LAYOUTGET, bitlock); | ||
1436 | smp_mb__after_atomic(); | ||
1437 | wake_up_bit(bitlock, NFS_LAYOUT_FIRST_LAYOUTGET); | ||
1438 | } | ||
1439 | |||
1421 | /* | 1440 | /* |
1422 | * Layout segment is retreived from the server if not cached. | 1441 | * Layout segment is retreived from the server if not cached. |
1423 | * The appropriate layout segment is referenced and returned to the caller. | 1442 | * The appropriate layout segment is referenced and returned to the caller. |
@@ -1499,6 +1518,8 @@ lookup_again: | |||
1499 | spin_unlock(&ino->i_lock); | 1518 | spin_unlock(&ino->i_lock); |
1500 | dprintk("%s wait for layoutreturn\n", __func__); | 1519 | dprintk("%s wait for layoutreturn\n", __func__); |
1501 | if (pnfs_prepare_to_retry_layoutget(lo)) { | 1520 | if (pnfs_prepare_to_retry_layoutget(lo)) { |
1521 | if (first) | ||
1522 | pnfs_clear_first_layoutget(lo); | ||
1502 | pnfs_put_layout_hdr(lo); | 1523 | pnfs_put_layout_hdr(lo); |
1503 | dprintk("%s retrying\n", __func__); | 1524 | dprintk("%s retrying\n", __func__); |
1504 | goto lookup_again; | 1525 | goto lookup_again; |
@@ -1533,13 +1554,8 @@ lookup_again: | |||
1533 | pnfs_clear_retry_layoutget(lo); | 1554 | pnfs_clear_retry_layoutget(lo); |
1534 | atomic_dec(&lo->plh_outstanding); | 1555 | atomic_dec(&lo->plh_outstanding); |
1535 | out_put_layout_hdr: | 1556 | out_put_layout_hdr: |
1536 | if (first) { | 1557 | if (first) |
1537 | unsigned long *bitlock = &lo->plh_flags; | 1558 | pnfs_clear_first_layoutget(lo); |
1538 | |||
1539 | clear_bit_unlock(NFS_LAYOUT_FIRST_LAYOUTGET, bitlock); | ||
1540 | smp_mb__after_atomic(); | ||
1541 | wake_up_bit(bitlock, NFS_LAYOUT_FIRST_LAYOUTGET); | ||
1542 | } | ||
1543 | pnfs_put_layout_hdr(lo); | 1559 | pnfs_put_layout_hdr(lo); |
1544 | out: | 1560 | out: |
1545 | dprintk("%s: inode %s/%llu pNFS layout segment %s for " | 1561 | dprintk("%s: inode %s/%llu pNFS layout segment %s for " |