From 08399cf34afef8415d1dc7779ff4e24715929243 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 21 Feb 2009 18:44:25 +0000 Subject: [PATCH] - struct local_niobuf is sligthly changed - all its users too --- lustre/include/lustre_export.h | 1 + lustre/include/obd.h | 31 +++++++++++++++++-------------- lustre/lvfs/fsfilt_ext3.c | 25 ++++++++++++------------- lustre/obdecho/echo.c | 16 ++++++++-------- lustre/ost/ost_handler.c | 14 ++++++++------ 5 files changed, 46 insertions(+), 41 deletions(-) diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h index 6ee97d6..0a6287b3 100644 --- a/lustre/include/lustre_export.h +++ b/lustre/include/lustre_export.h @@ -83,6 +83,7 @@ struct ec_export_data { /* echo client */ /* In-memory access to client data from OST struct */ struct filter_export_data { spinlock_t fed_lock; /* protects fed_open_head */ + struct semaphore fed_lastrcvd_lock; struct lsd_client_data *fed_lcd; loff_t fed_lr_off; int fed_lr_idx; diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 868e86f..0728503 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -286,20 +286,21 @@ struct filter_obd { /* NB this field MUST be first */ struct obd_device_target fo_obt; const char *fo_fstype; - struct vfsmount *fo_vfsmnt; + + //struct vfsmount *fo_vfsmnt; int fo_group_count; - cfs_dentry_t *fo_dentry_O; - cfs_dentry_t **fo_dentry_O_groups; - struct filter_subdirs *fo_dentry_O_sub; + //cfs_dentry_t *fo_dentry_O; + //cfs_dentry_t **fo_dentry_O_groups; + ///struct filter_subdirs *fo_dentry_O_sub; struct semaphore fo_init_lock; /* group initialization lock */ int fo_committed_group; spinlock_t fo_objidlock; /* protect fo_lastobjid */ spinlock_t fo_translock; /* protect fsd_last_transno */ - struct file *fo_rcvd_filp; - struct file *fo_health_check_filp; + //struct file *fo_rcvd_filp; + //struct file *fo_health_check_filp; struct lr_server_data *fo_fsd; unsigned long *fo_last_rcvd_slots; __u64 fo_mount_count; @@ -321,7 +322,7 @@ struct filter_obd { struct obd_import *fo_mdc_imp; struct obd_uuid fo_mdc_uuid; struct lustre_handle fo_mdc_conn; - struct file **fo_last_objid_files; + //struct file **fo_last_objid_files; __u64 *fo_last_objids; /* last created objid for groups, * protected by fo_objidlock */ @@ -743,13 +744,15 @@ struct lmv_obd { }; struct niobuf_local { - __u64 offset; - __u32 len; - __u32 flags; - cfs_page_t *page; - cfs_dentry_t *dentry; - int lnb_grant_used; - int rc; + __u64 file_offset; + __u32 page_offset; + __u32 len; + __u32 flags; + cfs_page_t *page; + void *obj; + int lnb_grant_used; + unsigned long bytes; + int rc; }; #define LUSTRE_FLD_NAME "fld" diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 16b250e..4dd463c 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -316,8 +316,8 @@ static int fsfilt_ext3_credits_needed(int objcount, struct fsfilt_objinfo *fso, for (i = 0, j = 0; i < objcount; i++, fso++) { /* two or more dindirect blocks in case we cross boundary */ - int ndind = (long)((nb[j + fso->fso_bufcnt - 1].offset - - nb[j].offset) >> + int ndind = (long)((nb[j + fso->fso_bufcnt - 1].file_offset - + nb[j].file_offset) >> sb->s_blocksize_bits) / (EXT3_ADDR_PER_BLOCK(sb) * EXT3_ADDR_PER_BLOCK(sb)); nbitmaps += min(fso->fso_bufcnt, ndind > 0 ? ndind : 2); @@ -328,14 +328,14 @@ static int fsfilt_ext3_credits_needed(int objcount, struct fsfilt_objinfo *fso, j += fso->fso_bufcnt; } - next_indir = nb[0].offset + + next_indir = nb[0].file_offset + (EXT3_ADDR_PER_BLOCK(sb) << sb->s_blocksize_bits); for (i = 1; i < niocount; i++) { - if (nb[i].offset >= next_indir) { + if (nb[i].file_offset >= next_indir) { nbitmaps++; /* additional indirect */ - next_indir = nb[i].offset + + next_indir = nb[i].file_offset + (EXT3_ADDR_PER_BLOCK(sb)<s_blocksize_bits); - } else if (nb[i].offset != nb[i - 1].offset + sb->s_blocksize) { + } else if (nb[i].file_offset != nb[i-1].file_offset+sb->s_blocksize){ nbitmaps++; /* additional indirect */ } nbitmaps += blockpp; /* each leaf in different group? */ @@ -696,7 +696,7 @@ static int fsfilt_ext3_add_journal_cb(struct obd_device *obd, __u64 last_rcvd, { struct fsfilt_cb_data *fcb; - OBD_SLAB_ALLOC(fcb, fcb_cache, CFS_ALLOC_IO, sizeof *fcb); + OBD_SLAB_ALLOC_PTR_GFP(fcb, fcb_cache, CFS_ALLOC_IO); if (fcb == NULL) RETURN(-ENOMEM); @@ -1125,18 +1125,17 @@ int fsfilt_ext3_map_bm_inode_pages(struct inode *inode, struct page **page, { int blocks_per_page = CFS_PAGE_SIZE >> inode->i_blkbits; unsigned long *b; - int rc = 0, i, *cr; + int rc = 0, i; - for (i = 0, cr = created, b = blocks; i < pages; i++, page++) { - rc = ext3_map_inode_page(inode, *page, b, cr, create); + for (i = 0, b = blocks; i < pages; i++, page++) { + rc = ext3_map_inode_page(inode, *page, b, NULL, create); if (rc) { - CERROR("ino %lu, blk %lu cr %u create %d: rc %d\n", - inode->i_ino, *b, *cr, create, rc); + CERROR("ino %lu, blk %lu create %d: rc %d\n", + inode->i_ino, *b, create, rc); break; } b += blocks_per_page; - cr += blocks_per_page; } return rc; } diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 6684c7a..5711528 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -324,14 +324,14 @@ static int echo_map_nb_to_lb(struct obdo *oa, struct obd_ioobj *obj, if (*left == 0) return -EINVAL; - res->offset = offset; + res->file_offset = offset; res->len = plen; - LASSERT((res->offset & ~CFS_PAGE_MASK) + res->len <= CFS_PAGE_SIZE); + LASSERT((res->file_offset&~CFS_PAGE_MASK)+res->len <= CFS_PAGE_SIZE); if (ispersistent && - (res->offset >> CFS_PAGE_SHIFT) < ECHO_PERSISTENT_PAGES) { - res->page = echo_persistent_pages[res->offset >> + (res->file_offset >> CFS_PAGE_SHIFT) < ECHO_PERSISTENT_PAGES) { + res->page = echo_persistent_pages[res->file_offset >> CFS_PAGE_SHIFT]; /* Take extra ref so __free_pages() can be called OK */ cfs_get_page (res->page); @@ -345,14 +345,14 @@ static int echo_map_nb_to_lb(struct obdo *oa, struct obd_ioobj *obj, } CDEBUG(D_PAGE, "$$$$ get page %p @ "LPU64" for %d\n", - res->page, res->offset, res->len); + res->page, res->file_offset, res->len); if (cmd & OBD_BRW_READ) res->rc = res->len; if (debug_setup) echo_page_debug_setup(res->page, cmd, obj->ioo_id, - res->offset, res->len); + res->file_offset, res->len); offset += plen; len -= plen; @@ -494,11 +494,11 @@ int echo_commitrw(int cmd, struct obd_export *export, struct obdo *oa, addr = cfs_kmap(page); CDEBUG(D_PAGE, "$$$$ use page %p, addr %p@"LPU64"\n", - r->page, addr, r->offset); + r->page, addr, r->file_offset); if (verify) { vrc = echo_page_debug_check(page, obj->ioo_id, - r->offset, r->len); + r->file_offset, r->len); /* check all the pages always */ if (vrc != 0 && rc == 0) rc = vrc; diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index cb520bb..78ff119 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -708,8 +708,7 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti) if (page_rc != 0) { /* some data! */ LASSERT (local_nb[i].page != NULL); ptlrpc_prep_bulk_page(desc, local_nb[i].page, - local_nb[i].offset & ~CFS_PAGE_MASK, - page_rc); + local_nb[i].page_offset, page_rc); } if (page_rc != local_nb[i].len) { /* short read */ @@ -975,8 +974,11 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) for (i = 0; i < npages; i++) ptlrpc_prep_bulk_page(desc, local_nb[i].page, - local_nb[i].offset & ~CFS_PAGE_MASK, - local_nb[i].len); + local_nb[i].page_offset, local_nb[i].len); + + rc = sptlrpc_svc_prep_bulk(req, desc); + if (rc != 0) + GOTO(out_lock, rc); rc = sptlrpc_svc_prep_bulk(req, desc); if (rc != 0) @@ -1092,8 +1094,8 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) body->oa.o_id, body->oa.o_valid & OBD_MD_FLGROUP ? body->oa.o_gr : (__u64)0, - local_nb[0].offset, - local_nb[npages-1].offset + + local_nb[0].file_offset, + local_nb[npages-1].file_offset + local_nb[npages-1].len - 1 ); CERROR("client csum %x, original server csum %x, " "server csum now %x\n", -- 1.8.3.1