diff options
Diffstat (limited to 'drivers/block/paride/pf.c')
-rw-r--r-- | drivers/block/paride/pf.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index bef3b997ba3e..68a90834e993 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -750,12 +750,10 @@ static int pf_ready(void) | |||
750 | 750 | ||
751 | static struct request_queue *pf_queue; | 751 | static struct request_queue *pf_queue; |
752 | 752 | ||
753 | static void pf_end_request(int uptodate) | 753 | static void pf_end_request(int err) |
754 | { | 754 | { |
755 | if (pf_req) { | 755 | if (pf_req && !__blk_end_request_cur(pf_req, err)) |
756 | end_request(pf_req, uptodate); | ||
757 | pf_req = NULL; | 756 | pf_req = NULL; |
758 | } | ||
759 | } | 757 | } |
760 | 758 | ||
761 | static void do_pf_request(struct request_queue * q) | 759 | static void do_pf_request(struct request_queue * q) |
@@ -763,17 +761,19 @@ static void do_pf_request(struct request_queue * q) | |||
763 | if (pf_busy) | 761 | if (pf_busy) |
764 | return; | 762 | return; |
765 | repeat: | 763 | repeat: |
766 | pf_req = elv_next_request(q); | 764 | if (!pf_req) { |
767 | if (!pf_req) | 765 | pf_req = blk_fetch_request(q); |
768 | return; | 766 | if (!pf_req) |
767 | return; | ||
768 | } | ||
769 | 769 | ||
770 | pf_current = pf_req->rq_disk->private_data; | 770 | pf_current = pf_req->rq_disk->private_data; |
771 | pf_block = pf_req->sector; | 771 | pf_block = blk_rq_pos(pf_req); |
772 | pf_run = pf_req->nr_sectors; | 772 | pf_run = blk_rq_sectors(pf_req); |
773 | pf_count = pf_req->current_nr_sectors; | 773 | pf_count = blk_rq_cur_sectors(pf_req); |
774 | 774 | ||
775 | if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) { | 775 | if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) { |
776 | pf_end_request(0); | 776 | pf_end_request(-EIO); |
777 | goto repeat; | 777 | goto repeat; |
778 | } | 778 | } |
779 | 779 | ||
@@ -788,7 +788,7 @@ repeat: | |||
788 | pi_do_claimed(pf_current->pi, do_pf_write); | 788 | pi_do_claimed(pf_current->pi, do_pf_write); |
789 | else { | 789 | else { |
790 | pf_busy = 0; | 790 | pf_busy = 0; |
791 | pf_end_request(0); | 791 | pf_end_request(-EIO); |
792 | goto repeat; | 792 | goto repeat; |
793 | } | 793 | } |
794 | } | 794 | } |
@@ -805,23 +805,22 @@ static int pf_next_buf(void) | |||
805 | return 1; | 805 | return 1; |
806 | if (!pf_count) { | 806 | if (!pf_count) { |
807 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 807 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
808 | pf_end_request(1); | 808 | pf_end_request(0); |
809 | pf_req = elv_next_request(pf_queue); | ||
810 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 809 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); |
811 | if (!pf_req) | 810 | if (!pf_req) |
812 | return 1; | 811 | return 1; |
813 | pf_count = pf_req->current_nr_sectors; | 812 | pf_count = blk_rq_cur_sectors(pf_req); |
814 | pf_buf = pf_req->buffer; | 813 | pf_buf = pf_req->buffer; |
815 | } | 814 | } |
816 | return 0; | 815 | return 0; |
817 | } | 816 | } |
818 | 817 | ||
819 | static inline void next_request(int success) | 818 | static inline void next_request(int err) |
820 | { | 819 | { |
821 | unsigned long saved_flags; | 820 | unsigned long saved_flags; |
822 | 821 | ||
823 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 822 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
824 | pf_end_request(success); | 823 | pf_end_request(err); |
825 | pf_busy = 0; | 824 | pf_busy = 0; |
826 | do_pf_request(pf_queue); | 825 | do_pf_request(pf_queue); |
827 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 826 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); |
@@ -844,7 +843,7 @@ static void do_pf_read_start(void) | |||
844 | pi_do_claimed(pf_current->pi, do_pf_read_start); | 843 | pi_do_claimed(pf_current->pi, do_pf_read_start); |
845 | return; | 844 | return; |
846 | } | 845 | } |
847 | next_request(0); | 846 | next_request(-EIO); |
848 | return; | 847 | return; |
849 | } | 848 | } |
850 | pf_mask = STAT_DRQ; | 849 | pf_mask = STAT_DRQ; |
@@ -863,7 +862,7 @@ static void do_pf_read_drq(void) | |||
863 | pi_do_claimed(pf_current->pi, do_pf_read_start); | 862 | pi_do_claimed(pf_current->pi, do_pf_read_start); |
864 | return; | 863 | return; |
865 | } | 864 | } |
866 | next_request(0); | 865 | next_request(-EIO); |
867 | return; | 866 | return; |
868 | } | 867 | } |
869 | pi_read_block(pf_current->pi, pf_buf, 512); | 868 | pi_read_block(pf_current->pi, pf_buf, 512); |
@@ -871,7 +870,7 @@ static void do_pf_read_drq(void) | |||
871 | break; | 870 | break; |
872 | } | 871 | } |
873 | pi_disconnect(pf_current->pi); | 872 | pi_disconnect(pf_current->pi); |
874 | next_request(1); | 873 | next_request(0); |
875 | } | 874 | } |
876 | 875 | ||
877 | static void do_pf_write(void) | 876 | static void do_pf_write(void) |
@@ -890,7 +889,7 @@ static void do_pf_write_start(void) | |||
890 | pi_do_claimed(pf_current->pi, do_pf_write_start); | 889 | pi_do_claimed(pf_current->pi, do_pf_write_start); |
891 | return; | 890 | return; |
892 | } | 891 | } |
893 | next_request(0); | 892 | next_request(-EIO); |
894 | return; | 893 | return; |
895 | } | 894 | } |
896 | 895 | ||
@@ -903,7 +902,7 @@ static void do_pf_write_start(void) | |||
903 | pi_do_claimed(pf_current->pi, do_pf_write_start); | 902 | pi_do_claimed(pf_current->pi, do_pf_write_start); |
904 | return; | 903 | return; |
905 | } | 904 | } |
906 | next_request(0); | 905 | next_request(-EIO); |
907 | return; | 906 | return; |
908 | } | 907 | } |
909 | pi_write_block(pf_current->pi, pf_buf, 512); | 908 | pi_write_block(pf_current->pi, pf_buf, 512); |
@@ -923,11 +922,11 @@ static void do_pf_write_done(void) | |||
923 | pi_do_claimed(pf_current->pi, do_pf_write_start); | 922 | pi_do_claimed(pf_current->pi, do_pf_write_start); |
924 | return; | 923 | return; |
925 | } | 924 | } |
926 | next_request(0); | 925 | next_request(-EIO); |
927 | return; | 926 | return; |
928 | } | 927 | } |
929 | pi_disconnect(pf_current->pi); | 928 | pi_disconnect(pf_current->pi); |
930 | next_request(1); | 929 | next_request(0); |
931 | } | 930 | } |
932 | 931 | ||
933 | static int __init pf_init(void) | 932 | static int __init pf_init(void) |