diff options
author | Ming Lei <ming.lei@redhat.com> | 2017-07-14 04:14:44 -0400 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-07-21 15:47:20 -0400 |
commit | be453e7761d0e72d8a1b2fcfde6d1a7e53881190 (patch) | |
tree | 4d279fad43fde03e4c7eafb3225e440088ac16ef /drivers/md/md.h | |
parent | fb0eb5df09307603b21845af1d143cc910154593 (diff) |
md: raid1-10: move raid1/raid10 common code into raid1-10.c
No function change, just move 'struct resync_pages' and related
helpers into raid1-10.c
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r-- | drivers/md/md.h | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h index 991769cc3615..09db03455801 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -731,57 +731,4 @@ static inline void mddev_check_write_zeroes(struct mddev *mddev, struct bio *bio | |||
731 | !bdev_get_queue(bio->bi_bdev)->limits.max_write_zeroes_sectors) | 731 | !bdev_get_queue(bio->bi_bdev)->limits.max_write_zeroes_sectors) |
732 | mddev->queue->limits.max_write_zeroes_sectors = 0; | 732 | mddev->queue->limits.max_write_zeroes_sectors = 0; |
733 | } | 733 | } |
734 | |||
735 | /* Maximum size of each resync request */ | ||
736 | #define RESYNC_BLOCK_SIZE (64*1024) | ||
737 | #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) | ||
738 | |||
739 | /* for managing resync I/O pages */ | ||
740 | struct resync_pages { | ||
741 | void *raid_bio; | ||
742 | struct page *pages[RESYNC_PAGES]; | ||
743 | }; | ||
744 | |||
745 | static inline int resync_alloc_pages(struct resync_pages *rp, | ||
746 | gfp_t gfp_flags) | ||
747 | { | ||
748 | int i; | ||
749 | |||
750 | for (i = 0; i < RESYNC_PAGES; i++) { | ||
751 | rp->pages[i] = alloc_page(gfp_flags); | ||
752 | if (!rp->pages[i]) | ||
753 | goto out_free; | ||
754 | } | ||
755 | |||
756 | return 0; | ||
757 | |||
758 | out_free: | ||
759 | while (--i >= 0) | ||
760 | put_page(rp->pages[i]); | ||
761 | return -ENOMEM; | ||
762 | } | ||
763 | |||
764 | static inline void resync_free_pages(struct resync_pages *rp) | ||
765 | { | ||
766 | int i; | ||
767 | |||
768 | for (i = 0; i < RESYNC_PAGES; i++) | ||
769 | put_page(rp->pages[i]); | ||
770 | } | ||
771 | |||
772 | static inline void resync_get_all_pages(struct resync_pages *rp) | ||
773 | { | ||
774 | int i; | ||
775 | |||
776 | for (i = 0; i < RESYNC_PAGES; i++) | ||
777 | get_page(rp->pages[i]); | ||
778 | } | ||
779 | |||
780 | static inline struct page *resync_fetch_page(struct resync_pages *rp, | ||
781 | unsigned idx) | ||
782 | { | ||
783 | if (WARN_ON_ONCE(idx >= RESYNC_PAGES)) | ||
784 | return NULL; | ||
785 | return rp->pages[idx]; | ||
786 | } | ||
787 | #endif /* _MD_MD_H */ | 734 | #endif /* _MD_MD_H */ |