dm.c (27eaa14975d8b53f0bad422e53cdf8e5f6dd44ec) | dm.c (f9ab94cee313746573b2d693bc2afb807ebb0998) |
---|---|
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" --- 736 unchanged lines hidden (view full) --- 745 if (idx != bio->bi_idx || clone->bi_size < bio->bi_size) 746 bio_integrity_trim(clone, 747 bio_sector_offset(bio, idx, 0), len); 748 } 749 750 return clone; 751} 752 | 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" --- 736 unchanged lines hidden (view full) --- 745 if (idx != bio->bi_idx || clone->bi_size < bio->bi_size) 746 bio_integrity_trim(clone, 747 bio_sector_offset(bio, idx, 0), len); 748 } 749 750 return clone; 751} 752 |
753static void __flush_target(struct clone_info *ci, struct dm_target *ti, 754 unsigned flush_nr) 755{ 756 struct dm_target_io *tio = alloc_tio(ci->md); 757 struct bio *clone; 758 759 tio->io = ci->io; 760 tio->ti = ti; 761 762 memset(&tio->info, 0, sizeof(tio->info)); 763 tio->info.flush_request = flush_nr; 764 765 clone = bio_alloc_bioset(GFP_NOIO, 0, ci->md->bs); 766 __bio_clone(clone, ci->bio); 767 clone->bi_destructor = dm_bio_destructor; 768 769 __map_bio(ti, clone, tio); 770} 771 772static int __clone_and_map_empty_barrier(struct clone_info *ci) 773{ 774 unsigned target_nr = 0, flush_nr; 775 struct dm_target *ti; 776 777 while ((ti = dm_table_get_target(ci->map, target_nr++))) 778 for (flush_nr = 0; flush_nr < ti->num_flush_requests; 779 flush_nr++) 780 __flush_target(ci, ti, flush_nr); 781 782 ci->sector_count = 0; 783 784 return 0; 785} 786 |
|
753static int __clone_and_map(struct clone_info *ci) 754{ 755 struct bio *clone, *bio = ci->bio; 756 struct dm_target *ti; 757 sector_t len = 0, max; 758 struct dm_target_io *tio; 759 | 787static int __clone_and_map(struct clone_info *ci) 788{ 789 struct bio *clone, *bio = ci->bio; 790 struct dm_target *ti; 791 sector_t len = 0, max; 792 struct dm_target_io *tio; 793 |
794 if (unlikely(bio_empty_barrier(bio))) 795 return __clone_and_map_empty_barrier(ci); 796 |
|
760 ti = dm_table_find_target(ci->map, ci->sector); 761 if (!dm_target_is_valid(ti)) 762 return -EIO; 763 764 max = max_io_len(ci->md, ci->sector, ti); 765 766 /* 767 * Allocate a target io object. --- 104 unchanged lines hidden (view full) --- 872 ci.bio = bio; 873 ci.io = alloc_io(md); 874 ci.io->error = 0; 875 atomic_set(&ci.io->io_count, 1); 876 ci.io->bio = bio; 877 ci.io->md = md; 878 ci.sector = bio->bi_sector; 879 ci.sector_count = bio_sectors(bio); | 797 ti = dm_table_find_target(ci->map, ci->sector); 798 if (!dm_target_is_valid(ti)) 799 return -EIO; 800 801 max = max_io_len(ci->md, ci->sector, ti); 802 803 /* 804 * Allocate a target io object. --- 104 unchanged lines hidden (view full) --- 909 ci.bio = bio; 910 ci.io = alloc_io(md); 911 ci.io->error = 0; 912 atomic_set(&ci.io->io_count, 1); 913 ci.io->bio = bio; 914 ci.io->md = md; 915 ci.sector = bio->bi_sector; 916 ci.sector_count = bio_sectors(bio); |
917 if (unlikely(bio_empty_barrier(bio))) 918 ci.sector_count = 1; |
|
880 ci.idx = bio->bi_idx; 881 882 start_io_acct(ci.io); 883 while (ci.sector_count && !error) 884 error = __clone_and_map(&ci); 885 886 /* drop the extra reference count */ 887 dec_pending(ci.io, error); --- 916 unchanged lines hidden --- | 919 ci.idx = bio->bi_idx; 920 921 start_io_acct(ci.io); 922 while (ci.sector_count && !error) 923 error = __clone_and_map(&ci); 924 925 /* drop the extra reference count */ 926 dec_pending(ci.io, error); --- 916 unchanged lines hidden --- |