diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 14:19:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 14:19:05 -0500 |
commit | f568849edac8611d603e00bd6cbbcfea09395ae6 (patch) | |
tree | b9472d640fe5d87426d38c9d81d946cf197ad3fb /net/ceph | |
parent | d9894c228b11273e720bb63ba120d1d326fe9d94 (diff) | |
parent | 675675ada486dde5bf9aa51665e90706bff11a35 (diff) |
Merge branch 'for-3.14/core' of git://git.kernel.dk/linux-block
Pull core block IO changes from Jens Axboe:
"The major piece in here is the immutable bio_ve series from Kent, the
rest is fairly minor. It was supposed to go in last round, but
various issues pushed it to this release instead. The pull request
contains:
- Various smaller blk-mq fixes from different folks. Nothing major
here, just minor fixes and cleanups.
- Fix for a memory leak in the error path in the block ioctl code
from Christian Engelmayer.
- Header export fix from CaiZhiyong.
- Finally the immutable biovec changes from Kent Overstreet. This
enables some nice future work on making arbitrarily sized bios
possible, and splitting more efficient. Related fixes to immutable
bio_vecs:
- dm-cache immutable fixup from Mike Snitzer.
- btrfs immutable fixup from Muthu Kumar.
- bio-integrity fix from Nic Bellinger, which is also going to stable"
* 'for-3.14/core' of git://git.kernel.dk/linux-block: (44 commits)
xtensa: fixup simdisk driver to work with immutable bio_vecs
block/blk-mq-cpu.c: use hotcpu_notifier()
blk-mq: for_each_* macro correctness
block: Fix memory leak in rw_copy_check_uvector() handling
bio-integrity: Fix bio_integrity_verify segment start bug
block: remove unrelated header files and export symbol
blk-mq: uses page->list incorrectly
blk-mq: use __smp_call_function_single directly
btrfs: fix missing increment of bi_remaining
Revert "block: Warn and free bio if bi_end_io is not set"
block: Warn and free bio if bi_end_io is not set
blk-mq: fix initializing request's start time
block: blk-mq: don't export blk_mq_free_queue()
block: blk-mq: make blk_sync_queue support mq
block: blk-mq: support draining mq queue
dm cache: increment bi_remaining when bi_end_io is restored
block: fixup for generic bio chaining
block: Really silence spurious compiler warnings
block: Silence spurious compiler warnings
block: Kill bio_pair_split()
...
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/messenger.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 2ed1304d22a7..0e478a0f4204 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -778,13 +778,12 @@ static void ceph_msg_data_bio_cursor_init(struct ceph_msg_data_cursor *cursor, | |||
778 | 778 | ||
779 | bio = data->bio; | 779 | bio = data->bio; |
780 | BUG_ON(!bio); | 780 | BUG_ON(!bio); |
781 | BUG_ON(!bio->bi_vcnt); | ||
782 | 781 | ||
783 | cursor->resid = min(length, data->bio_length); | 782 | cursor->resid = min(length, data->bio_length); |
784 | cursor->bio = bio; | 783 | cursor->bio = bio; |
785 | cursor->vector_index = 0; | 784 | cursor->bvec_iter = bio->bi_iter; |
786 | cursor->vector_offset = 0; | 785 | cursor->last_piece = |
787 | cursor->last_piece = length <= bio->bi_io_vec[0].bv_len; | 786 | cursor->resid <= bio_iter_len(bio, cursor->bvec_iter); |
788 | } | 787 | } |
789 | 788 | ||
790 | static struct page *ceph_msg_data_bio_next(struct ceph_msg_data_cursor *cursor, | 789 | static struct page *ceph_msg_data_bio_next(struct ceph_msg_data_cursor *cursor, |
@@ -793,71 +792,63 @@ static struct page *ceph_msg_data_bio_next(struct ceph_msg_data_cursor *cursor, | |||
793 | { | 792 | { |
794 | struct ceph_msg_data *data = cursor->data; | 793 | struct ceph_msg_data *data = cursor->data; |
795 | struct bio *bio; | 794 | struct bio *bio; |
796 | struct bio_vec *bio_vec; | 795 | struct bio_vec bio_vec; |
797 | unsigned int index; | ||
798 | 796 | ||
799 | BUG_ON(data->type != CEPH_MSG_DATA_BIO); | 797 | BUG_ON(data->type != CEPH_MSG_DATA_BIO); |
800 | 798 | ||
801 | bio = cursor->bio; | 799 | bio = cursor->bio; |
802 | BUG_ON(!bio); | 800 | BUG_ON(!bio); |
803 | 801 | ||
804 | index = cursor->vector_index; | 802 | bio_vec = bio_iter_iovec(bio, cursor->bvec_iter); |
805 | BUG_ON(index >= (unsigned int) bio->bi_vcnt); | ||
806 | 803 | ||
807 | bio_vec = &bio->bi_io_vec[index]; | 804 | *page_offset = (size_t) bio_vec.bv_offset; |
808 | BUG_ON(cursor->vector_offset >= bio_vec->bv_len); | ||
809 | *page_offset = (size_t) (bio_vec->bv_offset + cursor->vector_offset); | ||
810 | BUG_ON(*page_offset >= PAGE_SIZE); | 805 | BUG_ON(*page_offset >= PAGE_SIZE); |
811 | if (cursor->last_piece) /* pagelist offset is always 0 */ | 806 | if (cursor->last_piece) /* pagelist offset is always 0 */ |
812 | *length = cursor->resid; | 807 | *length = cursor->resid; |
813 | else | 808 | else |
814 | *length = (size_t) (bio_vec->bv_len - cursor->vector_offset); | 809 | *length = (size_t) bio_vec.bv_len; |
815 | BUG_ON(*length > cursor->resid); | 810 | BUG_ON(*length > cursor->resid); |
816 | BUG_ON(*page_offset + *length > PAGE_SIZE); | 811 | BUG_ON(*page_offset + *length > PAGE_SIZE); |
817 | 812 | ||
818 | return bio_vec->bv_page; | 813 | return bio_vec.bv_page; |
819 | } | 814 | } |
820 | 815 | ||
821 | static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor, | 816 | static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor, |
822 | size_t bytes) | 817 | size_t bytes) |
823 | { | 818 | { |
824 | struct bio *bio; | 819 | struct bio *bio; |
825 | struct bio_vec *bio_vec; | 820 | struct bio_vec bio_vec; |
826 | unsigned int index; | ||
827 | 821 | ||
828 | BUG_ON(cursor->data->type != CEPH_MSG_DATA_BIO); | 822 | BUG_ON(cursor->data->type != CEPH_MSG_DATA_BIO); |
829 | 823 | ||
830 | bio = cursor->bio; | 824 | bio = cursor->bio; |
831 | BUG_ON(!bio); | 825 | BUG_ON(!bio); |
832 | 826 | ||
833 | index = cursor->vector_index; | 827 | bio_vec = bio_iter_iovec(bio, cursor->bvec_iter); |
834 | BUG_ON(index >= (unsigned int) bio->bi_vcnt); | ||
835 | bio_vec = &bio->bi_io_vec[index]; | ||
836 | 828 | ||
837 | /* Advance the cursor offset */ | 829 | /* Advance the cursor offset */ |
838 | 830 | ||
839 | BUG_ON(cursor->resid < bytes); | 831 | BUG_ON(cursor->resid < bytes); |
840 | cursor->resid -= bytes; | 832 | cursor->resid -= bytes; |
841 | cursor->vector_offset += bytes; | 833 | |
842 | if (cursor->vector_offset < bio_vec->bv_len) | 834 | bio_advance_iter(bio, &cursor->bvec_iter, bytes); |
835 | |||
836 | if (bytes < bio_vec.bv_len) | ||
843 | return false; /* more bytes to process in this segment */ | 837 | return false; /* more bytes to process in this segment */ |
844 | BUG_ON(cursor->vector_offset != bio_vec->bv_len); | ||
845 | 838 | ||
846 | /* Move on to the next segment, and possibly the next bio */ | 839 | /* Move on to the next segment, and possibly the next bio */ |
847 | 840 | ||
848 | if (++index == (unsigned int) bio->bi_vcnt) { | 841 | if (!cursor->bvec_iter.bi_size) { |
849 | bio = bio->bi_next; | 842 | bio = bio->bi_next; |
850 | index = 0; | 843 | cursor->bvec_iter = bio->bi_iter; |
851 | } | 844 | } |
852 | cursor->bio = bio; | 845 | cursor->bio = bio; |
853 | cursor->vector_index = index; | ||
854 | cursor->vector_offset = 0; | ||
855 | 846 | ||
856 | if (!cursor->last_piece) { | 847 | if (!cursor->last_piece) { |
857 | BUG_ON(!cursor->resid); | 848 | BUG_ON(!cursor->resid); |
858 | BUG_ON(!bio); | 849 | BUG_ON(!bio); |
859 | /* A short read is OK, so use <= rather than == */ | 850 | /* A short read is OK, so use <= rather than == */ |
860 | if (cursor->resid <= bio->bi_io_vec[index].bv_len) | 851 | if (cursor->resid <= bio_iter_len(bio, cursor->bvec_iter)) |
861 | cursor->last_piece = true; | 852 | cursor->last_piece = true; |
862 | } | 853 | } |
863 | 854 | ||