dm.c (655f3aad7aa4858d06cdaca6c4b14635cc3c0eba) dm.c (4d7bca13dd9a5033174b0735056c5658cb893e76)
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-core.h"

--- 536 unchanged lines hidden (view full) ---

545 if (WARN_ON_ONCE(dm_io_flagged(io, DM_IO_ACCOUNTED)))
546 return;
547 dm_io_set_flag(io, DM_IO_ACCOUNTED);
548 } else {
549 unsigned long flags;
550 if (dm_io_flagged(io, DM_IO_ACCOUNTED))
551 return;
552 /* Can afford locking given DM_TIO_IS_DUPLICATE_BIO */
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-core.h"

--- 536 unchanged lines hidden (view full) ---

545 if (WARN_ON_ONCE(dm_io_flagged(io, DM_IO_ACCOUNTED)))
546 return;
547 dm_io_set_flag(io, DM_IO_ACCOUNTED);
548 } else {
549 unsigned long flags;
550 if (dm_io_flagged(io, DM_IO_ACCOUNTED))
551 return;
552 /* Can afford locking given DM_TIO_IS_DUPLICATE_BIO */
553 spin_lock_irqsave(&io->startio_lock, flags);
553 spin_lock_irqsave(&io->lock, flags);
554 dm_io_set_flag(io, DM_IO_ACCOUNTED);
554 dm_io_set_flag(io, DM_IO_ACCOUNTED);
555 spin_unlock_irqrestore(&io->startio_lock, flags);
555 spin_unlock_irqrestore(&io->lock, flags);
556 }
557
558 __dm_start_io_acct(io, bio);
559}
560
561static void dm_end_io_acct(struct dm_io *io, struct bio *bio)
562{
563 dm_io_acct(true, io->md, bio, io->start_time, &io->stats_aux);

--- 15 unchanged lines hidden (view full) ---

579 io = container_of(tio, struct dm_io, tio);
580 io->magic = DM_IO_MAGIC;
581 io->status = 0;
582 atomic_set(&io->io_count, 1);
583 this_cpu_inc(*md->pending_io);
584 io->orig_bio = NULL;
585 io->md = md;
586 io->map_task = current;
556 }
557
558 __dm_start_io_acct(io, bio);
559}
560
561static void dm_end_io_acct(struct dm_io *io, struct bio *bio)
562{
563 dm_io_acct(true, io->md, bio, io->start_time, &io->stats_aux);

--- 15 unchanged lines hidden (view full) ---

579 io = container_of(tio, struct dm_io, tio);
580 io->magic = DM_IO_MAGIC;
581 io->status = 0;
582 atomic_set(&io->io_count, 1);
583 this_cpu_inc(*md->pending_io);
584 io->orig_bio = NULL;
585 io->md = md;
586 io->map_task = current;
587 spin_lock_init(&io->startio_lock);
588 spin_lock_init(&io->endio_lock);
587 spin_lock_init(&io->lock);
589 io->start_time = jiffies;
590 io->flags = 0;
591
592 dm_stats_record_start(&md->stats, &io->stats_aux);
593
594 return io;
595}
596

--- 331 unchanged lines hidden (view full) ---

928 * Decrements the number of outstanding ios that a bio has been
929 * cloned into, completing the original io if necc.
930 */
931void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
932{
933 /* Push-back supersedes any I/O errors */
934 if (unlikely(error)) {
935 unsigned long flags;
588 io->start_time = jiffies;
589 io->flags = 0;
590
591 dm_stats_record_start(&md->stats, &io->stats_aux);
592
593 return io;
594}
595

--- 331 unchanged lines hidden (view full) ---

927 * Decrements the number of outstanding ios that a bio has been
928 * cloned into, completing the original io if necc.
929 */
930void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
931{
932 /* Push-back supersedes any I/O errors */
933 if (unlikely(error)) {
934 unsigned long flags;
936 spin_lock_irqsave(&io->endio_lock, flags);
935 spin_lock_irqsave(&io->lock, flags);
937 if (!(io->status == BLK_STS_DM_REQUEUE &&
938 __noflush_suspending(io->md)))
939 io->status = error;
936 if (!(io->status == BLK_STS_DM_REQUEUE &&
937 __noflush_suspending(io->md)))
938 io->status = error;
940 spin_unlock_irqrestore(&io->endio_lock, flags);
939 spin_unlock_irqrestore(&io->lock, flags);
941 }
942
943 if (atomic_dec_and_test(&io->io_count))
944 dm_io_complete(io);
945}
946
947void disable_discard(struct mapped_device *md)
948{

--- 2237 unchanged lines hidden ---
940 }
941
942 if (atomic_dec_and_test(&io->io_count))
943 dm_io_complete(io);
944}
945
946void disable_discard(struct mapped_device *md)
947{

--- 2237 unchanged lines hidden ---