From: Peng Tao <bergwolf@gmail.com>
To: Benny Halevy <bhalevy@panasas.com>
Cc: Jim Rees <rees@umich.edu>,
linux-nfs@vger.kernel.org, peter honeyman <honey@citi.umich.edu>
Subject: Re: [PATCH 86/88] SQUASHME: pnfs: blocklayout: port block layout code
Date: Wed, 8 Jun 2011 15:38:56 +0800 [thread overview]
Message-ID: <BANLkTinPAQ+CatVX84-i6Pfpps4BjkXv5w@mail.gmail.com> (raw)
In-Reply-To: <4DEED92F.9000204@panasas.com>
yes, you are right. it should be pnfs_generic_pg_test. thanks for catching this!
On 6/8/11, Benny Halevy <bhalevy@panasas.com> wrote:
> On 2011-06-07 13:35, Jim Rees wrote:
>> From: Peng Tao <bergwolf@gmail.com>
>>
>> Make minimal changes to let block layout driver work in current framework.
>>
>> Signed-off-by: Tang Haiying <tang_haiying@emc.com>
>> Signed-off-by: Zhang Jingwang <jingwang.zhang@emc.com>
>> Signed-off-by: Peng Tao <peng_tao@emc.com>
>> Signed-off-by: Jim Rees <rees@umich.edu>
>> ---
>> drivers/md/dm-ioctl.c | 24 --------
>> drivers/scsi/hosts.c | 3 +-
>> fs/nfs/blocklayout/blocklayout.c | 105
>> ++++++++++------------------------
>> fs/nfs/blocklayout/blocklayout.h | 9 +--
>> fs/nfs/blocklayout/blocklayoutdev.c | 34 ++++++++----
>> fs/nfs/blocklayout/extents.c | 14 +----
>> fs/nfs/nfs4proc.c | 1 -
>> fs/nfs/nfs4xdr.c | 3 +-
>> fs/nfs/pnfs.c | 8 ++-
>> fs/nfs/pnfs.h | 1 +
>> include/linux/nfs_fs_sb.h | 1 +
>> 11 files changed, 69 insertions(+), 134 deletions(-)
>>
>> diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
>> index d0d417e..4cacdad 100644
>> --- a/drivers/md/dm-ioctl.c
>> +++ b/drivers/md/dm-ioctl.c
>> @@ -713,12 +713,6 @@ static int dev_create(struct dm_ioctl *param, size_t
>> param_size)
>> return 0;
>> }
>>
>> -int dm_dev_create(struct dm_ioctl *param)
>> -{
>> - return dev_create(param, sizeof(*param));
>> -}
>> -EXPORT_SYMBOL(dm_dev_create);
>> -
>> /*
>> * Always use UUID for lookups if it's present, otherwise use name or
>> dev.
>> */
>> @@ -814,12 +808,6 @@ static int dev_remove(struct dm_ioctl *param, size_t
>> param_size)
>> return 0;
>> }
>>
>> -int dm_dev_remove(struct dm_ioctl *param)
>> -{
>> - return dev_remove(param, sizeof(*param));
>> -}
>> -EXPORT_SYMBOL(dm_dev_remove);
>> -
>> /*
>> * Check a string doesn't overrun the chunk of
>> * memory we copied from userland.
>> @@ -1002,12 +990,6 @@ static int do_resume(struct dm_ioctl *param)
>> return r;
>> }
>>
>> -int dm_do_resume(struct dm_ioctl *param)
>> -{
>> - return do_resume(param);
>> -}
>> -EXPORT_SYMBOL(dm_do_resume);
>> -
>> /*
>> * Set or unset the suspension state of a device.
>> * If the device already is in the requested state we just return its
>> status.
>> @@ -1274,12 +1256,6 @@ out:
>> return r;
>> }
>>
>> -int dm_table_load(struct dm_ioctl *param, size_t param_size)
>> -{
>> - return table_load(param, param_size);
>> -}
>> -EXPORT_SYMBOL(dm_table_load);
>> -
>> static int table_clear(struct dm_ioctl *param, size_t param_size)
>> {
>> struct hash_cell *hc;
>> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
>> index 7d91903..4f7a582 100644
>> --- a/drivers/scsi/hosts.c
>> +++ b/drivers/scsi/hosts.c
>> @@ -50,11 +50,10 @@ static void scsi_host_cls_release(struct device *dev)
>> put_device(&class_to_shost(dev)->shost_gendev);
>> }
>>
>> -struct class shost_class = {
>> +static struct class shost_class = {
>> .name = "scsi_host",
>> .dev_release = scsi_host_cls_release,
>> };
>> -EXPORT_SYMBOL(shost_class);
>>
>> /**
>> * scsi_host_set_state - Take the given host through the host state
>> model.
>> diff --git a/fs/nfs/blocklayout/blocklayout.c
>> b/fs/nfs/blocklayout/blocklayout.c
>> index 2583b87..d842ec8 100644
>> --- a/fs/nfs/blocklayout/blocklayout.c
>> +++ b/fs/nfs/blocklayout/blocklayout.c
>> @@ -97,14 +97,6 @@ dont_like_caller(struct nfs_page *req)
>> }
>> }
>>
>> -static enum pnfs_try_status
>> -bl_commit(struct nfs_write_data *nfs_data,
>> - int sync)
>> -{
>> - dprintk("%s enter\n", __func__);
>> - return PNFS_NOT_ATTEMPTED;
>> -}
>> -
>> /* The data we are handed might be spread across several bios. We need
>> * to track when the last one is finished.
>> */
>> @@ -198,7 +190,7 @@ static void bl_read_cleanup(struct work_struct *work)
>> dprintk("%s enter\n", __func__);
>> task = container_of(work, struct rpc_task, u.tk_work);
>> rdata = container_of(task, struct nfs_read_data, task);
>> - pnfs_read_done(rdata);
>> + pnfs_ld_read_done(rdata);
>> }
>>
>> static void
>> @@ -219,8 +211,7 @@ static void bl_rpc_do_nothing(struct rpc_task *task,
>> void *calldata)
>> }
>>
>> static enum pnfs_try_status
>> -bl_read_pagelist(struct nfs_read_data *rdata,
>> - unsigned nr_pages)
>> +bl_read_pagelist(struct nfs_read_data *rdata)
>> {
>> int i, hole;
>> struct bio *bio = NULL;
>> @@ -233,13 +224,13 @@ bl_read_pagelist(struct nfs_read_data *rdata,
>> int pg_index = rdata->args.pgbase >> PAGE_CACHE_SHIFT;
>>
>> dprintk("%s enter nr_pages %u offset %lld count %Zd\n", __func__,
>> - nr_pages, f_offset, count);
>> + rdata->npages, f_offset, count);
>>
>> if (dont_like_caller(rdata->req)) {
>> dprintk("%s dont_like_caller failed\n", __func__);
>> goto use_mds;
>> }
>> - if ((nr_pages == 1) && PagePnfsErr(rdata->req->wb_page)) {
>> + if ((rdata->npages == 1) && PagePnfsErr(rdata->req->wb_page)) {
>> /* We want to fall back to mds in case of read_page
>> * after error on read_pages.
>> */
>> @@ -249,21 +240,21 @@ bl_read_pagelist(struct nfs_read_data *rdata,
>> par = alloc_parallel(rdata);
>> if (!par)
>> goto use_mds;
>> - par->call_ops = *rdata->pdata.call_ops;
>> + par->call_ops = *rdata->mds_ops;
>> par->call_ops.rpc_call_done = bl_rpc_do_nothing;
>> par->pnfs_callback = bl_end_par_io_read;
>> /* At this point, we can no longer jump to use_mds */
>>
>> isect = (sector_t) (f_offset >> 9);
>> /* Code assumes extents are page-aligned */
>> - for (i = pg_index; i < nr_pages; i++) {
>> + for (i = pg_index; i < rdata->npages; i++) {
>> if (!extent_length) {
>> /* We've used up the previous extent */
>> put_extent(be);
>> put_extent(cow_read);
>> bio = bl_submit_bio(READ, bio);
>> /* Get the next one */
>> - be = find_get_extent(BLK_LSEG2EXT(rdata->pdata.lseg),
>> + be = find_get_extent(BLK_LSEG2EXT(rdata->lseg),
>> isect, &cow_read);
>> if (!be) {
>> /* Error out this page */
>> @@ -293,7 +284,7 @@ bl_read_pagelist(struct nfs_read_data *rdata,
>> be_read = (hole && cow_read) ? cow_read : be;
>> for (;;) {
>> if (!bio) {
>> - bio = bio_alloc(GFP_NOIO, nr_pages - i);
>> + bio = bio_alloc(GFP_NOIO, rdata->npages - i);
>> if (!bio) {
>> /* Error out this page */
>> bl_done_with_rpage(pages[i], 0);
>> @@ -407,10 +398,10 @@ static void bl_write_cleanup(struct work_struct
>> *work)
>> /* BUG - this should be called after each bio, not after
>> * all finish, unless have some way of storing success/failure
>> */
>> - mark_extents_written(BLK_LSEG2EXT(wdata->pdata.lseg),
>> + mark_extents_written(BLK_LSEG2EXT(wdata->lseg),
>> wdata->args.offset, wdata->args.count);
>> }
>> - pnfs_writeback_done(wdata);
>> + pnfs_ld_write_done(wdata);
>> }
>>
>> /* Called when last of bios associated with a bl_write_pagelist call
>> finishes */
>> @@ -428,7 +419,6 @@ bl_end_par_io_write(void *data)
>>
>> static enum pnfs_try_status
>> bl_write_pagelist(struct nfs_write_data *wdata,
>> - unsigned nr_pages,
>> int sync)
>> {
>> int i;
>> @@ -442,7 +432,7 @@ bl_write_pagelist(struct nfs_write_data *wdata,
>> int pg_index = wdata->args.pgbase >> PAGE_CACHE_SHIFT;
>>
>> dprintk("%s enter, %Zu@%lld\n", __func__, count, offset);
>> - if (!wdata->req->wb_lseg) {
>> + if (!wdata->lseg) {
>> dprintk("%s no lseg, falling back to MDS\n", __func__);
>> return PNFS_NOT_ATTEMPTED;
>> }
>> @@ -460,19 +450,19 @@ bl_write_pagelist(struct nfs_write_data *wdata,
>> par = alloc_parallel(wdata);
>> if (!par)
>> return PNFS_NOT_ATTEMPTED;
>> - par->call_ops = *wdata->pdata.call_ops;
>> + par->call_ops = *wdata->mds_ops;
>> par->call_ops.rpc_call_done = bl_rpc_do_nothing;
>> par->pnfs_callback = bl_end_par_io_write;
>> /* At this point, have to be more careful with error handling */
>>
>> isect = (sector_t) ((offset & (long)PAGE_CACHE_MASK) >> 9);
>> - for (i = pg_index; i < nr_pages; i++) {
>> + for (i = pg_index; i < wdata->npages ; i++) {
>> if (!extent_length) {
>> /* We've used up the previous extent */
>> put_extent(be);
>> bio = bl_submit_bio(WRITE, bio);
>> /* Get the next one */
>> - be = find_get_extent(BLK_LSEG2EXT(wdata->pdata.lseg),
>> + be = find_get_extent(BLK_LSEG2EXT(wdata->lseg),
>> isect, NULL);
>> if (!be || !is_writable(be, isect)) {
>> /* FIXME */
>> @@ -484,7 +474,7 @@ bl_write_pagelist(struct nfs_write_data *wdata,
>> }
>> for (;;) {
>> if (!bio) {
>> - bio = bio_alloc(GFP_NOIO, nr_pages - i);
>> + bio = bio_alloc(GFP_NOIO, wdata->npages - i);
>> if (!bio) {
>> /* Error out this page */
>> /* FIXME */
>> @@ -504,7 +494,12 @@ bl_write_pagelist(struct nfs_write_data *wdata,
>> isect += PAGE_CACHE_SIZE >> 9;
>> extent_length -= PAGE_CACHE_SIZE >> 9;
>> }
>> - wdata->res.count = (isect << 9) - (offset & (long)PAGE_CACHE_MASK);
>> + wdata->res.count = (isect << 9) - (offset);
>> + if (count < wdata->res.count) {
>> + wdata->res.count = count;
>> + }
>> + /* pnfs_set_layoutcommit needs this */
>> + wdata->mds_offset = offset;
>> put_extent(be);
>> bl_submit_bio(WRITE, bio);
>> put_parallel(par);
>> @@ -557,18 +552,19 @@ bl_free_layout_hdr(struct pnfs_layout_hdr *lo)
>> }
>>
>> static struct pnfs_layout_hdr *
>> -bl_alloc_layout_hdr(struct inode *inode)
>> +bl_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
>> {
>> struct pnfs_block_layout *bl;
>>
>> dprintk("%s enter\n", __func__);
>> - bl = kzalloc(sizeof(*bl), GFP_KERNEL);
>> + bl = kzalloc(sizeof(*bl), gfp_flags);
>> if (!bl)
>> return NULL;
>> spin_lock_init(&bl->bl_ext_lock);
>> INIT_LIST_HEAD(&bl->bl_extents[0]);
>> INIT_LIST_HEAD(&bl->bl_extents[1]);
>> INIT_LIST_HEAD(&bl->bl_commit);
>> + INIT_LIST_HEAD(&bl->bl_committing);
>> bl->bl_count = 0;
>> bl->bl_blocksize = NFS_SERVER(inode)->pnfs_blksize >> 9;
>> INIT_INVAL_MARKS(&bl->bl_inval, bl->bl_blocksize);
>> @@ -590,16 +586,16 @@ bl_free_lseg(struct pnfs_layout_segment *lseg)
>> */
>> static struct pnfs_layout_segment *
>> bl_alloc_lseg(struct pnfs_layout_hdr *lo,
>> - struct nfs4_layoutget_res *lgr)
>> + struct nfs4_layoutget_res *lgr, gfp_t gfp_flags)
>> {
>> struct pnfs_layout_segment *lseg;
>> int status;
>>
>> dprintk("%s enter\n", __func__);
>> - lseg = kzalloc(sizeof(*lseg) + 0, GFP_KERNEL);
>> + lseg = kzalloc(sizeof(*lseg) + 0, gfp_flags);
>> if (!lseg)
>> return NULL;
>> - status = nfs4_blk_process_layoutget(lo, lgr);
>> + status = nfs4_blk_process_layoutget(lo, lgr, gfp_flags);
>> if (status) {
>> /* We don't want to call the full-blown bl_free_lseg,
>> * since on error extents were not touched.
>> @@ -615,34 +611,6 @@ bl_alloc_lseg(struct pnfs_layout_hdr *lo,
>> return lseg;
>> }
>>
>> -static int
>> -bl_setup_layoutcommit(struct pnfs_layout_hdr *lo,
>> - struct nfs4_layoutcommit_args *arg)
>> -{
>> - struct nfs_server *nfss = NFS_SERVER(lo->plh_inode);
>> - struct bl_layoutupdate_data *layoutupdate_data;
>> -
>> - dprintk("%s enter\n", __func__);
>> - /* Need to ensure commit is block-size aligned */
>> - if (nfss->pnfs_blksize) {
>> - u64 mask = nfss->pnfs_blksize - 1;
>> - u64 offset = arg->range.offset & mask;
>> -
>> - arg->range.offset -= offset;
>> - arg->range.length += offset + mask;
>> - arg->range.length &= ~mask;
>> - }
>> -
>> - layoutupdate_data = kmalloc(sizeof(struct bl_layoutupdate_data),
>> - GFP_KERNEL);
>> - if (unlikely(!layoutupdate_data))
>> - return -ENOMEM;
>> - INIT_LIST_HEAD(&layoutupdate_data->ranges);
>> - arg->layoutdriver_data = layoutupdate_data;
>> -
>> - return 0;
>> -}
>> -
>> static void
>> bl_encode_layoutcommit(struct pnfs_layout_hdr *lo, struct xdr_stream
>> *xdr,
>> const struct nfs4_layoutcommit_args *arg)
>> @@ -657,7 +625,6 @@ bl_cleanup_layoutcommit(struct pnfs_layout_hdr *lo,
>> {
>> dprintk("%s enter\n", __func__);
>> clean_pnfs_block_layoutupdate(BLK_LO2EXT(lo), &lcdata->args,
>> lcdata->res.status);
>> - kfree(lcdata->args.layoutdriver_data);
>> }
>>
>> static void free_blk_mountid(struct block_mount_id *mid)
>> @@ -1085,25 +1052,16 @@ bl_write_end_cleanup(struct file *filp, struct
>> pnfs_fsdata *fsdata)
>> fsdata->private = NULL;
>> }
>>
>> -/* This is called by nfs_can_coalesce_requests via
>> nfs_pageio_do_add_request.
>> - * Should return False if there is a reason requests can not be
>> coalesced,
>> - * otherwise, should default to returning True.
>> - */
>> -static int
>> +static bool
>> bl_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
>> - struct nfs_page *req)
>> + struct nfs_page *req)
>> {
>> - dprintk("%s enter\n", __func__);
>> - if (pgio->pg_iswrite)
>> - return prev->wb_lseg == req->wb_lseg;
>> - else
>> - return 1;
>> + return pnfs_generic_pg_test(pgio, prev, req);
>> }
>>
>> static struct pnfs_layoutdriver_type blocklayout_type = {
>> .id = LAYOUT_BLOCK_VOLUME,
>> .name = "LAYOUT_BLOCK_VOLUME",
>> - .commit = bl_commit,
>> .read_pagelist = bl_read_pagelist,
>> .write_pagelist = bl_write_pagelist,
>> .write_begin = bl_write_begin,
>> @@ -1113,12 +1071,11 @@ static struct pnfs_layoutdriver_type
>> blocklayout_type = {
>> .free_layout_hdr = bl_free_layout_hdr,
>> .alloc_lseg = bl_alloc_lseg,
>> .free_lseg = bl_free_lseg,
>> - .setup_layoutcommit = bl_setup_layoutcommit,
>> .encode_layoutcommit = bl_encode_layoutcommit,
>> .cleanup_layoutcommit = bl_cleanup_layoutcommit,
>> .set_layoutdriver = bl_set_layoutdriver,
>> .clear_layoutdriver = bl_clear_layoutdriver,
>> - .pg_test = bl_pg_test,
>> + .pg_test = bl_pg_test,
>
> Why not just set pg_test to pnfs_generic_pg_test?
>
> Benny
>
>> };
>>
>> static int __init nfs4blocklayout_init(void)
>> diff --git a/fs/nfs/blocklayout/blocklayout.h
>> b/fs/nfs/blocklayout/blocklayout.h
>> index a8198ae..dd596d4 100644
>> --- a/fs/nfs/blocklayout/blocklayout.h
>> +++ b/fs/nfs/blocklayout/blocklayout.h
>> @@ -33,7 +33,6 @@
>> #define FS_NFS_NFS4BLOCKLAYOUT_H
>>
>> #include <linux/nfs_fs.h>
>> -#include <linux/dm-ioctl.h> /* Needed for struct dm_ioctl*/
>> #include "../pnfs.h"
>>
>> #define PAGE_CACHE_SECTORS (PAGE_CACHE_SIZE >> 9)
>> @@ -43,11 +42,6 @@
>> #define SetPagePnfsErr(page) set_bit(PG_pnfserr, &(page)->flags)
>> #define ClearPagePnfsErr(page) clear_bit(PG_pnfserr, &(page)->flags)
>>
>> -extern int dm_dev_create(struct dm_ioctl *param); /* from dm-ioctl.c */
>> -extern int dm_dev_remove(struct dm_ioctl *param); /* from dm-ioctl.c */
>> -extern int dm_do_resume(struct dm_ioctl *param);
>> -extern int dm_table_load(struct dm_ioctl *param, size_t param_size);
>> -
>> struct block_mount_id {
>> spinlock_t bm_lock; /* protects list */
>> struct list_head bm_devlist; /* holds pnfs_block_dev */
>> @@ -180,6 +174,7 @@ struct pnfs_block_layout {
>> spinlock_t bl_ext_lock; /* Protects list manipulation */
>> struct list_head bl_extents[EXTENT_LISTS]; /* R and RW extents */
>> struct list_head bl_commit; /* Needs layout commit */
>> + struct list_head bl_committing; /* Layout committing */
>> unsigned int bl_count; /* entries in bl_commit */
>> sector_t bl_blocksize; /* Server blocksize in sectors */
>> };
>> @@ -257,7 +252,7 @@ struct pnfs_block_dev *nfs4_blk_decode_device(struct
>> nfs_server *server,
>> struct pnfs_device *dev,
>> struct list_head *sdlist);
>> int nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo,
>> - struct nfs4_layoutget_res *lgr);
>> + struct nfs4_layoutget_res *lgr, gfp_t gfp_flags);
>> int nfs4_blk_create_block_disk_list(struct list_head *);
>> void nfs4_blk_destroy_disk_list(struct list_head *);
>> /* blocklayoutdm.c */
>> diff --git a/fs/nfs/blocklayout/blocklayoutdev.c
>> b/fs/nfs/blocklayout/blocklayoutdev.c
>> index 23469e3..a90eb6b 100644
>> --- a/fs/nfs/blocklayout/blocklayoutdev.c
>> +++ b/fs/nfs/blocklayout/blocklayoutdev.c
>> @@ -231,14 +231,16 @@ static int verify_extent(struct pnfs_block_extent
>> *be,
>> /* XDR decode pnfs_block_layout4 structure */
>> int
>> nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo,
>> - struct nfs4_layoutget_res *lgr)
>> + struct nfs4_layoutget_res *lgr, gfp_t gfp_flags)
>> {
>> struct pnfs_block_layout *bl = BLK_LO2EXT(lo);
>> - uint32_t *p = (uint32_t *)lgr->layout.buf;
>> - uint32_t *end = (uint32_t *)((char *)lgr->layout.buf + lgr->layout.len);
>> int i, status = -EIO;
>> uint32_t count;
>> struct pnfs_block_extent *be = NULL, *save;
>> + struct xdr_stream stream;
>> + struct xdr_buf buf;
>> + struct page *scratch;
>> + __be32 *p;
>> uint64_t tmp; /* Used by READSECTOR */
>> struct layout_verification lv = {
>> .mode = lgr->range.iomode,
>> @@ -246,14 +248,27 @@ nfs4_blk_process_layoutget(struct pnfs_layout_hdr
>> *lo,
>> .inval = lgr->range.offset >> 9,
>> .cowread = lgr->range.offset >> 9,
>> };
>> -
>> LIST_HEAD(extents);
>>
>> - BLK_READBUF(p, end, 4);
>> + dprintk("---> %s\n", __func__);
>> +
>> + scratch = alloc_page(gfp_flags);
>> + if (!scratch)
>> + return -ENOMEM;
>> +
>> + xdr_init_decode_pages(&stream, &buf, lgr->layoutp->pages,
>> lgr->layoutp->len);
>> + xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
>> +
>> + p = xdr_inline_decode(&stream, 4);
>> + if (unlikely(!p))
>> + goto out_err;
>> +
>> READ32(count);
>>
>> dprintk("%s enter, number of extents %i\n", __func__, count);
>> - BLK_READBUF(p, end, (28 + NFS4_DEVICEID4_SIZE) * count);
>> + p = xdr_inline_decode(&stream, (28 + NFS4_DEVICEID4_SIZE) * count);
>> + if (unlikely(!p))
>> + goto out_err;
>>
>> /* Decode individual extents, putting them in temporary
>> * staging area until whole layout is decoded to make error
>> @@ -269,6 +284,7 @@ nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo,
>> be->be_mdev = translate_devid(lo, &be->be_devid);
>> if (!be->be_mdev)
>> goto out_err;
>> +
>> /* The next three values are read in as bytes,
>> * but stored as 512-byte sector lengths
>> */
>> @@ -284,11 +300,6 @@ nfs4_blk_process_layoutget(struct pnfs_layout_hdr
>> *lo,
>> }
>> list_add_tail(&be->be_node, &extents);
>> }
>> - if (p != end) {
>> - dprintk("%s Undecoded cruft at end of opaque\n", __func__);
>> - be = NULL;
>> - goto out_err;
>> - }
>> if (lgr->range.offset + lgr->range.length != lv.start << 9) {
>> dprintk("%s Final length mismatch\n", __func__);
>> be = NULL;
>> @@ -319,6 +330,7 @@ nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo,
>> spin_unlock(&bl->bl_ext_lock);
>> status = 0;
>> out:
>> + __free_page(scratch);
>> dprintk("%s returns %i\n", __func__, status);
>> return status;
>>
>> diff --git a/fs/nfs/blocklayout/extents.c b/fs/nfs/blocklayout/extents.c
>> index 40dff82..08413ec 100644
>> --- a/fs/nfs/blocklayout/extents.c
>> +++ b/fs/nfs/blocklayout/extents.c
>> @@ -232,7 +232,7 @@ _range_has_tag(struct my_tree_t *tree, u64 start, u64
>> end, int32_t tag)
>> if ((pos->it_sector == end - tree->mtt_step_size) &&
>> (pos->it_tags & (1 << tag))) {
>> expect = pos->it_sector - tree->mtt_step_size;
>> - if (expect < start)
>> + if (pos->it_sector < tree->mtt_step_size || expect < start)
>> return 1;
>> continue;
>> } else {
>> @@ -740,19 +740,12 @@ encode_pnfs_block_layoutupdate(struct
>> pnfs_block_layout *bl,
>> struct xdr_stream *xdr,
>> const struct nfs4_layoutcommit_args *arg)
>> {
>> - sector_t start, end;
>> struct pnfs_block_short_extent *lce, *save;
>> unsigned int count = 0;
>> - struct bl_layoutupdate_data *bld = arg->layoutdriver_data;
>> - struct list_head *ranges = &bld->ranges;
>> + struct list_head *ranges = &bl->bl_committing;
>> __be32 *p, *xdr_start;
>>
>> dprintk("%s enter\n", __func__);
>> - start = arg->range.offset >> 9;
>> - end = start + (arg->range.length >> 9);
>> - dprintk("%s set start=%llu, end=%llu\n",
>> - __func__, (u64)start, (u64)end);
>> -
>> /* BUG - creation of bl_commit is buggy - need to wait for
>> * entire block to be marked WRITTEN before it can be added.
>> */
>> @@ -925,11 +918,10 @@ clean_pnfs_block_layoutupdate(struct
>> pnfs_block_layout *bl,
>> const struct nfs4_layoutcommit_args *arg,
>> int status)
>> {
>> - struct bl_layoutupdate_data *bld = arg->layoutdriver_data;
>> struct pnfs_block_short_extent *lce, *save;
>>
>> dprintk("%s status %d\n", __func__, status);
>> - list_for_each_entry_safe_reverse(lce, save, &bld->ranges, bse_node) {
>> + list_for_each_entry_safe_reverse(lce, save, &bl->bl_committing,
>> bse_node) {
>> if (likely(!status)) {
>> u64 offset = lce->bse_f_offset;
>> u64 end = offset + lce->bse_length;
>> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
>> index a693283..987260c 100644
>> --- a/fs/nfs/nfs4proc.c
>> +++ b/fs/nfs/nfs4proc.c
>> @@ -5788,7 +5788,6 @@ static int _nfs4_getdevicelist(struct nfs_server
>> *server,
>>
>> dprintk("--> %s\n", __func__);
>> status = nfs4_call_sync(server->client, server, &msg, &args.seq_args,
>> &res.seq_res, 0);
>> - put_rpccred(msg.rpc_cred);
>> dprintk("<-- %s status=%d\n", __func__, status);
>> return status;
>> }
>> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
>> index e059dc8..73f18f4 100644
>> --- a/fs/nfs/nfs4xdr.c
>> +++ b/fs/nfs/nfs4xdr.c
>> @@ -1963,7 +1963,7 @@ encode_layoutcommit(struct xdr_stream *xdr,
>> *p++ = cpu_to_be32(OP_LAYOUTCOMMIT);
>> /* Only whole file layouts */
>> p = xdr_encode_hyper(p, 0); /* offset */
>> - p = xdr_encode_hyper(p, NFS4_MAX_UINT64); /* length */
>> + p = xdr_encode_hyper(p, args->lastbytewritten+1); /* length */
>> *p++ = cpu_to_be32(0); /* reclaim */
>> p = xdr_encode_opaque_fixed(p, args->stateid.data, NFS4_STATEID_SIZE);
>> *p++ = cpu_to_be32(1); /* newoffset = TRUE */
>> @@ -5467,7 +5467,6 @@ static int decode_layoutcommit(struct xdr_stream
>> *xdr,
>> int status;
>>
>> status = decode_op_hdr(xdr, OP_LAYOUTCOMMIT);
>> - res->status = status;
>> if (status)
>> return status;
>>
>> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
>> index c88a8ee..9920bff 100644
>> --- a/fs/nfs/pnfs.c
>> +++ b/fs/nfs/pnfs.c
>> @@ -898,8 +898,6 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo,
>> ret = get_lseg(lseg);
>> break;
>> }
>> - if (cmp_layout(range, &lseg->pls_range) > 0)
>> - break;
>> }
>>
>> dprintk("%s:Return lseg %p ref %d\n",
>> @@ -1252,6 +1250,7 @@ static struct pnfs_layout_segment
>> *pnfs_list_write_lseg(struct inode *inode)
>> }
>> }
>> rv->pls_end_pos = max_pos;
>> + dprintk("%s: lseg %p end_pos %llu\n", __func__, rv, rv->pls_end_pos);
>>
>> return rv;
>> }
>> @@ -1261,6 +1260,7 @@ pnfs_set_layoutcommit(struct nfs_write_data *wdata)
>> {
>> struct nfs_inode *nfsi = NFS_I(wdata->inode);
>> loff_t end_pos = wdata->mds_offset + wdata->res.count;
>> + loff_t isize = i_size_read(wdata->inode);
>> bool mark_as_dirty = false;
>>
>> spin_lock(&nfsi->vfs_inode.i_lock);
>> @@ -1274,9 +1274,13 @@ pnfs_set_layoutcommit(struct nfs_write_data *wdata)
>> dprintk("%s: Set layoutcommit for inode %lu ",
>> __func__, wdata->inode->i_ino);
>> }
>> + if (end_pos > isize)
>> + end_pos = isize;
>> if (end_pos > wdata->lseg->pls_end_pos)
>> wdata->lseg->pls_end_pos = end_pos;
>> spin_unlock(&nfsi->vfs_inode.i_lock);
>> + dprintk("%s: lseg %p end_pos %llu\n",
>> + __func__, wdata->lseg, wdata->lseg->pls_end_pos);
>>
>> /* if pnfs_layoutcommit_inode() runs between inode locks, the next one
>> * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */
>> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
>> index b50cf3a..28d57c9 100644
>> --- a/fs/nfs/pnfs.h
>> +++ b/fs/nfs/pnfs.h
>> @@ -156,6 +156,7 @@ struct pnfs_device {
>> unsigned int layout_type;
>> unsigned int mincount;
>> struct page **pages;
>> + void *area;
>> unsigned int pgbase;
>> unsigned int pglen;
>> };
>> diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
>> index 3d93ada..79cc4ca 100644
>> --- a/include/linux/nfs_fs_sb.h
>> +++ b/include/linux/nfs_fs_sb.h
>> @@ -143,6 +143,7 @@ struct nfs_server {
>> filesystem */
>> struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */
>> struct rpc_wait_queue roc_rpcwaitq;
>> + void *pnfs_ld_data; /* per mount point data */
>> u32 pnfs_blksize; /* layout_blksize attr */
>>
>> /* the following fields are protected by nfs_client->cl_lock */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Thanks,
-Bergwolf
next prev parent reply other threads:[~2011-06-08 7:38 UTC|newest]
Thread overview: 136+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 17:24 [PATCH 00/88] pnfs block layout driver rees
2011-06-07 17:26 ` [PATCH 01/88] pnfs: add set-clear layoutdriver interface Jim Rees
2011-06-07 17:26 ` [PATCH 02/88] pnfs: let layoutcommit code handle multiple segments Jim Rees
2011-06-07 17:26 ` [PATCH 03/88] pnfs_post_submit: Restore "pnfs: pnfs_do_flush" part 1 Jim Rees
2011-06-07 17:26 ` [PATCH 04/88] pnfs_post_submit: Restore the pnfs_write_end part of "pnfs: commit and pnfs_write_end" Jim Rees
2011-06-07 17:26 ` [PATCH 05/88] pnfs: xdr support for three word attribute bitmap Jim Rees
2011-06-07 17:26 ` [PATCH 06/88] pnfs: HACK: ask for layout_blksize on mount Jim Rees
2011-06-07 17:26 ` [PATCH 07/88] pnfs: HACK: modify write_end_cleanup Jim Rees
2011-06-07 17:26 ` [PATCH 08/88] HACK: propagate fsdata into nfs_writepage_setup Jim Rees
2011-06-07 17:26 ` [PATCH 09/88] pnfs: HACK: adjust eof handling Jim Rees
2011-06-07 17:27 ` [PATCH 10/88] pnfsblock: define PNFS_BLOCK Kconfig option Jim Rees
2011-06-07 17:27 ` [PATCH 11/88] pnfsblock: blocklayout stub Jim Rees
2011-06-07 17:27 ` [PATCH 12/88] pnfsblock: expose scsi interface Jim Rees
2011-06-07 17:27 ` [PATCH 13/88] pnfsblock: scan scsi devices Jim Rees
2011-06-07 17:27 ` [PATCH 14/88] pnfsblock: call and parse getdevicelist Jim Rees
2011-06-07 17:27 ` [PATCH 15/88] pnfsblock: dm kernel interface Jim Rees
2011-06-07 17:27 ` [PATCH 16/88] pnfsblock: select BLK_DEV_DM when PNFS_BLOCK is configured Jim Rees
2011-06-07 17:27 ` [PATCH 17/88] pnfsblock: create and destroy dm metadevice Jim Rees
2011-06-07 17:27 ` [PATCH 18/88] pnfsblock: construct and load md table Jim Rees
2011-06-07 17:28 ` [PATCH 19/88] pnfsblock: layout alloc and free Jim Rees
2011-06-07 17:28 ` [PATCH 20/88] pnfsblock: basic extent code Jim Rees
2011-06-07 17:28 ` [PATCH 21/88] pnfsblock: lseg alloc and free Jim Rees
2011-06-07 17:28 ` [PATCH 22/88] pnfsblock: xdr decode pnfs_block_layout4 Jim Rees
2011-06-07 17:28 ` [PATCH 23/88] pnfsblock: merge extents Jim Rees
2011-06-07 17:28 ` [PATCH 24/88] pnfsblock: find_get_extent Jim Rees
2011-06-07 17:28 ` [PATCH 25/88] pnfsblock: bl_read_pagelist Jim Rees
2011-06-07 17:28 ` [PATCH 26/88] pnfsblock: allow use of PG_owner_priv_1 flag Jim Rees
2011-06-07 17:29 ` [PATCH 27/88] pnfsblock: read path error handling Jim Rees
2011-06-07 17:29 ` [PATCH 28/88] pnfsblock: SPLITME: add extent manipulation functions Jim Rees
2011-06-07 17:29 ` [PATCH 29/88] pnfsblock: write_begin Jim Rees
2011-06-07 17:29 ` [PATCH 30/88] pnfsblock: write_end Jim Rees
2011-06-07 17:29 ` [PATCH 31/88] pnfsblock: write_end_cleanup Jim Rees
2011-06-07 17:29 ` [PATCH 32/88] pnfsblock: bl_write_pagelist support functions Jim Rees
2011-06-07 17:29 ` [PATCH 33/88] pnfsblock: bl_write_pagelist Jim Rees
2011-06-07 17:29 ` [PATCH 34/88] pnfsblock: note written INVAL areas for layoutcommit Jim Rees
2011-06-07 17:30 ` [PATCH 35/88] pnfsblock: bl_setup_layoutcommit Jim Rees
2011-06-07 17:30 ` [PATCH 36/88] pnfsblock: encode_layoutcommit Jim Rees
2011-06-07 17:30 ` [PATCH 37/88] pnfsblock: cleanup_layoutcommit Jim Rees
2011-06-07 17:30 ` [PATCH 38/88] pnfsblock: merge rw extents Jim Rees
2011-06-07 17:30 ` [PATCH 39/88] pnfsblock: debugging dprintks for clist info Jim Rees
2011-06-07 17:30 ` [PATCH 40/88] SQAUSHME: blocklayoutdriver: NULL pointer reference when committing too many extents Jim Rees
2011-06-07 17:30 ` [PATCH 41/88] SQUASHME: pnfs-block: remove of CONFIG_PNFS fallout Jim Rees
2011-06-07 17:30 ` [PATCH 42/88] SQUASHME: pnfsblock: Fix a memory leak Jim Rees
2011-06-07 17:31 ` [PATCH 43/88] SQUASHME: pnfsblock: fix bug when decoding block device info Jim Rees
2011-06-07 17:31 ` [PATCH 44/88] SQUASHME: pnfsblock: Wrong extent refcount in block extents list Jim Rees
2011-06-07 17:31 ` [PATCH 45/88] SQUASHME: pnfsblock: Implement release_inval_marks Jim Rees
2011-06-07 17:31 ` [PATCH 46/88] SQUASHME: pnfsblock: Fix missing extent in commit list Jim Rees
2011-06-07 17:31 ` [PATCH 47/88] pnfsblock: use the session max response size for getdeviceinfo's maxcount Jim Rees
2011-06-07 17:31 ` [PATCH 48/88] SQUASHME: pnfs-block: fix compile breakage Jim Rees
2011-06-07 17:31 ` [PATCH 49/88] SQUASHME: pnfs-block: convert APIs pnfs-post-submit Jim Rees
2011-06-07 17:32 ` [PATCH 50/88] pnfsblock: Lookup list entry of layouts and tags in reverse order Jim Rees
2011-06-07 17:32 ` [PATCH 51/88] pnfsblock: expose block_class interface Jim Rees
2011-06-07 17:32 ` [PATCH 52/88] pnfsblock: iterating all local block disks instead of only scsi disks when initializing mount point Jim Rees
2011-06-07 17:32 ` [PATCH 53/88] SQUASHME: pnfsblock: set pnfs_blksize before calling set_pnfs_layoutdriver Jim Rees
2011-06-07 17:32 ` [PATCH 54/88] SQUASHME: pnfsblock: get rid of threshold policy ops Jim Rees
2011-06-07 17:32 ` [PATCH 55/88] SQUASHME: pnfsblock: write_begin adjust for removed fields Jim Rees
2011-06-07 17:32 ` [PATCH 56/88] SQUASHME: pnfsblock: write_end adjust for removed ok_to_use_pnfs Jim Rees
2011-06-07 17:32 ` [PATCH 57/88] SQUASHME: pnfsblock: write_end_cleanup " Jim Rees
2011-06-07 17:32 ` [PATCH 58/88] SQUASHME: pnfsblock: bl_write_pagelist support functions adjust for missing PG_USE_PNFS Jim Rees
2011-06-07 17:33 ` [PATCH 59/88] SQUASHME: pnfsblock: bl_write_pagelist " Jim Rees
2011-06-07 17:33 ` [PATCH 60/88] SQUASHME: pnfs-block: nfs4_blk_add_block_disk ret must be signed Jim Rees
2011-06-07 17:33 ` [PATCH 61/88] SQUASHME: pnfs-block: use new alloc/free_layout API Jim Rees
2011-06-07 17:33 ` [PATCH 62/88] SQUASHME: pnfs-block: use new commit api Jim Rees
2011-06-07 17:33 ` [PATCH 63/88] SQUASHME: pnfs-block: use new read_pagelist api Jim Rees
2011-06-07 17:33 ` [PATCH 64/88] SQUASHME: pnfs-block: use new write_pagelist api Jim Rees
2011-06-07 17:33 ` [PATCH 65/88] pnfs-block: Add support for simple rpc pipefs Jim Rees
2011-06-07 17:33 ` [PATCH 66/88] pnfs-block: Remove device creation from kernel Jim Rees
2011-06-07 17:33 ` [PATCH 67/88] SQUASHME: pnfs-block: apply types rename Jim Rees
2011-06-07 17:34 ` [PATCH 68/88] SQUASHME: pnfs-block: Revert "pnfsblock: expose block_class interface" Jim Rees
2011-06-07 17:34 ` [PATCH 69/88] SQUASHME: pnfsblock: remove obsolete include file from blocklayout.h Jim Rees
2011-06-07 17:34 ` [PATCH 70/88] SQUASHME: pnfsblock: use nfs4_deviceid Jim Rees
2011-06-07 17:34 ` [PATCH 71/88] SQUASHME: pnfsblock: no callback ops Jim Rees
2011-06-07 17:34 ` [PATCH 72/88] SQAUSHME: pnfsblock: no PNFS_NFS_SERVER Jim Rees
2011-06-07 17:34 ` [PATCH 73/88] SQUASHME: pnfsblock: no dev_notify_types Jim Rees
2011-06-07 17:34 ` [PATCH 74/88] SQUASHME: pnfsblock: use new struct pnfs_layout_hdr Jim Rees
2011-06-07 17:34 ` [PATCH 75/88] SQUASHME: pnfsblock: compile error in blocklayout code Jim Rees
2011-06-07 17:34 ` [PATCH 76/88] SQUASHME: pnfs-block: deprecate get_stripesize Jim Rees
2011-06-07 17:35 ` [PATCH 77/88] move include lines out of include file Jim Rees
2011-06-07 17:35 ` [PATCH 78/88] SQUASHME: pnfs-block: use {set,clear}_layoutdriver Jim Rees
2011-06-07 17:35 ` [PATCH 79/88] SQUASHME: pnfs-block: Return failure from bl_initialize_mountpoint Jim Rees
2011-06-07 17:35 ` [PATCH 80/88] SQUASHME: pnfs-block: fixup setup_layoutcommit arguments Jim Rees
2011-06-07 17:35 ` [PATCH 81/88] SQUASHME: pnfs-block: fixup cleanup_layoutcommit arguments Jim Rees
2011-06-07 17:35 ` [PATCH 82/88] SQUASHME: pnfs-block: fixup encode_layoutcommit arguments Jim Rees
2011-06-07 17:35 ` [PATCH 83/88] SQUASHME: pnfs-block: fixup layoutcommit methods args Jim Rees
2011-06-07 17:35 ` [PATCH 84/88] pnfs-block: fix blocklayoutdev.c for new blkdev_get_by_dev() Jim Rees
2011-06-07 17:35 ` [PATCH 85/88] SQUASHME: pnfs-block: use pnfs_layout_hdr field prefix Jim Rees
2011-06-07 17:35 ` [PATCH 86/88] SQUASHME: pnfs: blocklayout: port block layout code Jim Rees
2011-06-08 1:27 ` Benny Halevy
2011-06-08 2:06 ` Benny Halevy
2011-06-08 7:38 ` Peng Tao [this message]
2011-06-07 17:36 ` [PATCH 87/88] Add configurable prefetch size for layoutget Jim Rees
2011-06-08 2:01 ` Benny Halevy
2011-06-08 2:18 ` Jim Rees
2011-06-08 7:15 ` Peng Tao
2011-06-09 6:06 ` Benny Halevy
2011-06-09 11:49 ` Jim Rees
2011-06-09 13:32 ` Benny Halevy
2011-06-09 13:58 ` Jim Rees
2011-06-09 15:07 ` Peng Tao
2011-06-09 21:22 ` Benny Halevy
2011-06-10 6:00 ` tao.peng
2011-06-10 12:33 ` Benny Halevy
2011-06-10 14:09 ` tao.peng
2011-06-10 19:23 ` Benny Halevy
2011-06-10 20:03 ` Fred Isaman
2011-06-10 21:15 ` Benny Halevy
2011-06-11 1:46 ` Peng Tao
2011-06-10 23:20 ` Boaz Harrosh
2011-06-11 2:19 ` Peng Tao
2011-06-12 14:40 ` Boaz Harrosh
2011-06-12 18:46 ` Peng Tao
2011-06-11 1:35 ` Peng Tao
2011-06-09 21:23 ` Benny Halevy
2011-06-10 5:36 ` tao.peng
2011-06-10 12:36 ` Benny Halevy
2011-06-10 14:17 ` tao.peng
2011-06-10 19:02 ` Benny Halevy
2011-06-09 15:01 ` Peng Tao
2011-06-09 14:54 ` Peng Tao
2011-06-09 21:30 ` Benny Halevy
2011-06-10 6:02 ` tao.peng
2011-06-10 12:47 ` Benny Halevy
2011-06-10 14:30 ` tao.peng
2011-06-10 19:07 ` Benny Halevy
2011-06-10 16:23 ` Boaz Harrosh
2011-06-10 16:44 ` Boaz Harrosh
2011-06-09 6:08 ` Benny Halevy
2011-06-07 17:36 ` [PATCH 88/88] NFS41: do not update isize if inode needs layoutcommit Jim Rees
2011-06-08 2:05 ` Benny Halevy
2011-06-08 7:06 ` Peng Tao
2011-06-08 7:29 ` Peng Tao
2011-06-09 21:52 ` [PATCH 00/88] pnfs block layout driver Boaz Harrosh
2011-06-09 22:15 ` Jim Rees
2011-06-10 2:16 ` Boaz Harrosh
2011-06-10 2:20 ` Boaz Harrosh
2011-06-10 4:04 ` Benny Halevy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTinPAQ+CatVX84-i6Pfpps4BjkXv5w@mail.gmail.com \
--to=bergwolf@gmail.com \
--cc=bhalevy@panasas.com \
--cc=honey@citi.umich.edu \
--cc=linux-nfs@vger.kernel.org \
--cc=rees@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).