struct best *best = xmalloc(sizeof(struct best)*(chunks+1));
int i;
struct file asmall, bsmall;
+ int xmin;
asmall = reduce(a);
bsmall = reduce(b);
free(bsmall.list);
csl1 = NULL;
+ xmin = 0;
for (i = 1; i <= chunks; i++)
if (best[i].val > 0) {
+ /* If we there are any newlines in the hunk before
+ * ylo, then extend xlo back that many newlines if
+ * possible and diff_partial the extended regions.
+ */
+ int lines = 0;
+ int ylo = best[i].ylo;
+ int yhi;
+ while (ylo > 0 && b.list[ylo-1].start[0]) {
+ ylo--;
+ lines += !!ends_line(b.list[ylo]);
+ }
+ if (lines) {
+ int xlo = best[i].xlo;
+ while (lines && xlo > xmin) {
+ xlo--;
+ lines -= !!ends_line(a.list[xlo]);
+ }
+ while (xlo > xmin && !ends_line(a.list[xlo-1]))
+ xlo--;
+ csl2 = diff_partial(a, b,
+ xlo, best[i].xlo,
+ ylo, best[i].ylo);
+ csl1 = csl_join(csl1, csl2);
+ }
+
+ /* Now diff_partial the good bit of the hunk with the
+ * good match
+ */
csl2 = diff_partial(a, b,
best[i].xlo, best[i].xhi,
best[i].ylo, best[i].yhi);
csl1 = csl_join(csl1, csl2);
+
+ /* Now if there are newlines at the end of the
+ * hunk that weren't matched, find as many in
+ * original and diff_partial those bits
+ */
+ lines = 0;
+ yhi = best[i].yhi;
+ while (yhi < b.elcnt && b.list[yhi].start[0]) {
+ lines += !!ends_line(b.list[yhi]);
+ yhi++;
+ }
+ xmin = best[i].xhi;
+ if (lines) {
+ int xhi = best[i].xhi;
+ int xmax = a.elcnt;
+ if (i < chunks)
+ xmax = best[i+1].xlo;
+ while (lines && xhi < xmax) {
+ lines -= !!ends_line(a.list[xhi]);
+ xhi++;
+ }
+ csl2 = diff_partial(a, b,
+ best[i].xhi, xhi,
+ best[i].yhi, yhi);
+ csl1 = csl_join(csl1, csl2);
+ xmin = xhi;
+ }
+ } else {
+ /* FIXME we just lost a hunk!! */;
}
if (csl1) {
for (csl2 = csl1; csl2->len; csl2++)
raid1_shrink_buffers(conf);
return -ENOMEM;
}
+
+static void end_sync_read(struct buffer_head *bh, int uptodate)
|||||||
if (!sector_nr)
if (init_resync(conf))
return -ENOMEM;
/*
+ * If there is non-resync activity waiting for us then
+ * put in a delay to throttle resync.
=======
if (sector_nr == 0)
if (init_resync(conf))
}
/*
+ * If there is non-resync activity waiting for us then
+ * put in a delay to throttle resync.
>>>>>>>
-
-static void end_sync_read(struct buffer_head *bh, int uptodate)
{
struct raid1_bh * r1_bh = (struct raid1_bh *)(bh->b_private);
md_error (r1_bh->mddev, bh->b_dev);
if (atomic_dec_and_test(&r1_bh->remaining)) {
mddev_t *mddev = r1_bh->mddev;
+<<<<<<<
unsigned long sect = bh->b_blocknr;
int size = bh->b_size;
raid1_free_buf(r1_bh);
sync_request_done(sect, mddev_to_conf(mddev));
md_done_sync(mddev,size>>9, uptodate);
+|||||||
+ r1_bio->sector = sector_nr;
+ r1_bio->cmd = SPECIAL;
+
+ max_sector = mddev->sb->size << 1;
+ if (sector_nr >= max_sector)
+ BUG();
+
+=======
+ r1_bio->sector = sector_nr;
+ r1_bio->cmd = SPECIAL;
+
+>>>>>>>
}
}
bio_list_add(&conf->pending_bio_list, mbio);
spin_unlock_irqrestore(&conf->device_lock, flags);
}
+ r1_bio_write_done(r1_bio);
|||||||
test_bit(R1BIO_BehindIO, &r1_bio->state));
spin_lock_irqsave(&conf->device_lock, flags);
bio_list_merge(&conf->pending_bio_list, &bl);
bio_list_init(&bl);
+ blk_plug_device(mddev->queue);
=======
test_bit(R1BIO_BehindIO, &r1_bio->state));
spin_lock_irqsave(&conf->device_lock, flags);
conf->pending_count += bl_count;
bio_list_init(&bl);
+ blk_plug_device(mddev->queue);
>>>>>>>
- r1_bio_write_done(r1_bio);
/* In case raid1d snuck in to freeze_array */
wake_up(&conf->wait_barrier);
conf->last_used = -1;
for (i = 0; i < conf->raid_disks; i++) {
+|||||||
+ bio_list_init(&conf->flushing_bio_list);
+
+
+=======
+ conf->pending_count = 0;
+ bio_list_init(&conf->flushing_bio_list);
+
+
+>>>>>>>
disk = conf->mirrors + i;
MODULE_ALIAS("md-level-1");
module_param(max_queued, int, S_IRUGO|S_IWUSR);
-|||||||
- bio_list_init(&conf->flushing_bio_list);
-
-
-=======
- conf->pending_count = 0;
- bio_list_init(&conf->flushing_bio_list);
-
-
->>>>>>>