dm.c (03022c54b9725026c0370a810168975c387ad04c) | dm.c (f88fb981183e71daf40bbd84bc8251bbf7b59e19) |
---|---|
1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 33 unchanged lines hidden (view full) --- 42 * One of these is allocated per bio. 43 */ 44struct dm_io { 45 struct mapped_device *md; 46 int error; 47 atomic_t io_count; 48 struct bio *bio; 49 unsigned long start_time; | 1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 33 unchanged lines hidden (view full) --- 42 * One of these is allocated per bio. 43 */ 44struct dm_io { 45 struct mapped_device *md; 46 int error; 47 atomic_t io_count; 48 struct bio *bio; 49 unsigned long start_time; |
50 spinlock_t endio_lock; |
|
50}; 51 52/* 53 * For bio-based dm. 54 * One of these is allocated per target within a bio. Hopefully 55 * this will be simplified out one day. 56 */ 57struct dm_target_io { --- 515 unchanged lines hidden (view full) --- 573static void dec_pending(struct dm_io *io, int error) 574{ 575 unsigned long flags; 576 int io_error; 577 struct bio *bio; 578 struct mapped_device *md = io->md; 579 580 /* Push-back supersedes any I/O errors */ | 51}; 52 53/* 54 * For bio-based dm. 55 * One of these is allocated per target within a bio. Hopefully 56 * this will be simplified out one day. 57 */ 58struct dm_target_io { --- 515 unchanged lines hidden (view full) --- 574static void dec_pending(struct dm_io *io, int error) 575{ 576 unsigned long flags; 577 int io_error; 578 struct bio *bio; 579 struct mapped_device *md = io->md; 580 581 /* Push-back supersedes any I/O errors */ |
581 if (error && !(io->error > 0 && __noflush_suspending(md))) 582 io->error = error; | 582 if (unlikely(error)) { 583 spin_lock_irqsave(&io->endio_lock, flags); 584 if (!(io->error > 0 && __noflush_suspending(md))) 585 io->error = error; 586 spin_unlock_irqrestore(&io->endio_lock, flags); 587 } |
583 584 if (atomic_dec_and_test(&io->io_count)) { 585 if (io->error == DM_ENDIO_REQUEUE) { 586 /* 587 * Target requested pushing back the I/O. 588 */ 589 spin_lock_irqsave(&md->deferred_lock, flags); 590 if (__noflush_suspending(md)) { --- 630 unchanged lines hidden (view full) --- 1221 1222 ci.md = md; 1223 ci.bio = bio; 1224 ci.io = alloc_io(md); 1225 ci.io->error = 0; 1226 atomic_set(&ci.io->io_count, 1); 1227 ci.io->bio = bio; 1228 ci.io->md = md; | 588 589 if (atomic_dec_and_test(&io->io_count)) { 590 if (io->error == DM_ENDIO_REQUEUE) { 591 /* 592 * Target requested pushing back the I/O. 593 */ 594 spin_lock_irqsave(&md->deferred_lock, flags); 595 if (__noflush_suspending(md)) { --- 630 unchanged lines hidden (view full) --- 1226 1227 ci.md = md; 1228 ci.bio = bio; 1229 ci.io = alloc_io(md); 1230 ci.io->error = 0; 1231 atomic_set(&ci.io->io_count, 1); 1232 ci.io->bio = bio; 1233 ci.io->md = md; |
1234 spin_lock_init(&ci.io->endio_lock); |
|
1229 ci.sector = bio->bi_sector; 1230 ci.sector_count = bio_sectors(bio); 1231 if (unlikely(bio_empty_barrier(bio))) 1232 ci.sector_count = 1; 1233 ci.idx = bio->bi_idx; 1234 1235 start_io_acct(ci.io); 1236 while (ci.sector_count && !error) --- 1451 unchanged lines hidden --- | 1235 ci.sector = bio->bi_sector; 1236 ci.sector_count = bio_sectors(bio); 1237 if (unlikely(bio_empty_barrier(bio))) 1238 ci.sector_count = 1; 1239 ci.idx = bio->bi_idx; 1240 1241 start_io_acct(ci.io); 1242 while (ci.sector_count && !error) --- 1451 unchanged lines hidden --- |