dm.c (a892c8d52c02284076fbbacae6692aa5c5807d11) dm.c (087615bf3acdafd0ba7c7c9ed5286e7b7c80fe1b)
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"

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

21#include <linux/idr.h>
22#include <linux/uio.h>
23#include <linux/hdreg.h>
24#include <linux/delay.h>
25#include <linux/wait.h>
26#include <linux/pr.h>
27#include <linux/refcount.h>
28#include <linux/part_stat.h>
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"

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

21#include <linux/idr.h>
22#include <linux/uio.h>
23#include <linux/hdreg.h>
24#include <linux/delay.h>
25#include <linux/wait.h>
26#include <linux/pr.h>
27#include <linux/refcount.h>
28#include <linux/part_stat.h>
29#include <linux/blk-crypto.h>
30
31#define DM_MSG_PREFIX "core"
32
33/*
34 * Cookies are numeric values sent with CHANGE and REMOVE
35 * uevents while resuming, removing or renaming the device.
36 */
37#define DM_COOKIE_ENV_VAR_NAME "DM_COOKIE"

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

671static bool md_in_flight(struct mapped_device *md)
672{
673 if (queue_is_mq(md->queue))
674 return blk_mq_queue_inflight(md->queue);
675 else
676 return md_in_flight_bios(md);
677}
678
29
30#define DM_MSG_PREFIX "core"
31
32/*
33 * Cookies are numeric values sent with CHANGE and REMOVE
34 * uevents while resuming, removing or renaming the device.
35 */
36#define DM_COOKIE_ENV_VAR_NAME "DM_COOKIE"

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

670static bool md_in_flight(struct mapped_device *md)
671{
672 if (queue_is_mq(md->queue))
673 return blk_mq_queue_inflight(md->queue);
674 else
675 return md_in_flight_bios(md);
676}
677
678u64 dm_start_time_ns_from_clone(struct bio *bio)
679{
680 struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);
681 struct dm_io *io = tio->io;
682
683 return jiffies_to_nsecs(io->start_time);
684}
685EXPORT_SYMBOL_GPL(dm_start_time_ns_from_clone);
686
679static void start_io_acct(struct dm_io *io)
680{
681 struct mapped_device *md = io->md;
682 struct bio *bio = io->orig_bio;
683
684 io->start_time = jiffies;
685
686 generic_start_io_acct(md->queue, bio_op(bio), bio_sectors(bio),

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

1330 */
1331static int clone_bio(struct dm_target_io *tio, struct bio *bio,
1332 sector_t sector, unsigned len)
1333{
1334 struct bio *clone = &tio->clone;
1335
1336 __bio_clone_fast(clone, bio);
1337
687static void start_io_acct(struct dm_io *io)
688{
689 struct mapped_device *md = io->md;
690 struct bio *bio = io->orig_bio;
691
692 io->start_time = jiffies;
693
694 generic_start_io_acct(md->queue, bio_op(bio), bio_sectors(bio),

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

1338 */
1339static int clone_bio(struct dm_target_io *tio, struct bio *bio,
1340 sector_t sector, unsigned len)
1341{
1342 struct bio *clone = &tio->clone;
1343
1344 __bio_clone_fast(clone, bio);
1345
1338 bio_crypt_clone(clone, bio, GFP_NOIO);
1339
1340 if (bio_integrity(bio)) {
1341 int r;
1342
1343 if (unlikely(!dm_target_has_integrity(tio->ti->type) &&
1344 !dm_target_passes_integrity(tio->ti->type))) {
1345 DMWARN("%s: the target %s doesn't support integrity data.",
1346 dm_device_name(tio->io->md),
1347 tio->ti->type->name);

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

1786
1787static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio)
1788{
1789 struct mapped_device *md = q->queuedata;
1790 blk_qc_t ret = BLK_QC_T_NONE;
1791 int srcu_idx;
1792 struct dm_table *map;
1793
1346 if (bio_integrity(bio)) {
1347 int r;
1348
1349 if (unlikely(!dm_target_has_integrity(tio->ti->type) &&
1350 !dm_target_passes_integrity(tio->ti->type))) {
1351 DMWARN("%s: the target %s doesn't support integrity data.",
1352 dm_device_name(tio->io->md),
1353 tio->ti->type->name);

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

1792
1793static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio)
1794{
1795 struct mapped_device *md = q->queuedata;
1796 blk_qc_t ret = BLK_QC_T_NONE;
1797 int srcu_idx;
1798 struct dm_table *map;
1799
1794 if (dm_get_md_type(md) == DM_TYPE_REQUEST_BASED)
1795 return blk_mq_make_request(q, bio);
1796
1797 map = dm_get_live_table(md, &srcu_idx);
1798
1799 /* if we're suspended, we have to queue this io for later */
1800 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {
1801 dm_put_live_table(md, srcu_idx);
1802
1803 if (!(bio->bi_opf & REQ_RAHEAD))
1804 queue_io(md, bio);

--- 1454 unchanged lines hidden ---
1800 map = dm_get_live_table(md, &srcu_idx);
1801
1802 /* if we're suspended, we have to queue this io for later */
1803 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {
1804 dm_put_live_table(md, srcu_idx);
1805
1806 if (!(bio->bi_opf & REQ_RAHEAD))
1807 queue_io(md, bio);

--- 1454 unchanged lines hidden ---