diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2011-10-31 17:45:46 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-11-02 23:56:03 -0400 |
commit | e6c40fe3f4c4967f1cb486191ed4a5d5f55f3f7e (patch) | |
tree | a7747effb21709bfbb0b3ded2e85253f37e7711e /fs/nfs/objlayout/objio_osd.c | |
parent | 4cdc685c7d06f659ef6c336d4242005cdd8df401 (diff) |
pnfs-obj: Return PNFS_NOT_ATTEMPTED in case of read/write_pagelist
objlayout driver was always returning PNFS_ATTEMPTED from it's
read/write_pagelist operations. Even on error. Fix that.
Start by establishing an error return API from io-engine, by
not returning ssize_t (length-or-error) but returning "int"
0=OK, 0>Error. And clean up all return types in io-engine.
Then if io-engine returned error return PNFS_NOT_ATTEMPTED
to generic layer. (With a dprint)
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/objlayout/objio_osd.c')
-rw-r--r-- | fs/nfs/objlayout/objio_osd.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index d0cda12fddc3..0c7c9ec24e67 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c | |||
@@ -142,7 +142,7 @@ OBJIO_LSEG(struct pnfs_layout_segment *lseg) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | struct objio_state; | 144 | struct objio_state; |
145 | typedef ssize_t (*objio_done_fn)(struct objio_state *ios); | 145 | typedef int (*objio_done_fn)(struct objio_state *ios); |
146 | 146 | ||
147 | struct objio_state { | 147 | struct objio_state { |
148 | /* Generic layer */ | 148 | /* Generic layer */ |
@@ -720,7 +720,7 @@ out: | |||
720 | return 0; | 720 | return 0; |
721 | } | 721 | } |
722 | 722 | ||
723 | static ssize_t _sync_done(struct objio_state *ios) | 723 | static int _sync_done(struct objio_state *ios) |
724 | { | 724 | { |
725 | struct completion *waiting = ios->private; | 725 | struct completion *waiting = ios->private; |
726 | 726 | ||
@@ -742,10 +742,10 @@ static void _done_io(struct osd_request *or, void *p) | |||
742 | kref_put(&ios->kref, _last_io); | 742 | kref_put(&ios->kref, _last_io); |
743 | } | 743 | } |
744 | 744 | ||
745 | static ssize_t _io_exec(struct objio_state *ios) | 745 | static int _io_exec(struct objio_state *ios) |
746 | { | 746 | { |
747 | DECLARE_COMPLETION_ONSTACK(wait); | 747 | DECLARE_COMPLETION_ONSTACK(wait); |
748 | ssize_t status = 0; /* sync status */ | 748 | int ret = 0; |
749 | unsigned i; | 749 | unsigned i; |
750 | objio_done_fn saved_done_fn = ios->done; | 750 | objio_done_fn saved_done_fn = ios->done; |
751 | bool sync = ios->ol_state.sync; | 751 | bool sync = ios->ol_state.sync; |
@@ -771,16 +771,16 @@ static ssize_t _io_exec(struct objio_state *ios) | |||
771 | 771 | ||
772 | if (sync) { | 772 | if (sync) { |
773 | wait_for_completion(&wait); | 773 | wait_for_completion(&wait); |
774 | status = saved_done_fn(ios); | 774 | ret = saved_done_fn(ios); |
775 | } | 775 | } |
776 | 776 | ||
777 | return status; | 777 | return ret; |
778 | } | 778 | } |
779 | 779 | ||
780 | /* | 780 | /* |
781 | * read | 781 | * read |
782 | */ | 782 | */ |
783 | static ssize_t _read_done(struct objio_state *ios) | 783 | static int _read_done(struct objio_state *ios) |
784 | { | 784 | { |
785 | ssize_t status; | 785 | ssize_t status; |
786 | int ret = _io_check(ios, false); | 786 | int ret = _io_check(ios, false); |
@@ -793,7 +793,7 @@ static ssize_t _read_done(struct objio_state *ios) | |||
793 | status = ret; | 793 | status = ret; |
794 | 794 | ||
795 | objlayout_read_done(&ios->ol_state, status, ios->ol_state.sync); | 795 | objlayout_read_done(&ios->ol_state, status, ios->ol_state.sync); |
796 | return status; | 796 | return ret; |
797 | } | 797 | } |
798 | 798 | ||
799 | static int _read_mirrors(struct objio_state *ios, unsigned cur_comp) | 799 | static int _read_mirrors(struct objio_state *ios, unsigned cur_comp) |
@@ -833,7 +833,7 @@ err: | |||
833 | return ret; | 833 | return ret; |
834 | } | 834 | } |
835 | 835 | ||
836 | static ssize_t _read_exec(struct objio_state *ios) | 836 | static int _read_exec(struct objio_state *ios) |
837 | { | 837 | { |
838 | unsigned i; | 838 | unsigned i; |
839 | int ret; | 839 | int ret; |
@@ -847,14 +847,14 @@ static ssize_t _read_exec(struct objio_state *ios) | |||
847 | } | 847 | } |
848 | 848 | ||
849 | ios->done = _read_done; | 849 | ios->done = _read_done; |
850 | return _io_exec(ios); /* In sync mode exec returns the io status */ | 850 | return _io_exec(ios); |
851 | 851 | ||
852 | err: | 852 | err: |
853 | _io_free(ios); | 853 | _io_free(ios); |
854 | return ret; | 854 | return ret; |
855 | } | 855 | } |
856 | 856 | ||
857 | ssize_t objio_read_pagelist(struct objlayout_io_state *ol_state) | 857 | int objio_read_pagelist(struct objlayout_io_state *ol_state) |
858 | { | 858 | { |
859 | struct objio_state *ios = container_of(ol_state, struct objio_state, | 859 | struct objio_state *ios = container_of(ol_state, struct objio_state, |
860 | ol_state); | 860 | ol_state); |
@@ -870,7 +870,7 @@ ssize_t objio_read_pagelist(struct objlayout_io_state *ol_state) | |||
870 | /* | 870 | /* |
871 | * write | 871 | * write |
872 | */ | 872 | */ |
873 | static ssize_t _write_done(struct objio_state *ios) | 873 | static int _write_done(struct objio_state *ios) |
874 | { | 874 | { |
875 | ssize_t status; | 875 | ssize_t status; |
876 | int ret = _io_check(ios, true); | 876 | int ret = _io_check(ios, true); |
@@ -887,7 +887,7 @@ static ssize_t _write_done(struct objio_state *ios) | |||
887 | } | 887 | } |
888 | 888 | ||
889 | objlayout_write_done(&ios->ol_state, status, ios->ol_state.sync); | 889 | objlayout_write_done(&ios->ol_state, status, ios->ol_state.sync); |
890 | return status; | 890 | return ret; |
891 | } | 891 | } |
892 | 892 | ||
893 | static int _write_mirrors(struct objio_state *ios, unsigned cur_comp) | 893 | static int _write_mirrors(struct objio_state *ios, unsigned cur_comp) |
@@ -955,7 +955,7 @@ err: | |||
955 | return ret; | 955 | return ret; |
956 | } | 956 | } |
957 | 957 | ||
958 | static ssize_t _write_exec(struct objio_state *ios) | 958 | static int _write_exec(struct objio_state *ios) |
959 | { | 959 | { |
960 | unsigned i; | 960 | unsigned i; |
961 | int ret; | 961 | int ret; |
@@ -969,14 +969,14 @@ static ssize_t _write_exec(struct objio_state *ios) | |||
969 | } | 969 | } |
970 | 970 | ||
971 | ios->done = _write_done; | 971 | ios->done = _write_done; |
972 | return _io_exec(ios); /* In sync mode exec returns the io->status */ | 972 | return _io_exec(ios); |
973 | 973 | ||
974 | err: | 974 | err: |
975 | _io_free(ios); | 975 | _io_free(ios); |
976 | return ret; | 976 | return ret; |
977 | } | 977 | } |
978 | 978 | ||
979 | ssize_t objio_write_pagelist(struct objlayout_io_state *ol_state, bool stable) | 979 | int objio_write_pagelist(struct objlayout_io_state *ol_state, bool stable) |
980 | { | 980 | { |
981 | struct objio_state *ios = container_of(ol_state, struct objio_state, | 981 | struct objio_state *ios = container_of(ol_state, struct objio_state, |
982 | ol_state); | 982 | ol_state); |