aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 13:09:16 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 13:09:16 -0400
commit92d15c2ccbb3e31a3fc71ad28fdb55e1319383c0 (patch)
tree8d83c0dc3c6b935d8367e331872f242b742f0a8a /fs
parentf20bf6125605acbbc7eb8c9420d7221c91aa83eb (diff)
parent644bd2f048972d75eb1979b1fdca257d528ce687 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block: (63 commits) Fix memory leak in dm-crypt SPARC64: sg chaining support SPARC: sg chaining support PPC: sg chaining support PS3: sg chaining support IA64: sg chaining support x86-64: enable sg chaining x86-64: update pci-gart iommu to sg helpers x86-64: update nommu to sg helpers x86-64: update calgary iommu to sg helpers swiotlb: sg chaining support i386: enable sg chaining i386 dma_map_sg: convert to using sg helpers mmc: need to zero sglist on init Panic in blk_rq_map_sg() from CCISS driver remove sglist_len remove blk_queue_max_phys_segments in libata revert sg segment size ifdefs Fixup u14-34f ENABLE_SG_CHAINING qla1280: enable use_sg_chaining option ...
Diffstat (limited to 'fs')
-rw-r--r--fs/bio.c23
-rw-r--r--fs/splice.c2
2 files changed, 8 insertions, 17 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 5f604f269dfa..d59ddbf79626 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -109,11 +109,14 @@ static inline struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned lon
109 109
110void bio_free(struct bio *bio, struct bio_set *bio_set) 110void bio_free(struct bio *bio, struct bio_set *bio_set)
111{ 111{
112 const int pool_idx = BIO_POOL_IDX(bio); 112 if (bio->bi_io_vec) {
113 const int pool_idx = BIO_POOL_IDX(bio);
113 114
114 BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS); 115 BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS);
116
117 mempool_free(bio->bi_io_vec, bio_set->bvec_pools[pool_idx]);
118 }
115 119
116 mempool_free(bio->bi_io_vec, bio_set->bvec_pools[pool_idx]);
117 mempool_free(bio, bio_set->bio_pool); 120 mempool_free(bio, bio_set->bio_pool);
118} 121}
119 122
@@ -127,21 +130,9 @@ static void bio_fs_destructor(struct bio *bio)
127 130
128void bio_init(struct bio *bio) 131void bio_init(struct bio *bio)
129{ 132{
130 bio->bi_next = NULL; 133 memset(bio, 0, sizeof(*bio));
131 bio->bi_bdev = NULL;
132 bio->bi_flags = 1 << BIO_UPTODATE; 134 bio->bi_flags = 1 << BIO_UPTODATE;
133 bio->bi_rw = 0;
134 bio->bi_vcnt = 0;
135 bio->bi_idx = 0;
136 bio->bi_phys_segments = 0;
137 bio->bi_hw_segments = 0;
138 bio->bi_hw_front_size = 0;
139 bio->bi_hw_back_size = 0;
140 bio->bi_size = 0;
141 bio->bi_max_vecs = 0;
142 bio->bi_end_io = NULL;
143 atomic_set(&bio->bi_cnt, 1); 135 atomic_set(&bio->bi_cnt, 1);
144 bio->bi_private = NULL;
145} 136}
146 137
147/** 138/**
diff --git a/fs/splice.c b/fs/splice.c
index a7568bcc0f99..59a941d404d9 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1335,10 +1335,10 @@ static int pipe_to_user(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
1335 if (copy_to_user(sd->u.userptr, src + buf->offset, sd->len)) 1335 if (copy_to_user(sd->u.userptr, src + buf->offset, sd->len))
1336 ret = -EFAULT; 1336 ret = -EFAULT;
1337 1337
1338 buf->ops->unmap(pipe, buf, src);
1338out: 1339out:
1339 if (ret > 0) 1340 if (ret > 0)
1340 sd->u.userptr += ret; 1341 sd->u.userptr += ret;
1341 buf->ops->unmap(pipe, buf, src);
1342 return ret; 1342 return ret;
1343} 1343}
1344 1344