diff options
| -rw-r--r-- | block/blk-core.c | 26 | ||||
| -rw-r--r-- | block/blk-ioc.c | 2 | ||||
| -rw-r--r-- | block/blk-merge.c | 12 | ||||
| -rw-r--r-- | block/blk-sysfs.c | 6 | ||||
| -rw-r--r-- | block/blk-tag.c | 9 | ||||
| -rw-r--r-- | block/cfq-iosched.c | 23 | ||||
| -rw-r--r-- | drivers/block/aoe/aoecmd.c | 10 | ||||
| -rw-r--r-- | fs/bio.c | 3 | ||||
| -rw-r--r-- | fs/splice.c | 31 | ||||
| -rw-r--r-- | include/linux/fs.h | 1 | ||||
| -rw-r--r-- | include/linux/genhd.h | 35 | ||||
| -rw-r--r-- | include/linux/ioprio.h | 14 | ||||
| -rw-r--r-- | kernel/relay.c | 2 | ||||
| -rw-r--r-- | mm/filemap.c | 2 |
14 files changed, 103 insertions, 73 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index b754a4a2f9bd..2987fe47b5ee 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -54,15 +54,16 @@ static DEFINE_PER_CPU(struct list_head, blk_cpu_done); | |||
| 54 | 54 | ||
| 55 | static void drive_stat_acct(struct request *rq, int new_io) | 55 | static void drive_stat_acct(struct request *rq, int new_io) |
| 56 | { | 56 | { |
| 57 | struct hd_struct *part; | ||
| 57 | int rw = rq_data_dir(rq); | 58 | int rw = rq_data_dir(rq); |
| 58 | 59 | ||
| 59 | if (!blk_fs_request(rq) || !rq->rq_disk) | 60 | if (!blk_fs_request(rq) || !rq->rq_disk) |
| 60 | return; | 61 | return; |
| 61 | 62 | ||
| 62 | if (!new_io) { | 63 | part = get_part(rq->rq_disk, rq->sector); |
| 63 | __all_stat_inc(rq->rq_disk, merges[rw], rq->sector); | 64 | if (!new_io) |
| 64 | } else { | 65 | __all_stat_inc(rq->rq_disk, part, merges[rw], rq->sector); |
| 65 | struct hd_struct *part = get_part(rq->rq_disk, rq->sector); | 66 | else { |
| 66 | disk_round_stats(rq->rq_disk); | 67 | disk_round_stats(rq->rq_disk); |
| 67 | rq->rq_disk->in_flight++; | 68 | rq->rq_disk->in_flight++; |
| 68 | if (part) { | 69 | if (part) { |
| @@ -253,9 +254,11 @@ EXPORT_SYMBOL(__generic_unplug_device); | |||
| 253 | **/ | 254 | **/ |
| 254 | void generic_unplug_device(struct request_queue *q) | 255 | void generic_unplug_device(struct request_queue *q) |
| 255 | { | 256 | { |
| 256 | spin_lock_irq(q->queue_lock); | 257 | if (blk_queue_plugged(q)) { |
| 257 | __generic_unplug_device(q); | 258 | spin_lock_irq(q->queue_lock); |
| 258 | spin_unlock_irq(q->queue_lock); | 259 | __generic_unplug_device(q); |
| 260 | spin_unlock_irq(q->queue_lock); | ||
| 261 | } | ||
| 259 | } | 262 | } |
| 260 | EXPORT_SYMBOL(generic_unplug_device); | 263 | EXPORT_SYMBOL(generic_unplug_device); |
| 261 | 264 | ||
| @@ -1536,10 +1539,11 @@ static int __end_that_request_first(struct request *req, int error, | |||
| 1536 | } | 1539 | } |
| 1537 | 1540 | ||
| 1538 | if (blk_fs_request(req) && req->rq_disk) { | 1541 | if (blk_fs_request(req) && req->rq_disk) { |
| 1542 | struct hd_struct *part = get_part(req->rq_disk, req->sector); | ||
| 1539 | const int rw = rq_data_dir(req); | 1543 | const int rw = rq_data_dir(req); |
| 1540 | 1544 | ||
| 1541 | all_stat_add(req->rq_disk, sectors[rw], | 1545 | all_stat_add(req->rq_disk, part, sectors[rw], |
| 1542 | nr_bytes >> 9, req->sector); | 1546 | nr_bytes >> 9, req->sector); |
| 1543 | } | 1547 | } |
| 1544 | 1548 | ||
| 1545 | total_bytes = bio_nbytes = 0; | 1549 | total_bytes = bio_nbytes = 0; |
| @@ -1725,8 +1729,8 @@ static void end_that_request_last(struct request *req, int error) | |||
| 1725 | const int rw = rq_data_dir(req); | 1729 | const int rw = rq_data_dir(req); |
| 1726 | struct hd_struct *part = get_part(disk, req->sector); | 1730 | struct hd_struct *part = get_part(disk, req->sector); |
| 1727 | 1731 | ||
| 1728 | __all_stat_inc(disk, ios[rw], req->sector); | 1732 | __all_stat_inc(disk, part, ios[rw], req->sector); |
| 1729 | __all_stat_add(disk, ticks[rw], duration, req->sector); | 1733 | __all_stat_add(disk, part, ticks[rw], duration, req->sector); |
| 1730 | disk_round_stats(disk); | 1734 | disk_round_stats(disk); |
| 1731 | disk->in_flight--; | 1735 | disk->in_flight--; |
| 1732 | if (part) { | 1736 | if (part) { |
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index e34df7c9fc36..012f065ac8e2 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c | |||
| @@ -41,8 +41,8 @@ int put_io_context(struct io_context *ioc) | |||
| 41 | rcu_read_lock(); | 41 | rcu_read_lock(); |
| 42 | if (ioc->aic && ioc->aic->dtor) | 42 | if (ioc->aic && ioc->aic->dtor) |
| 43 | ioc->aic->dtor(ioc->aic); | 43 | ioc->aic->dtor(ioc->aic); |
| 44 | rcu_read_unlock(); | ||
| 45 | cfq_dtor(ioc); | 44 | cfq_dtor(ioc); |
| 45 | rcu_read_unlock(); | ||
| 46 | 46 | ||
| 47 | kmem_cache_free(iocontext_cachep, ioc); | 47 | kmem_cache_free(iocontext_cachep, ioc); |
| 48 | return 1; | 48 | return 1; |
diff --git a/block/blk-merge.c b/block/blk-merge.c index 73b23562af20..651136aae76e 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
| @@ -149,9 +149,9 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio, | |||
| 149 | static int blk_hw_contig_segment(struct request_queue *q, struct bio *bio, | 149 | static int blk_hw_contig_segment(struct request_queue *q, struct bio *bio, |
| 150 | struct bio *nxt) | 150 | struct bio *nxt) |
| 151 | { | 151 | { |
| 152 | if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) | 152 | if (!bio_flagged(bio, BIO_SEG_VALID)) |
| 153 | blk_recount_segments(q, bio); | 153 | blk_recount_segments(q, bio); |
| 154 | if (unlikely(!bio_flagged(nxt, BIO_SEG_VALID))) | 154 | if (!bio_flagged(nxt, BIO_SEG_VALID)) |
| 155 | blk_recount_segments(q, nxt); | 155 | blk_recount_segments(q, nxt); |
| 156 | if (!BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)) || | 156 | if (!BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)) || |
| 157 | BIOVEC_VIRT_OVERSIZE(bio->bi_hw_back_size + nxt->bi_hw_front_size)) | 157 | BIOVEC_VIRT_OVERSIZE(bio->bi_hw_back_size + nxt->bi_hw_front_size)) |
| @@ -312,9 +312,9 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req, | |||
| 312 | q->last_merge = NULL; | 312 | q->last_merge = NULL; |
| 313 | return 0; | 313 | return 0; |
| 314 | } | 314 | } |
| 315 | if (unlikely(!bio_flagged(req->biotail, BIO_SEG_VALID))) | 315 | if (!bio_flagged(req->biotail, BIO_SEG_VALID)) |
| 316 | blk_recount_segments(q, req->biotail); | 316 | blk_recount_segments(q, req->biotail); |
| 317 | if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) | 317 | if (!bio_flagged(bio, BIO_SEG_VALID)) |
| 318 | blk_recount_segments(q, bio); | 318 | blk_recount_segments(q, bio); |
| 319 | len = req->biotail->bi_hw_back_size + bio->bi_hw_front_size; | 319 | len = req->biotail->bi_hw_back_size + bio->bi_hw_front_size; |
| 320 | if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail), __BVEC_START(bio)) | 320 | if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail), __BVEC_START(bio)) |
| @@ -352,9 +352,9 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req, | |||
| 352 | return 0; | 352 | return 0; |
| 353 | } | 353 | } |
| 354 | len = bio->bi_hw_back_size + req->bio->bi_hw_front_size; | 354 | len = bio->bi_hw_back_size + req->bio->bi_hw_front_size; |
| 355 | if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) | 355 | if (!bio_flagged(bio, BIO_SEG_VALID)) |
| 356 | blk_recount_segments(q, bio); | 356 | blk_recount_segments(q, bio); |
| 357 | if (unlikely(!bio_flagged(req->bio, BIO_SEG_VALID))) | 357 | if (!bio_flagged(req->bio, BIO_SEG_VALID)) |
| 358 | blk_recount_segments(q, req->bio); | 358 | blk_recount_segments(q, req->bio); |
| 359 | if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(req->bio)) && | 359 | if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(req->bio)) && |
| 360 | !BIOVEC_VIRT_OVERSIZE(len)) { | 360 | !BIOVEC_VIRT_OVERSIZE(len)) { |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index e85c4013e8a2..304ec73ab821 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
| @@ -146,11 +146,13 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page, | |||
| 146 | unsigned long nm; | 146 | unsigned long nm; |
| 147 | ssize_t ret = queue_var_store(&nm, page, count); | 147 | ssize_t ret = queue_var_store(&nm, page, count); |
| 148 | 148 | ||
| 149 | spin_lock_irq(q->queue_lock); | ||
| 149 | if (nm) | 150 | if (nm) |
| 150 | set_bit(QUEUE_FLAG_NOMERGES, &q->queue_flags); | 151 | queue_flag_set(QUEUE_FLAG_NOMERGES, q); |
| 151 | else | 152 | else |
| 152 | clear_bit(QUEUE_FLAG_NOMERGES, &q->queue_flags); | 153 | queue_flag_clear(QUEUE_FLAG_NOMERGES, q); |
| 153 | 154 | ||
| 155 | spin_unlock_irq(q->queue_lock); | ||
| 154 | return ret; | 156 | return ret; |
| 155 | } | 157 | } |
| 156 | 158 | ||
diff --git a/block/blk-tag.c b/block/blk-tag.c index de64e0429977..32667beb03ee 100644 --- a/block/blk-tag.c +++ b/block/blk-tag.c | |||
| @@ -70,7 +70,7 @@ void __blk_queue_free_tags(struct request_queue *q) | |||
| 70 | __blk_free_tags(bqt); | 70 | __blk_free_tags(bqt); |
| 71 | 71 | ||
| 72 | q->queue_tags = NULL; | 72 | q->queue_tags = NULL; |
| 73 | queue_flag_clear(QUEUE_FLAG_QUEUED, q); | 73 | queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | /** | 76 | /** |
| @@ -98,7 +98,7 @@ EXPORT_SYMBOL(blk_free_tags); | |||
| 98 | **/ | 98 | **/ |
| 99 | void blk_queue_free_tags(struct request_queue *q) | 99 | void blk_queue_free_tags(struct request_queue *q) |
| 100 | { | 100 | { |
| 101 | queue_flag_clear(QUEUE_FLAG_QUEUED, q); | 101 | queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q); |
| 102 | } | 102 | } |
| 103 | EXPORT_SYMBOL(blk_queue_free_tags); | 103 | EXPORT_SYMBOL(blk_queue_free_tags); |
| 104 | 104 | ||
| @@ -171,6 +171,9 @@ EXPORT_SYMBOL(blk_init_tags); | |||
| 171 | * @q: the request queue for the device | 171 | * @q: the request queue for the device |
| 172 | * @depth: the maximum queue depth supported | 172 | * @depth: the maximum queue depth supported |
| 173 | * @tags: the tag to use | 173 | * @tags: the tag to use |
| 174 | * | ||
| 175 | * Queue lock must be held here if the function is called to resize an | ||
| 176 | * existing map. | ||
| 174 | **/ | 177 | **/ |
| 175 | int blk_queue_init_tags(struct request_queue *q, int depth, | 178 | int blk_queue_init_tags(struct request_queue *q, int depth, |
| 176 | struct blk_queue_tag *tags) | 179 | struct blk_queue_tag *tags) |
| @@ -197,7 +200,7 @@ int blk_queue_init_tags(struct request_queue *q, int depth, | |||
| 197 | * assign it, all done | 200 | * assign it, all done |
| 198 | */ | 201 | */ |
| 199 | q->queue_tags = tags; | 202 | q->queue_tags = tags; |
| 200 | queue_flag_set(QUEUE_FLAG_QUEUED, q); | 203 | queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, q); |
| 201 | INIT_LIST_HEAD(&q->tag_busy_list); | 204 | INIT_LIST_HEAD(&q->tag_busy_list); |
| 202 | return 0; | 205 | return 0; |
| 203 | fail: | 206 | fail: |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index f4e1006c253d..b399c62936e0 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
| @@ -1142,6 +1142,17 @@ static void cfq_put_queue(struct cfq_queue *cfqq) | |||
| 1142 | kmem_cache_free(cfq_pool, cfqq); | 1142 | kmem_cache_free(cfq_pool, cfqq); |
| 1143 | } | 1143 | } |
| 1144 | 1144 | ||
| 1145 | static void | ||
| 1146 | __call_for_each_cic(struct io_context *ioc, | ||
| 1147 | void (*func)(struct io_context *, struct cfq_io_context *)) | ||
| 1148 | { | ||
| 1149 | struct cfq_io_context *cic; | ||
| 1150 | struct hlist_node *n; | ||
| 1151 | |||
| 1152 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) | ||
| 1153 | func(ioc, cic); | ||
| 1154 | } | ||
| 1155 | |||
| 1145 | /* | 1156 | /* |
| 1146 | * Call func for each cic attached to this ioc. | 1157 | * Call func for each cic attached to this ioc. |
| 1147 | */ | 1158 | */ |
| @@ -1149,12 +1160,8 @@ static void | |||
| 1149 | call_for_each_cic(struct io_context *ioc, | 1160 | call_for_each_cic(struct io_context *ioc, |
| 1150 | void (*func)(struct io_context *, struct cfq_io_context *)) | 1161 | void (*func)(struct io_context *, struct cfq_io_context *)) |
| 1151 | { | 1162 | { |
| 1152 | struct cfq_io_context *cic; | ||
| 1153 | struct hlist_node *n; | ||
| 1154 | |||
| 1155 | rcu_read_lock(); | 1163 | rcu_read_lock(); |
| 1156 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) | 1164 | __call_for_each_cic(ioc, func); |
| 1157 | func(ioc, cic); | ||
| 1158 | rcu_read_unlock(); | 1165 | rcu_read_unlock(); |
| 1159 | } | 1166 | } |
| 1160 | 1167 | ||
| @@ -1198,7 +1205,7 @@ static void cfq_free_io_context(struct io_context *ioc) | |||
| 1198 | * should be ok to iterate over the known list, we will see all cic's | 1205 | * should be ok to iterate over the known list, we will see all cic's |
| 1199 | * since no new ones are added. | 1206 | * since no new ones are added. |
| 1200 | */ | 1207 | */ |
| 1201 | call_for_each_cic(ioc, cic_free_func); | 1208 | __call_for_each_cic(ioc, cic_free_func); |
| 1202 | } | 1209 | } |
| 1203 | 1210 | ||
| 1204 | static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq) | 1211 | static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
| @@ -1296,10 +1303,10 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq, struct io_context *ioc) | |||
| 1296 | printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); | 1303 | printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); |
| 1297 | case IOPRIO_CLASS_NONE: | 1304 | case IOPRIO_CLASS_NONE: |
| 1298 | /* | 1305 | /* |
| 1299 | * no prio set, place us in the middle of the BE classes | 1306 | * no prio set, inherit CPU scheduling settings |
| 1300 | */ | 1307 | */ |
| 1301 | cfqq->ioprio = task_nice_ioprio(tsk); | 1308 | cfqq->ioprio = task_nice_ioprio(tsk); |
| 1302 | cfqq->ioprio_class = IOPRIO_CLASS_BE; | 1309 | cfqq->ioprio_class = task_nice_ioclass(tsk); |
| 1303 | break; | 1310 | break; |
| 1304 | case IOPRIO_CLASS_RT: | 1311 | case IOPRIO_CLASS_RT: |
| 1305 | cfqq->ioprio = task_ioprio(ioc); | 1312 | cfqq->ioprio = task_ioprio(ioc); |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 8fc429cf82b6..41f818be2f7e 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
| @@ -755,11 +755,13 @@ diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector | |||
| 755 | { | 755 | { |
| 756 | unsigned long n_sect = bio->bi_size >> 9; | 756 | unsigned long n_sect = bio->bi_size >> 9; |
| 757 | const int rw = bio_data_dir(bio); | 757 | const int rw = bio_data_dir(bio); |
| 758 | struct hd_struct *part; | ||
| 758 | 759 | ||
| 759 | all_stat_inc(disk, ios[rw], sector); | 760 | part = get_part(disk, sector); |
| 760 | all_stat_add(disk, ticks[rw], duration, sector); | 761 | all_stat_inc(disk, part, ios[rw], sector); |
| 761 | all_stat_add(disk, sectors[rw], n_sect, sector); | 762 | all_stat_add(disk, part, ticks[rw], duration, sector); |
| 762 | all_stat_add(disk, io_ticks, duration, sector); | 763 | all_stat_add(disk, part, sectors[rw], n_sect, sector); |
| 764 | all_stat_add(disk, part, io_ticks, duration, sector); | ||
| 763 | } | 765 | } |
| 764 | 766 | ||
| 765 | void | 767 | void |
| @@ -158,7 +158,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) | |||
| 158 | 158 | ||
| 159 | bio_init(bio); | 159 | bio_init(bio); |
| 160 | if (likely(nr_iovecs)) { | 160 | if (likely(nr_iovecs)) { |
| 161 | unsigned long idx = 0; /* shut up gcc */ | 161 | unsigned long uninitialized_var(idx); |
| 162 | 162 | ||
| 163 | bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs); | 163 | bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs); |
| 164 | if (unlikely(!bvl)) { | 164 | if (unlikely(!bvl)) { |
| @@ -963,6 +963,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err) | |||
| 963 | * @data: pointer to buffer to copy | 963 | * @data: pointer to buffer to copy |
| 964 | * @len: length in bytes | 964 | * @len: length in bytes |
| 965 | * @gfp_mask: allocation flags for bio and page allocation | 965 | * @gfp_mask: allocation flags for bio and page allocation |
| 966 | * @reading: data direction is READ | ||
| 966 | * | 967 | * |
| 967 | * copy the kernel address into a bio suitable for io to a block | 968 | * copy the kernel address into a bio suitable for io to a block |
| 968 | * device. Returns an error pointer in case of error. | 969 | * device. Returns an error pointer in case of error. |
diff --git a/fs/splice.c b/fs/splice.c index 633f58ebfb72..78150038b584 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
| @@ -811,24 +811,19 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
| 811 | { | 811 | { |
| 812 | struct address_space *mapping = out->f_mapping; | 812 | struct address_space *mapping = out->f_mapping; |
| 813 | struct inode *inode = mapping->host; | 813 | struct inode *inode = mapping->host; |
| 814 | int killsuid, killpriv; | 814 | struct splice_desc sd = { |
| 815 | .total_len = len, | ||
| 816 | .flags = flags, | ||
| 817 | .pos = *ppos, | ||
| 818 | .u.file = out, | ||
| 819 | }; | ||
| 815 | ssize_t ret; | 820 | ssize_t ret; |
| 816 | int err = 0; | ||
| 817 | |||
| 818 | killpriv = security_inode_need_killpriv(out->f_path.dentry); | ||
| 819 | killsuid = should_remove_suid(out->f_path.dentry); | ||
| 820 | if (unlikely(killsuid || killpriv)) { | ||
| 821 | mutex_lock(&inode->i_mutex); | ||
| 822 | if (killpriv) | ||
| 823 | err = security_inode_killpriv(out->f_path.dentry); | ||
| 824 | if (!err && killsuid) | ||
| 825 | err = __remove_suid(out->f_path.dentry, killsuid); | ||
| 826 | mutex_unlock(&inode->i_mutex); | ||
| 827 | if (err) | ||
| 828 | return err; | ||
| 829 | } | ||
| 830 | 821 | ||
| 831 | ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); | 822 | inode_double_lock(inode, pipe->inode); |
| 823 | ret = remove_suid(out->f_path.dentry); | ||
| 824 | if (likely(!ret)) | ||
| 825 | ret = __splice_from_pipe(pipe, &sd, pipe_to_file); | ||
| 826 | inode_double_unlock(inode, pipe->inode); | ||
| 832 | if (ret > 0) { | 827 | if (ret > 0) { |
| 833 | unsigned long nr_pages; | 828 | unsigned long nr_pages; |
| 834 | 829 | ||
| @@ -840,6 +835,8 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
| 840 | * sync it. | 835 | * sync it. |
| 841 | */ | 836 | */ |
| 842 | if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { | 837 | if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { |
| 838 | int err; | ||
| 839 | |||
| 843 | mutex_lock(&inode->i_mutex); | 840 | mutex_lock(&inode->i_mutex); |
| 844 | err = generic_osync_inode(inode, mapping, | 841 | err = generic_osync_inode(inode, mapping, |
| 845 | OSYNC_METADATA|OSYNC_DATA); | 842 | OSYNC_METADATA|OSYNC_DATA); |
| @@ -1075,7 +1072,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | |||
| 1075 | 1072 | ||
| 1076 | ret = splice_direct_to_actor(in, &sd, direct_splice_actor); | 1073 | ret = splice_direct_to_actor(in, &sd, direct_splice_actor); |
| 1077 | if (ret > 0) | 1074 | if (ret > 0) |
| 1078 | *ppos = sd.pos; | 1075 | *ppos += ret; |
| 1079 | 1076 | ||
| 1080 | return ret; | 1077 | return ret; |
| 1081 | } | 1078 | } |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7e0fa9e64479..f413085f748e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1816,7 +1816,6 @@ extern void iget_failed(struct inode *); | |||
| 1816 | extern void clear_inode(struct inode *); | 1816 | extern void clear_inode(struct inode *); |
| 1817 | extern void destroy_inode(struct inode *); | 1817 | extern void destroy_inode(struct inode *); |
| 1818 | extern struct inode *new_inode(struct super_block *); | 1818 | extern struct inode *new_inode(struct super_block *); |
| 1819 | extern int __remove_suid(struct dentry *, int); | ||
| 1820 | extern int should_remove_suid(struct dentry *); | 1819 | extern int should_remove_suid(struct dentry *); |
| 1821 | extern int remove_suid(struct dentry *); | 1820 | extern int remove_suid(struct dentry *); |
| 1822 | 1821 | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index ecd2bf63fc84..e9874e7fcdf9 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -178,17 +178,17 @@ static inline struct hd_struct *get_part(struct gendisk *gendiskp, | |||
| 178 | 178 | ||
| 179 | static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { | 179 | static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { |
| 180 | int i; | 180 | int i; |
| 181 | |||
| 181 | for_each_possible_cpu(i) | 182 | for_each_possible_cpu(i) |
| 182 | memset(per_cpu_ptr(gendiskp->dkstats, i), value, | 183 | memset(per_cpu_ptr(gendiskp->dkstats, i), value, |
| 183 | sizeof (struct disk_stats)); | 184 | sizeof(struct disk_stats)); |
| 184 | } | 185 | } |
| 185 | 186 | ||
| 186 | #define __part_stat_add(part, field, addnd) \ | 187 | #define __part_stat_add(part, field, addnd) \ |
| 187 | (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd) | 188 | (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd) |
| 188 | 189 | ||
| 189 | #define __all_stat_add(gendiskp, field, addnd, sector) \ | 190 | #define __all_stat_add(gendiskp, part, field, addnd, sector) \ |
| 190 | ({ \ | 191 | ({ \ |
| 191 | struct hd_struct *part = get_part(gendiskp, sector); \ | ||
| 192 | if (part) \ | 192 | if (part) \ |
| 193 | __part_stat_add(part, field, addnd); \ | 193 | __part_stat_add(part, field, addnd); \ |
| 194 | __disk_stat_add(gendiskp, field, addnd); \ | 194 | __disk_stat_add(gendiskp, field, addnd); \ |
| @@ -203,11 +203,13 @@ static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { | |||
| 203 | res; \ | 203 | res; \ |
| 204 | }) | 204 | }) |
| 205 | 205 | ||
| 206 | static inline void part_stat_set_all(struct hd_struct *part, int value) { | 206 | static inline void part_stat_set_all(struct hd_struct *part, int value) |
| 207 | { | ||
| 207 | int i; | 208 | int i; |
| 209 | |||
| 208 | for_each_possible_cpu(i) | 210 | for_each_possible_cpu(i) |
| 209 | memset(per_cpu_ptr(part->dkstats, i), value, | 211 | memset(per_cpu_ptr(part->dkstats, i), value, |
| 210 | sizeof(struct disk_stats)); | 212 | sizeof(struct disk_stats)); |
| 211 | } | 213 | } |
| 212 | 214 | ||
| 213 | #else /* !CONFIG_SMP */ | 215 | #else /* !CONFIG_SMP */ |
| @@ -223,9 +225,8 @@ static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) | |||
| 223 | #define __part_stat_add(part, field, addnd) \ | 225 | #define __part_stat_add(part, field, addnd) \ |
| 224 | (part->dkstats.field += addnd) | 226 | (part->dkstats.field += addnd) |
| 225 | 227 | ||
| 226 | #define __all_stat_add(gendiskp, field, addnd, sector) \ | 228 | #define __all_stat_add(gendiskp, part, field, addnd, sector) \ |
| 227 | ({ \ | 229 | ({ \ |
| 228 | struct hd_struct *part = get_part(gendiskp, sector); \ | ||
| 229 | if (part) \ | 230 | if (part) \ |
| 230 | part->dkstats.field += addnd; \ | 231 | part->dkstats.field += addnd; \ |
| 231 | __disk_stat_add(gendiskp, field, addnd); \ | 232 | __disk_stat_add(gendiskp, field, addnd); \ |
| @@ -276,10 +277,10 @@ static inline void part_stat_set_all(struct hd_struct *part, int value) | |||
| 276 | #define part_stat_sub(gendiskp, field, subnd) \ | 277 | #define part_stat_sub(gendiskp, field, subnd) \ |
| 277 | part_stat_add(gendiskp, field, -subnd) | 278 | part_stat_add(gendiskp, field, -subnd) |
| 278 | 279 | ||
| 279 | #define all_stat_add(gendiskp, field, addnd, sector) \ | 280 | #define all_stat_add(gendiskp, part, field, addnd, sector) \ |
| 280 | do { \ | 281 | do { \ |
| 281 | preempt_disable(); \ | 282 | preempt_disable(); \ |
| 282 | __all_stat_add(gendiskp, field, addnd, sector); \ | 283 | __all_stat_add(gendiskp, part, field, addnd, sector); \ |
| 283 | preempt_enable(); \ | 284 | preempt_enable(); \ |
| 284 | } while (0) | 285 | } while (0) |
| 285 | 286 | ||
| @@ -288,15 +289,15 @@ static inline void part_stat_set_all(struct hd_struct *part, int value) | |||
| 288 | #define all_stat_dec(gendiskp, field, sector) \ | 289 | #define all_stat_dec(gendiskp, field, sector) \ |
| 289 | all_stat_add(gendiskp, field, -1, sector) | 290 | all_stat_add(gendiskp, field, -1, sector) |
| 290 | 291 | ||
| 291 | #define __all_stat_inc(gendiskp, field, sector) \ | 292 | #define __all_stat_inc(gendiskp, part, field, sector) \ |
| 292 | __all_stat_add(gendiskp, field, 1, sector) | 293 | __all_stat_add(gendiskp, part, field, 1, sector) |
| 293 | #define all_stat_inc(gendiskp, field, sector) \ | 294 | #define all_stat_inc(gendiskp, part, field, sector) \ |
| 294 | all_stat_add(gendiskp, field, 1, sector) | 295 | all_stat_add(gendiskp, part, field, 1, sector) |
| 295 | 296 | ||
| 296 | #define __all_stat_sub(gendiskp, field, subnd, sector) \ | 297 | #define __all_stat_sub(gendiskp, part, field, subnd, sector) \ |
| 297 | __all_stat_add(gendiskp, field, -subnd, sector) | 298 | __all_stat_add(gendiskp, part, field, -subnd, sector) |
| 298 | #define all_stat_sub(gendiskp, field, subnd, sector) \ | 299 | #define all_stat_sub(gendiskp, part, field, subnd, sector) \ |
| 299 | all_stat_add(gendiskp, field, -subnd, sector) | 300 | all_stat_add(gendiskp, part, field, -subnd, sector) |
| 300 | 301 | ||
| 301 | /* Inlines to alloc and free disk stats in struct gendisk */ | 302 | /* Inlines to alloc and free disk stats in struct gendisk */ |
| 302 | #ifdef CONFIG_SMP | 303 | #ifdef CONFIG_SMP |
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h index 2a3bb1bb7433..f98a656b17e5 100644 --- a/include/linux/ioprio.h +++ b/include/linux/ioprio.h | |||
| @@ -68,6 +68,20 @@ static inline int task_nice_ioprio(struct task_struct *task) | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | /* | 70 | /* |
| 71 | * This is for the case where the task hasn't asked for a specific IO class. | ||
| 72 | * Check for idle and rt task process, and return appropriate IO class. | ||
| 73 | */ | ||
| 74 | static inline int task_nice_ioclass(struct task_struct *task) | ||
| 75 | { | ||
| 76 | if (task->policy == SCHED_IDLE) | ||
| 77 | return IOPRIO_CLASS_IDLE; | ||
| 78 | else if (task->policy == SCHED_FIFO || task->policy == SCHED_RR) | ||
| 79 | return IOPRIO_CLASS_RT; | ||
| 80 | else | ||
| 81 | return IOPRIO_CLASS_BE; | ||
| 82 | } | ||
| 83 | |||
| 84 | /* | ||
| 71 | * For inheritance, return the highest of the two given priorities | 85 | * For inheritance, return the highest of the two given priorities |
| 72 | */ | 86 | */ |
| 73 | extern int ioprio_best(unsigned short aprio, unsigned short bprio); | 87 | extern int ioprio_best(unsigned short aprio, unsigned short bprio); |
diff --git a/kernel/relay.c b/kernel/relay.c index 7de644cdec43..bc24dcdc570f 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
| @@ -1191,7 +1191,7 @@ static ssize_t relay_file_splice_read(struct file *in, | |||
| 1191 | ret = 0; | 1191 | ret = 0; |
| 1192 | spliced = 0; | 1192 | spliced = 0; |
| 1193 | 1193 | ||
| 1194 | while (len && !spliced) { | 1194 | while (len) { |
| 1195 | ret = subbuf_splice_actor(in, ppos, pipe, len, flags, &nonpad_ret); | 1195 | ret = subbuf_splice_actor(in, ppos, pipe, len, flags, &nonpad_ret); |
| 1196 | if (ret < 0) | 1196 | if (ret < 0) |
| 1197 | break; | 1197 | break; |
diff --git a/mm/filemap.c b/mm/filemap.c index 239d36163bbe..2dead9adf8b7 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
| @@ -1655,7 +1655,7 @@ int should_remove_suid(struct dentry *dentry) | |||
| 1655 | } | 1655 | } |
| 1656 | EXPORT_SYMBOL(should_remove_suid); | 1656 | EXPORT_SYMBOL(should_remove_suid); |
| 1657 | 1657 | ||
| 1658 | int __remove_suid(struct dentry *dentry, int kill) | 1658 | static int __remove_suid(struct dentry *dentry, int kill) |
| 1659 | { | 1659 | { |
| 1660 | struct iattr newattrs; | 1660 | struct iattr newattrs; |
| 1661 | 1661 | ||
