From 816042a3a07cd57a27343a4961e85d8f237a11d8 Mon Sep 17 00:00:00 2001 From: jxiong Date: Fri, 13 Jul 2007 09:11:40 +0000 Subject: [PATCH] r=alex,nathan b=11890 Raid5 write zerocopy support for rhel-2.6 kernels. --- lustre/autoconf/lustre-core.m4 | 24 ++++++++++++++++++++++++ lustre/kernel_patches/series/2.6-rhel4.series | 1 + lustre/obdfilter/filter_io_26.c | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 0359013..3d34d0f 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1005,6 +1005,27 @@ LB_LINUX_TRY_COMPILE([ ]) ]) +# +# LC_PAGE_CONSTANT +# +# In order to support raid5 zerocopy patch, we have to patch the kernel to make +# it support constant page, which means the page won't be modified during the +# IO. +# +AC_DEFUN([LC_PAGE_CONSTANT], +[AC_MSG_CHECKING([if kernel have PageConstant defined]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + PageConstant((struct page *)NULL); +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported]) +],[ + AC_MSG_RESULT(no); +]) +]) + # RHEL5 in FS-cache patch rename PG_checked flag # into PG_fs_misc AC_DEFUN([LC_PG_FS_MISC], @@ -1106,6 +1127,9 @@ LC_GENERIC_FILE_WRITE # 2.6.20 LC_CANCEL_DIRTY_PAGE + +# raid5-zerocopy patch +LC_PAGE_CONSTANT ]) # diff --git a/lustre/kernel_patches/series/2.6-rhel4.series b/lustre/kernel_patches/series/2.6-rhel4.series index 67ac232..632e352 100644 --- a/lustre/kernel_patches/series/2.6-rhel4.series +++ b/lustre/kernel_patches/series/2.6-rhel4.series @@ -22,6 +22,7 @@ raid5-large-io.patch raid5-stripe-by-stripe-handling.patch raid5-merge-ios.patch raid5-serialize-ovelapping-reqs.patch +raid5-zerocopy.patch jbd-stats-2.6.9.patch bitops_ext2_find_next_le_bit-2.6.patch quota-deadlock-on-pagelock-core.patch diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index ca43c76..687ae15 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -104,6 +104,11 @@ static int dio_complete_routine(struct bio *bio, unsigned int done, int error) struct filter_iobuf *iobuf = bio->bi_private; unsigned long flags; +#ifdef HAVE_PAGE_CONSTANT + struct bio_vec *bvl; + int i; +#endif + /* CAVEAT EMPTOR: possibly in IRQ context * DO NOT record procfs stats here!!! */ @@ -128,6 +133,11 @@ static int dio_complete_routine(struct bio *bio, unsigned int done, int error) return 0; } +#ifdef HAVE_PAGE_CONSTANT + bio_for_each_segment(bvl, bio, i) + ClearPageConstant(bvl->bv_page); +#endif + spin_lock_irqsave(&iobuf->dr_lock, flags); if (iobuf->dr_error == 0) iobuf->dr_error = error; @@ -295,6 +305,18 @@ int filter_do_bio(struct obd_export *exp, struct inode *inode, (blocks[block_idx + i + nblocks] << sector_bits)) nblocks++; +#ifdef HAVE_PAGE_CONSTANT + /* I only set the page to be constant only if it + * is mapped to a contiguous underlying disk block(s). + * It will then make sure the corresponding device + * cache of raid5 will be overwritten by this page. + * - jay */ + if ((rw == OBD_BRW_WRITE) && + (nblocks == blocks_per_page) && + mapping_cap_page_constant_write(inode->i_mapping)) + SetPageConstant(page); +#endif + if (bio != NULL && can_be_merged(bio, sector) && bio_add_page(bio, page, -- 1.8.3.1