linux-next: manual merge of the md tree with the block tree

From: Stephen Rothwell
Date: Sun Apr 09 2017 - 22:04:06 EST


Hi Shaohua,

Today's linux-next merge of the md tree got a conflict in:

drivers/md/md.h

between commit:

3deff1a70d59 ("md: support REQ_OP_WRITE_ZEROES")

from the block tree and commits:

d8e29fbc3bed ("md: move two macros into md.h")
513e2faa0138 ("md: prepare for managing resync I/O pages in clean way")

from the md tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc drivers/md/md.h
index 1e76d64ce180,0418b29945e7..000000000000
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@@ -710,10 -719,58 +719,65 @@@ static inline void mddev_check_writesam
mddev->queue->limits.max_write_same_sectors = 0;
}

+static inline void mddev_check_write_zeroes(struct mddev *mddev, struct bio *bio)
+{
+ if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&
+ !bdev_get_queue(bio->bi_bdev)->limits.max_write_zeroes_sectors)
+ mddev->queue->limits.max_write_zeroes_sectors = 0;
+}
++
+ /* Maximum size of each resync request */
+ #define RESYNC_BLOCK_SIZE (64*1024)
+ #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE)
+
+ /* for managing resync I/O pages */
+ struct resync_pages {
+ unsigned idx; /* for get/put page from the pool */
+ void *raid_bio;
+ struct page *pages[RESYNC_PAGES];
+ };
+
+ static inline int resync_alloc_pages(struct resync_pages *rp,
+ gfp_t gfp_flags)
+ {
+ int i;
+
+ for (i = 0; i < RESYNC_PAGES; i++) {
+ rp->pages[i] = alloc_page(gfp_flags);
+ if (!rp->pages[i])
+ goto out_free;
+ }
+
+ return 0;
+
+ out_free:
+ while (--i >= 0)
+ put_page(rp->pages[i]);
+ return -ENOMEM;
+ }
+
+ static inline void resync_free_pages(struct resync_pages *rp)
+ {
+ int i;
+
+ for (i = 0; i < RESYNC_PAGES; i++)
+ put_page(rp->pages[i]);
+ }
+
+ static inline void resync_get_all_pages(struct resync_pages *rp)
+ {
+ int i;
+
+ for (i = 0; i < RESYNC_PAGES; i++)
+ get_page(rp->pages[i]);
+ }
+
+ static inline struct page *resync_fetch_page(struct resync_pages *rp,
+ unsigned idx)
+ {
+ if (WARN_ON_ONCE(idx >= RESYNC_PAGES))
+ return NULL;
+ return rp->pages[idx];
+ }
+
#endif /* _MD_MD_H */