mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	btrfs: use copy_page for copying pages instead of memcpy
Use the helper that's possibly optimized for full page copies. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
		
							parent
							
								
									3ffbd68c48
								
							
						
					
					
						commit
						69d2480456
					
				
					 2 changed files with 7 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -547,7 +547,7 @@ static int io_ctl_add_bitmap(struct btrfs_io_ctl *io_ctl, void *bitmap)
 | 
			
		|||
		io_ctl_map_page(io_ctl, 0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	memcpy(io_ctl->cur, bitmap, PAGE_SIZE);
 | 
			
		||||
	copy_page(io_ctl->cur, bitmap);
 | 
			
		||||
	io_ctl_set_crc(io_ctl, io_ctl->index - 1);
 | 
			
		||||
	if (io_ctl->index < io_ctl->num_pages)
 | 
			
		||||
		io_ctl_map_page(io_ctl, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -607,7 +607,7 @@ static int io_ctl_read_bitmap(struct btrfs_io_ctl *io_ctl,
 | 
			
		|||
	if (ret)
 | 
			
		||||
		return ret;
 | 
			
		||||
 | 
			
		||||
	memcpy(entry->bitmap, io_ctl->cur, PAGE_SIZE);
 | 
			
		||||
	copy_page(entry->bitmap, io_ctl->cur);
 | 
			
		||||
	io_ctl_unmap_page(io_ctl);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -260,7 +260,7 @@ static void cache_rbio_pages(struct btrfs_raid_bio *rbio)
 | 
			
		|||
		s = kmap(rbio->bio_pages[i]);
 | 
			
		||||
		d = kmap(rbio->stripe_pages[i]);
 | 
			
		||||
 | 
			
		||||
		memcpy(d, s, PAGE_SIZE);
 | 
			
		||||
		copy_page(d, s);
 | 
			
		||||
 | 
			
		||||
		kunmap(rbio->bio_pages[i]);
 | 
			
		||||
		kunmap(rbio->stripe_pages[i]);
 | 
			
		||||
| 
						 | 
				
			
			@ -1275,7 +1275,7 @@ static noinline void finish_rmw(struct btrfs_raid_bio *rbio)
 | 
			
		|||
						pointers);
 | 
			
		||||
		} else {
 | 
			
		||||
			/* raid5 */
 | 
			
		||||
			memcpy(pointers[nr_data], pointers[0], PAGE_SIZE);
 | 
			
		||||
			copy_page(pointers[nr_data], pointers[0]);
 | 
			
		||||
			run_xor(pointers + 1, nr_data - 1, PAGE_SIZE);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1941,9 +1941,7 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio)
 | 
			
		|||
			BUG_ON(failb != -1);
 | 
			
		||||
pstripe:
 | 
			
		||||
			/* Copy parity block into failed block to start with */
 | 
			
		||||
			memcpy(pointers[faila],
 | 
			
		||||
			       pointers[rbio->nr_data],
 | 
			
		||||
			       PAGE_SIZE);
 | 
			
		||||
			copy_page(pointers[faila], pointers[rbio->nr_data]);
 | 
			
		||||
 | 
			
		||||
			/* rearrange the pointer array */
 | 
			
		||||
			p = pointers[faila];
 | 
			
		||||
| 
						 | 
				
			
			@ -2448,7 +2446,7 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
 | 
			
		|||
						pointers);
 | 
			
		||||
		} else {
 | 
			
		||||
			/* raid5 */
 | 
			
		||||
			memcpy(pointers[nr_data], pointers[0], PAGE_SIZE);
 | 
			
		||||
			copy_page(pointers[nr_data], pointers[0]);
 | 
			
		||||
			run_xor(pointers + 1, nr_data - 1, PAGE_SIZE);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2456,7 +2454,7 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
 | 
			
		|||
		p = rbio_stripe_page(rbio, rbio->scrubp, pagenr);
 | 
			
		||||
		parity = kmap(p);
 | 
			
		||||
		if (memcmp(parity, pointers[rbio->scrubp], PAGE_SIZE))
 | 
			
		||||
			memcpy(parity, pointers[rbio->scrubp], PAGE_SIZE);
 | 
			
		||||
			copy_page(parity, pointers[rbio->scrubp]);
 | 
			
		||||
		else
 | 
			
		||||
			/* Parity is right, needn't writeback */
 | 
			
		||||
			bitmap_clear(rbio->dbitmap, pagenr, 1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue