dm.c (942baad211336efefb93a8369478888ab845c450) | dm.c (6842d264aa5205da338b6dcc6acfa2a6732558f1) |
---|---|
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" --- 1223 unchanged lines hidden (view full) --- 1232 out: 1233 dm_put_live_table(md, srcu_idx); 1234 1235 return ret; 1236} 1237 1238/* 1239 * A target may call dm_accept_partial_bio only from the map routine. It is | 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" --- 1223 unchanged lines hidden (view full) --- 1232 out: 1233 dm_put_live_table(md, srcu_idx); 1234 1235 return ret; 1236} 1237 1238/* 1239 * A target may call dm_accept_partial_bio only from the map routine. It is |
1240 * allowed for all bio types except REQ_PREFLUSH, REQ_OP_ZONE_RESET, 1241 * REQ_OP_ZONE_OPEN, REQ_OP_ZONE_CLOSE and REQ_OP_ZONE_FINISH. | 1240 * allowed for all bio types except REQ_PREFLUSH, REQ_OP_ZONE_* zone management 1241 * operations and REQ_OP_ZONE_APPEND (zone append writes). |
1242 * 1243 * dm_accept_partial_bio informs the dm that the target only wants to process 1244 * additional n_sectors sectors of the bio and the rest of the data should be 1245 * sent in a next bio. 1246 * 1247 * A diagram that explains the arithmetics: 1248 * +--------------------+---------------+-------+ 1249 * | 1 | 2 | 3 | --- 13 unchanged lines hidden (view full) --- 1263 * If the target wants to receive multiple copies of the bio (via num_*bios, etc), 1264 * the partially processed part (the sum of regions 1+2) must be the same for all 1265 * copies of the bio. 1266 */ 1267void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors) 1268{ 1269 struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); 1270 unsigned bi_size = bio->bi_iter.bi_size >> SECTOR_SHIFT; | 1242 * 1243 * dm_accept_partial_bio informs the dm that the target only wants to process 1244 * additional n_sectors sectors of the bio and the rest of the data should be 1245 * sent in a next bio. 1246 * 1247 * A diagram that explains the arithmetics: 1248 * +--------------------+---------------+-------+ 1249 * | 1 | 2 | 3 | --- 13 unchanged lines hidden (view full) --- 1263 * If the target wants to receive multiple copies of the bio (via num_*bios, etc), 1264 * the partially processed part (the sum of regions 1+2) must be the same for all 1265 * copies of the bio. 1266 */ 1267void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors) 1268{ 1269 struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); 1270 unsigned bi_size = bio->bi_iter.bi_size >> SECTOR_SHIFT; |
1271 |
|
1271 BUG_ON(bio->bi_opf & REQ_PREFLUSH); | 1272 BUG_ON(bio->bi_opf & REQ_PREFLUSH); |
1273 BUG_ON(op_is_zone_mgmt(bio_op(bio))); 1274 BUG_ON(bio_op(bio) == REQ_OP_ZONE_APPEND); |
|
1272 BUG_ON(bi_size > *tio->len_ptr); 1273 BUG_ON(n_sectors > bi_size); | 1275 BUG_ON(bi_size > *tio->len_ptr); 1276 BUG_ON(n_sectors > bi_size); |
1277 |
|
1274 *tio->len_ptr -= bi_size - n_sectors; 1275 bio->bi_iter.bi_size = n_sectors << SECTOR_SHIFT; 1276} 1277EXPORT_SYMBOL_GPL(dm_accept_partial_bio); 1278 1279static noinline void __set_swap_bios_limit(struct mapped_device *md, int latch) 1280{ 1281 mutex_lock(&md->swap_bios_lock); --- 1899 unchanged lines hidden --- | 1278 *tio->len_ptr -= bi_size - n_sectors; 1279 bio->bi_iter.bi_size = n_sectors << SECTOR_SHIFT; 1280} 1281EXPORT_SYMBOL_GPL(dm_accept_partial_bio); 1282 1283static noinline void __set_swap_bios_limit(struct mapped_device *md, int latch) 1284{ 1285 mutex_lock(&md->swap_bios_lock); --- 1899 unchanged lines hidden --- |