diff options
| -rw-r--r-- | fs/nfs/objlayout/objio_osd.c | 32 | ||||
| -rw-r--r-- | fs/nfs/objlayout/objlayout.c | 36 | ||||
| -rw-r--r-- | fs/nfs/objlayout/objlayout.h | 4 |
3 files changed, 37 insertions, 35 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); |
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c index 1300736e0fb4..99c807df11dc 100644 --- a/fs/nfs/objlayout/objlayout.c +++ b/fs/nfs/objlayout/objlayout.c | |||
| @@ -315,16 +315,13 @@ objlayout_read_pagelist(struct nfs_read_data *rdata) | |||
| 315 | loff_t offset = rdata->args.offset; | 315 | loff_t offset = rdata->args.offset; |
| 316 | size_t count = rdata->args.count; | 316 | size_t count = rdata->args.count; |
| 317 | struct objlayout_io_state *state; | 317 | struct objlayout_io_state *state; |
| 318 | ssize_t status = 0; | 318 | int err; |
| 319 | loff_t eof; | 319 | loff_t eof; |
| 320 | 320 | ||
| 321 | dprintk("%s: Begin inode %p offset %llu count %d\n", | ||
| 322 | __func__, rdata->inode, offset, (int)count); | ||
| 323 | |||
| 324 | eof = i_size_read(rdata->inode); | 321 | eof = i_size_read(rdata->inode); |
| 325 | if (unlikely(offset + count > eof)) { | 322 | if (unlikely(offset + count > eof)) { |
| 326 | if (offset >= eof) { | 323 | if (offset >= eof) { |
| 327 | status = 0; | 324 | err = 0; |
| 328 | rdata->res.count = 0; | 325 | rdata->res.count = 0; |
| 329 | rdata->res.eof = 1; | 326 | rdata->res.eof = 1; |
| 330 | /*FIXME: do we need to call pnfs_ld_read_done() */ | 327 | /*FIXME: do we need to call pnfs_ld_read_done() */ |
| @@ -341,14 +338,19 @@ objlayout_read_pagelist(struct nfs_read_data *rdata) | |||
| 341 | rdata->lseg, rdata, | 338 | rdata->lseg, rdata, |
| 342 | GFP_KERNEL); | 339 | GFP_KERNEL); |
| 343 | if (unlikely(!state)) { | 340 | if (unlikely(!state)) { |
| 344 | status = -ENOMEM; | 341 | err |
