Skip to content

Commit f459587

Browse files
committed
block: remove bio_clone_bioset_partial()
commit c18a1e0(block: introduce bio_clone_bioset_partial()) introduced bio_clone_bioset_partial() for raid1 write behind IO. Now the write behind is rewritten by Ming. We don't need the API any more, so revert the commit. Cc: Christoph Hellwig <hch@lst.de> Reviewed-by: Jens Axboe <axboe@fb.com> Reviewed-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Shaohua Li <shli@fb.com>
1 parent 2d06e3b commit f459587

File tree

2 files changed

+15
-57
lines changed

2 files changed

+15
-57
lines changed

block/bio.c

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -631,20 +631,21 @@ struct bio *bio_clone_fast(struct bio *bio, gfp_t gfp_mask, struct bio_set *bs)
631631
}
632632
EXPORT_SYMBOL(bio_clone_fast);
633633

634-
static struct bio *__bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
635-
struct bio_set *bs, int offset,
636-
int size)
634+
/**
635+
* bio_clone_bioset - clone a bio
636+
* @bio_src: bio to clone
637+
* @gfp_mask: allocation priority
638+
* @bs: bio_set to allocate from
639+
*
640+
* Clone bio. Caller will own the returned bio, but not the actual data it
641+
* points to. Reference count of returned bio will be one.
642+
*/
643+
struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
644+
struct bio_set *bs)
637645
{
638646
struct bvec_iter iter;
639647
struct bio_vec bv;
640648
struct bio *bio;
641-
struct bvec_iter iter_src = bio_src->bi_iter;
642-
643-
/* for supporting partial clone */
644-
if (offset || size != bio_src->bi_iter.bi_size) {
645-
bio_advance_iter(bio_src, &iter_src, offset);
646-
iter_src.bi_size = size;
647-
}
648649

649650
/*
650651
* Pre immutable biovecs, __bio_clone() used to just do a memcpy from
@@ -668,8 +669,7 @@ static struct bio *__bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
668669
* __bio_clone_fast() anyways.
669670
*/
670671

671-
bio = bio_alloc_bioset(gfp_mask, __bio_segments(bio_src,
672-
&iter_src), bs);
672+
bio = bio_alloc_bioset(gfp_mask, bio_segments(bio_src), bs);
673673
if (!bio)
674674
return NULL;
675675
bio->bi_bdev = bio_src->bi_bdev;
@@ -686,7 +686,7 @@ static struct bio *__bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
686686
bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0];
687687
break;
688688
default:
689-
__bio_for_each_segment(bv, bio_src, iter, iter_src)
689+
bio_for_each_segment(bv, bio_src, iter)
690690
bio->bi_io_vec[bio->bi_vcnt++] = bv;
691691
break;
692692
}
@@ -705,43 +705,8 @@ static struct bio *__bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
705705

706706
return bio;
707707
}
708-
709-
/**
710-
* bio_clone_bioset - clone a bio
711-
* @bio_src: bio to clone
712-
* @gfp_mask: allocation priority
713-
* @bs: bio_set to allocate from
714-
*
715-
* Clone bio. Caller will own the returned bio, but not the actual data it
716-
* points to. Reference count of returned bio will be one.
717-
*/
718-
struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
719-
struct bio_set *bs)
720-
{
721-
return __bio_clone_bioset(bio_src, gfp_mask, bs, 0,
722-
bio_src->bi_iter.bi_size);
723-
}
724708
EXPORT_SYMBOL(bio_clone_bioset);
725709

726-
/**
727-
* bio_clone_bioset_partial - clone a partial bio
728-
* @bio_src: bio to clone
729-
* @gfp_mask: allocation priority
730-
* @bs: bio_set to allocate from
731-
* @offset: cloned starting from the offset
732-
* @size: size for the cloned bio
733-
*
734-
* Clone bio. Caller will own the returned bio, but not the actual data it
735-
* points to. Reference count of returned bio will be one.
736-
*/
737-
struct bio *bio_clone_bioset_partial(struct bio *bio_src, gfp_t gfp_mask,
738-
struct bio_set *bs, int offset,
739-
int size)
740-
{
741-
return __bio_clone_bioset(bio_src, gfp_mask, bs, offset, size);
742-
}
743-
EXPORT_SYMBOL(bio_clone_bioset_partial);
744-
745710
/**
746711
* bio_add_pc_page - attempt to add page to bio
747712
* @q: the target queue

include/linux/bio.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter,
183183

184184
#define bio_iter_last(bvec, iter) ((iter).bi_size == (bvec).bv_len)
185185

186-
static inline unsigned __bio_segments(struct bio *bio, struct bvec_iter *bvec)
186+
static inline unsigned bio_segments(struct bio *bio)
187187
{
188188
unsigned segs = 0;
189189
struct bio_vec bv;
@@ -205,17 +205,12 @@ static inline unsigned __bio_segments(struct bio *bio, struct bvec_iter *bvec)
205205
break;
206206
}
207207

208-
__bio_for_each_segment(bv, bio, iter, *bvec)
208+
bio_for_each_segment(bv, bio, iter)
209209
segs++;
210210

211211
return segs;
212212
}
213213

214-
static inline unsigned bio_segments(struct bio *bio)
215-
{
216-
return __bio_segments(bio, &bio->bi_iter);
217-
}
218-
219214
/*
220215
* get a reference to a bio, so it won't disappear. the intended use is
221216
* something like:
@@ -389,8 +384,6 @@ extern void bio_put(struct bio *);
389384
extern void __bio_clone_fast(struct bio *, struct bio *);
390385
extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *);
391386
extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
392-
extern struct bio *bio_clone_bioset_partial(struct bio *, gfp_t,
393-
struct bio_set *, int, int);
394387

395388
extern struct bio_set *fs_bio_set;
396389

0 commit comments

Comments
 (0)