~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/md/linear.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <linux/blkdev.h>
20
20
#include <linux/raid/md_u.h>
21
21
#include <linux/seq_file.h>
 
22
#include <linux/slab.h>
22
23
#include "md.h"
23
24
#include "linear.h"
24
25
 
158
159
                sector_t sectors;
159
160
 
160
161
                if (j < 0 || j >= raid_disks || disk->rdev) {
161
 
                        printk("linear: disk numbering problem. Aborting!\n");
 
162
                        printk(KERN_ERR "md/linear:%s: disk numbering problem. Aborting!\n",
 
163
                               mdname(mddev));
162
164
                        goto out;
163
165
                }
164
166
 
172
174
                disk_stack_limits(mddev->gendisk, rdev->bdev,
173
175
                                  rdev->data_offset << 9);
174
176
                /* as we don't honour merge_bvec_fn, we must never risk
175
 
                 * violating it, so limit ->max_sector to one PAGE, as
176
 
                 * a one page request is never in violation.
 
177
                 * violating it, so limit max_segments to 1 lying within
 
178
                 * a single page.
177
179
                 */
178
 
                if (rdev->bdev->bd_disk->queue->merge_bvec_fn &&
179
 
                    queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9))
180
 
                        blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);
 
180
                if (rdev->bdev->bd_disk->queue->merge_bvec_fn) {
 
181
                        blk_queue_max_segments(mddev->queue, 1);
 
182
                        blk_queue_segment_boundary(mddev->queue,
 
183
                                                   PAGE_CACHE_SIZE - 1);
 
184
                }
181
185
 
182
186
                conf->array_sectors += rdev->sectors;
183
187
                cnt++;
184
188
 
185
189
        }
186
190
        if (cnt != raid_disks) {
187
 
                printk("linear: not enough drives present. Aborting!\n");
 
191
                printk(KERN_ERR "md/linear:%s: not enough drives present. Aborting!\n",
 
192
                       mdname(mddev));
188
193
                goto out;
189
194
        }
190
195
 
211
216
 
212
217
        if (md_check_no_bitmap(mddev))
213
218
                return -EINVAL;
214
 
        mddev->queue->queue_lock = &mddev->queue->__queue_lock;
215
219
        conf = linear_conf(mddev, mddev->raid_disks);
216
220
 
217
221
        if (!conf)
279
283
        rcu_barrier();
280
284
        blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
281
285
        kfree(conf);
 
286
        mddev->private = NULL;
282
287
 
283
288
        return 0;
284
289
}
285
290
 
286
 
static int linear_make_request (struct request_queue *q, struct bio *bio)
 
291
static int linear_make_request (mddev_t *mddev, struct bio *bio)
287
292
{
288
 
        const int rw = bio_data_dir(bio);
289
 
        mddev_t *mddev = q->queuedata;
290
293
        dev_info_t *tmp_dev;
291
294
        sector_t start_sector;
292
 
        int cpu;
293
295
 
294
 
        if (unlikely(bio_rw_flagged(bio, BIO_RW_BARRIER))) {
295
 
                bio_endio(bio, -EOPNOTSUPP);
 
296
        if (unlikely(bio->bi_rw & REQ_FLUSH)) {
 
297
                md_flush_request(mddev, bio);
296
298
                return 0;
297
299
        }
298
300
 
299
 
        cpu = part_stat_lock();
300
 
        part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]);
301
 
        part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw],
302
 
                      bio_sectors(bio));
303
 
        part_stat_unlock();
304
 
 
305
301
        rcu_read_lock();
306
302
        tmp_dev = which_dev(mddev, bio->bi_sector);
307
303
        start_sector = tmp_dev->end_sector - tmp_dev->rdev->sectors;
311
307
                     || (bio->bi_sector < start_sector))) {
312
308
                char b[BDEVNAME_SIZE];
313
309
 
314
 
                printk("linear_make_request: Sector %llu out of bounds on "
315
 
                        "dev %s: %llu sectors, offset %llu\n",
316
 
                        (unsigned long long)bio->bi_sector,
317
 
                        bdevname(tmp_dev->rdev->bdev, b),
318
 
                        (unsigned long long)tmp_dev->rdev->sectors,
319
 
                        (unsigned long long)start_sector);
 
310
                printk(KERN_ERR
 
311
                       "md/linear:%s: make_request: Sector %llu out of bounds on "
 
312
                       "dev %s: %llu sectors, offset %llu\n",
 
313
                       mdname(mddev),
 
314
                       (unsigned long long)bio->bi_sector,
 
315
                       bdevname(tmp_dev->rdev->bdev, b),
 
316
                       (unsigned long long)tmp_dev->rdev->sectors,
 
317
                       (unsigned long long)start_sector);
320
318
                rcu_read_unlock();
321
319
                bio_io_error(bio);
322
320
                return 0;
333
331
 
334
332
                bp = bio_split(bio, end_sector - bio->bi_sector);
335
333
 
336
 
                if (linear_make_request(q, &bp->bio1))
 
334
                if (linear_make_request(mddev, &bp->bio1))
337
335
                        generic_make_request(&bp->bio1);
338
 
                if (linear_make_request(q, &bp->bio2))
 
336
                if (linear_make_request(mddev, &bp->bio2))
339
337
                        generic_make_request(&bp->bio2);
340
338
                bio_pair_release(bp);
341
339
                return 0;
383
381
module_init(linear_init);
384
382
module_exit(linear_exit);
385
383
MODULE_LICENSE("GPL");
 
384
MODULE_DESCRIPTION("Linear device concatenation personality for MD");
386
385
MODULE_ALIAS("md-personality-1"); /* LINEAR - deprecated*/
387
386
MODULE_ALIAS("md-linear");
388
387
MODULE_ALIAS("md-level--1");