From 2bac2cd8f7bf7f31b92e976d500d89b958ab1788 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Tue, 13 Jan 2015 08:21:51 -0600 Subject: [PATCH] LU-5971 llite: use vui prefix for struct vvp_io members Rename members of struct vvp_io to used to start with vui_ rather than cui_. Rename several instances of struct vvp_io * from cio to vio. Signed-off-by: John L. Hammond Change-Id: Iacdd982f82469c120bf801570b1bc152034d2a11 Reviewed-on: http://review.whamcloud.com/13363 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Lai Siyao Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 32 ++++---- lustre/llite/lcommon_cl.c | 132 +++++++++++++++++---------------- lustre/llite/llite_mmap.c | 6 +- lustre/llite/rw.c | 16 ++-- lustre/llite/rw26.c | 20 ++--- lustre/llite/vvp_internal.h | 44 +++++------ lustre/llite/vvp_io.c | 175 ++++++++++++++++++++++---------------------- lustre/llite/vvp_page.c | 4 +- 8 files changed, 216 insertions(+), 213 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index e6d32d6..28bffad 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1152,7 +1152,7 @@ restart: ll_io_init(io, file, iot == CIT_WRITE); if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) { - struct vvp_io *cio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); bool range_locked = false; if (file->f_flags & O_APPEND) @@ -1160,17 +1160,17 @@ restart: else range_lock_init(&range, *ppos, *ppos + count - 1); - cio->cui_fd = LUSTRE_FPRIVATE(file); - cio->cui_io_subtype = args->via_io_subtype; - - switch (cio->cui_io_subtype) { - case IO_NORMAL: - cio->cui_iov = args->u.normal.via_iov; - cio->cui_nrsegs = args->u.normal.via_nrsegs; - cio->cui_tot_nrsegs = cio->cui_nrsegs; - cio->cui_iocb = args->u.normal.via_iocb; - if ((iot == CIT_WRITE) && - !(cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) { + vio->vui_fd = LUSTRE_FPRIVATE(file); + vio->vui_io_subtype = args->via_io_subtype; + + switch (vio->vui_io_subtype) { + case IO_NORMAL: + vio->vui_iov = args->u.normal.via_iov; + vio->vui_nrsegs = args->u.normal.via_nrsegs; + vio->vui_tot_nrsegs = vio->vui_nrsegs; + vio->vui_iocb = args->u.normal.via_iocb; + if ((iot == CIT_WRITE) && + !(vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) { CDEBUG(D_VFSTRACE, "Range lock "RL_FMT"\n", RL_PARA(&range)); result = range_lock(&lli->lli_write_tree, @@ -1181,13 +1181,13 @@ restart: range_locked = true; } down_read(&lli->lli_trunc_sem); - break; + break; case IO_SPLICE: - cio->u.splice.cui_pipe = args->u.splice.via_pipe; - cio->u.splice.cui_flags = args->u.splice.via_flags; + vio->u.splice.vui_pipe = args->u.splice.via_pipe; + vio->u.splice.vui_flags = args->u.splice.via_flags; break; default: - CERROR("unknown IO subtype %u\n", cio->cui_io_subtype); + CERROR("unknown IO subtype %u\n", vio->vui_io_subtype); LBUG(); } diff --git a/lustre/llite/lcommon_cl.c b/lustre/llite/lcommon_cl.c index 01c359a..5b04c69 100644 --- a/lustre/llite/lcommon_cl.c +++ b/lustre/llite/lcommon_cl.c @@ -207,60 +207,62 @@ int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io, __u32 enqflags, enum cl_lock_mode mode, pgoff_t start, pgoff_t end) { - struct vvp_io *cio = vvp_env_io(env); - struct cl_lock_descr *descr = &cio->cui_link.cill_descr; - struct cl_object *obj = io->ci_obj; + struct vvp_io *vio = vvp_env_io(env); + struct cl_lock_descr *descr = &vio->vui_link.cill_descr; + struct cl_object *obj = io->ci_obj; CLOBINVRNT(env, obj, vvp_object_invariant(obj)); - ENTRY; + ENTRY; - CDEBUG(D_VFSTRACE, "lock: %d [%lu, %lu]\n", mode, start, end); + CDEBUG(D_VFSTRACE, "lock: %d [%lu, %lu]\n", mode, start, end); - memset(&cio->cui_link, 0, sizeof cio->cui_link); + memset(&vio->vui_link, 0, sizeof vio->vui_link); - if (cio->cui_fd && (cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) { - descr->cld_mode = CLM_GROUP; - descr->cld_gid = cio->cui_fd->fd_grouplock.cg_gid; - } else { - descr->cld_mode = mode; - } - descr->cld_obj = obj; - descr->cld_start = start; - descr->cld_end = end; - descr->cld_enq_flags = enqflags; + if (vio->vui_fd && (vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) { + descr->cld_mode = CLM_GROUP; + descr->cld_gid = vio->vui_fd->fd_grouplock.cg_gid; + } else { + descr->cld_mode = mode; + } - cl_io_lock_add(env, io, &cio->cui_link); - RETURN(0); + descr->cld_obj = obj; + descr->cld_start = start; + descr->cld_end = end; + descr->cld_enq_flags = enqflags; + + cl_io_lock_add(env, io, &vio->vui_link); + + RETURN(0); } void vvp_io_update_iov(const struct lu_env *env, - struct vvp_io *cio, struct cl_io *io) + struct vvp_io *vio, struct cl_io *io) { - int i; - size_t size = io->u.ci_rw.crw_count; - - cio->cui_iov_olen = 0; - if (!cl_is_normalio(env, io) || cio->cui_tot_nrsegs == 0) - return; - - for (i = 0; i < cio->cui_tot_nrsegs; i++) { - struct iovec *iv = &cio->cui_iov[i]; - - if (iv->iov_len < size) - size -= iv->iov_len; - else { - if (iv->iov_len > size) { - cio->cui_iov_olen = iv->iov_len; - iv->iov_len = size; - } - break; - } - } + int i; + size_t size = io->u.ci_rw.crw_count; + + vio->vui_iov_olen = 0; + if (!cl_is_normalio(env, io) || vio->vui_tot_nrsegs == 0) + return; + + for (i = 0; i < vio->vui_tot_nrsegs; i++) { + struct iovec *iv = &vio->vui_iov[i]; + + if (iv->iov_len < size) { + size -= iv->iov_len; + } else { + if (iv->iov_len > size) { + vio->vui_iov_olen = iv->iov_len; + iv->iov_len = size; + } + break; + } + } - cio->cui_nrsegs = i + 1; - LASSERTF(cio->cui_tot_nrsegs >= cio->cui_nrsegs, + vio->vui_nrsegs = i + 1; + LASSERTF(vio->vui_tot_nrsegs >= vio->vui_nrsegs, "tot_nrsegs: %lu, nrsegs: %lu\n", - cio->cui_tot_nrsegs, cio->cui_nrsegs); + vio->vui_tot_nrsegs, vio->vui_nrsegs); } int vvp_io_one_lock(const struct lu_env *env, struct cl_io *io, @@ -283,7 +285,7 @@ void vvp_io_advance(const struct lu_env *env, const struct cl_io_slice *ios, size_t nob) { - struct vvp_io *cio = cl2vvp_io(env, ios); + struct vvp_io *vio = cl2vvp_io(env, ios); struct cl_io *io = ios->cis_io; struct cl_object *obj = ios->cis_io->ci_obj; @@ -292,29 +294,29 @@ void vvp_io_advance(const struct lu_env *env, if (!cl_is_normalio(env, io)) return; - LASSERT(cio->cui_tot_nrsegs >= cio->cui_nrsegs); - LASSERT(cio->cui_tot_count >= nob); + LASSERT(vio->vui_tot_nrsegs >= vio->vui_nrsegs); + LASSERT(vio->vui_tot_count >= nob); - cio->cui_iov += cio->cui_nrsegs; - cio->cui_tot_nrsegs -= cio->cui_nrsegs; - cio->cui_tot_count -= nob; + vio->vui_iov += vio->vui_nrsegs; + vio->vui_tot_nrsegs -= vio->vui_nrsegs; + vio->vui_tot_count -= nob; /* update the iov */ - if (cio->cui_iov_olen > 0) { + if (vio->vui_iov_olen > 0) { struct iovec *iv; - cio->cui_iov--; - cio->cui_tot_nrsegs++; - iv = &cio->cui_iov[0]; + vio->vui_iov--; + vio->vui_tot_nrsegs++; + iv = &vio->vui_iov[0]; if (io->ci_continue) { iv->iov_base += iv->iov_len; - LASSERT(cio->cui_iov_olen > iv->iov_len); - iv->iov_len = cio->cui_iov_olen - iv->iov_len; + LASSERT(vio->vui_iov_olen > iv->iov_len); + iv->iov_len = vio->vui_iov_olen - iv->iov_len; } else { /* restore the iov_len, in case of restart io. */ - iv->iov_len = cio->cui_iov_olen; + iv->iov_len = vio->vui_iov_olen; } - cio->cui_iov_olen = 0; + vio->vui_iov_olen = 0; } } @@ -517,12 +519,12 @@ int cl_setattr_ost(struct inode *inode, const struct iattr *attr, again: if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) { - struct vvp_io *cio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); - if (attr->ia_valid & ATTR_FILE) - /* populate the file descriptor for ftruncate to honor - * group lock - see LU-787 */ - cio->cui_fd = LUSTRE_FPRIVATE(attr->ia_file); + if (attr->ia_valid & ATTR_FILE) + /* populate the file descriptor for ftruncate to honor + * group lock - see LU-787 */ + vio->vui_fd = LUSTRE_FPRIVATE(attr->ia_file); result = cl_io_loop(env, io); } else { @@ -550,12 +552,12 @@ again: struct vvp_io *cl2vvp_io(const struct lu_env *env, const struct cl_io_slice *slice) { - struct vvp_io *cio; + struct vvp_io *vio; - cio = container_of(slice, struct vvp_io, cui_cl); - LASSERT(cio == vvp_env_io(env)); + vio = container_of(slice, struct vvp_io, vui_cl); + LASSERT(vio == vvp_env_io(env)); - return cio; + return vio; } struct ccc_req *cl2ccc_req(const struct cl_req_slice *slice) diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 6836802..16ce8c6 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -151,15 +151,15 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret, rc = cl_io_init(env, io, CIT_FAULT, io->ci_obj); if (rc == 0) { - struct vvp_io *cio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); - LASSERT(cio->cui_cl.cis_io == io); + LASSERT(vio->vui_cl.cis_io == io); /* mmap lock must be MANDATORY it has to cache * pages. */ io->ci_lockreq = CILR_MANDATORY; - cio->cui_fd = fd; + vio->vui_fd = fd; } else { LASSERT(rc < 0); cl_io_fini(env, io); diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index f51793a..bf59ffe 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -482,10 +482,10 @@ int ll_readahead(const struct lu_env *env, struct cl_io *io, spin_lock(&ras->ras_lock); /* Enlarge the RA window to encompass the full read */ - if (vio->cui_ra_valid && + if (vio->vui_ra_valid && ras->ras_window_start + ras->ras_window_len < - vio->cui_ra_start + vio->cui_ra_count) { - ras->ras_window_len = vio->cui_ra_start + vio->cui_ra_count - + vio->vui_ra_start + vio->vui_ra_count) { + ras->ras_window_len = vio->vui_ra_start + vio->vui_ra_count - ras->ras_window_start; } @@ -555,15 +555,15 @@ int ll_readahead(const struct lu_env *env, struct cl_io *io, CDEBUG(D_READA, DFID": ria: %lu/%lu, bead: %lu/%lu, hit: %d\n", PFID(lu_object_fid(&clob->co_lu)), ria->ria_start, ria->ria_end, - vio->cui_ra_valid ? vio->cui_ra_start : 0, - vio->cui_ra_valid ? vio->cui_ra_count : 0, + vio->vui_ra_valid ? vio->vui_ra_start : 0, + vio->vui_ra_valid ? vio->vui_ra_count : 0, hit); /* at least to extend the readahead window to cover current read */ - if (!hit && vio->cui_ra_valid && - vio->cui_ra_start + vio->cui_ra_count > ria->ria_start) { + if (!hit && vio->vui_ra_valid && + vio->vui_ra_start + vio->vui_ra_count > ria->ria_start) { /* to the end of current read window. */ - mlen = vio->cui_ra_start + vio->cui_ra_count - ria->ria_start; + mlen = vio->vui_ra_start + vio->vui_ra_count - ria->ria_start; /* trim to RPC boundary */ start = ria->ria_start & (PTLRPC_MAX_BRW_PAGES - 1); mlen = min(mlen, PTLRPC_MAX_BRW_PAGES - start); diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index be8f02f..6aedd06c 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -406,7 +406,7 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, env = cl_env_get(&refcheck); LASSERT(!IS_ERR(env)); - io = vvp_env_io(env)->cui_cl.cis_io; + io = vvp_env_io(env)->vui_cl.cis_io; LASSERT(io != NULL); for (seg = 0; seg < nr_segs; seg++) { @@ -469,10 +469,10 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, } out: if (tot_bytes > 0) { - struct vvp_io *cio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); /* no commit async for direct IO */ - cio->u.write.cui_written += tot_bytes; + vio->u.write.vui_written += tot_bytes; } cl_env_put(env, &refcheck); @@ -544,8 +544,8 @@ static int ll_write_begin(struct file *file, struct address_space *mapping, if (unlikely(vmpage == NULL || PageDirty(vmpage) || PageWriteback(vmpage))) { - struct vvp_io *cio = vvp_env_io(env); - struct cl_page_list *plist = &cio->u.write.cui_queue; + struct vvp_io *vio = vvp_env_io(env); + struct cl_page_list *plist = &vio->u.write.vui_queue; /* if the page is already in dirty cache, we have to commit * the pages right now; otherwise, it may cause deadlock @@ -619,7 +619,7 @@ static int ll_write_end(struct file *file, struct address_space *mapping, struct ll_cl_context *lcc = fsdata; const struct lu_env *env; struct cl_io *io; - struct vvp_io *cio; + struct vvp_io *vio; struct cl_page *page; unsigned from = pos & (PAGE_CACHE_SIZE - 1); bool unplug = false; @@ -632,21 +632,21 @@ static int ll_write_end(struct file *file, struct address_space *mapping, env = lcc->lcc_env; page = lcc->lcc_page; io = lcc->lcc_io; - cio = vvp_env_io(env); + vio = vvp_env_io(env); LASSERT(cl_page_is_owned(page, io)); if (copied > 0) { - struct cl_page_list *plist = &cio->u.write.cui_queue; + struct cl_page_list *plist = &vio->u.write.vui_queue; lcc->lcc_page = NULL; /* page will be queued */ /* Add it into write queue */ cl_page_list_add(plist, page); if (plist->pl_nr == 1) /* first page */ - cio->u.write.cui_from = from; + vio->u.write.vui_from = from; else LASSERT(from == 0); - cio->u.write.cui_to = from + copied; + vio->u.write.vui_to = from + copied; /* To address the deadlock in balance_dirty_pages() where * this dirty page may be written back in the same thread. */ diff --git a/lustre/llite/vvp_internal.h b/lustre/llite/vvp_internal.h index 17c7dea..1f93a64 100644 --- a/lustre/llite/vvp_internal.h +++ b/lustre/llite/vvp_internal.h @@ -93,25 +93,25 @@ enum vvp_io_subtype { */ struct vvp_io { /** super class */ - struct cl_io_slice cui_cl; - struct cl_io_lock_link cui_link; + struct cl_io_slice vui_cl; + struct cl_io_lock_link vui_link; /** * I/O vector information to or from which read/write is going. */ - struct iovec *cui_iov; - unsigned long cui_nrsegs; + struct iovec *vui_iov; + unsigned long vui_nrsegs; /** * Total iov count for left IO. */ - unsigned long cui_tot_nrsegs; + unsigned long vui_tot_nrsegs; /** * Old length for iov that was truncated partially. */ - size_t cui_iov_olen; + size_t vui_iov_olen; /** * Total size for the left IO. */ - size_t cui_tot_count; + size_t vui_tot_count; union { struct vvp_fault_io { @@ -139,37 +139,37 @@ struct vvp_io { bool ft_flags_valid; } fault; struct { - enum ccc_setattr_lock_type cui_local_lock; + enum ccc_setattr_lock_type vui_local_lock; } setattr; struct { - struct pipe_inode_info *cui_pipe; - unsigned int cui_flags; + struct pipe_inode_info *vui_pipe; + unsigned int vui_flags; } splice; struct { - struct cl_page_list cui_queue; - unsigned long cui_written; - int cui_from; - int cui_to; + struct cl_page_list vui_queue; + unsigned long vui_written; + int vui_from; + int vui_to; } write; } u; - enum vvp_io_subtype cui_io_subtype; + enum vvp_io_subtype vui_io_subtype; /** * Layout version when this IO is initialized */ - __u32 cui_layout_gen; + __u32 vui_layout_gen; /** * File descriptor against which IO is done. */ - struct ll_file_data *cui_fd; - struct kiocb *cui_iocb; + struct ll_file_data *vui_fd; + struct kiocb *vui_iocb; /* Readahead state. */ - pgoff_t cui_ra_start; - pgoff_t cui_ra_count; - /* Set when cui_ra_{start,count} have been initialized. */ - bool cui_ra_valid; + pgoff_t vui_ra_start; + pgoff_t vui_ra_count; + /* Set when vui_ra_{start,count} have been initialized. */ + bool vui_ra_valid; }; /** diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index 1e222fd..9cf8687 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -51,11 +51,11 @@ */ int cl_is_normalio(const struct lu_env *env, const struct cl_io *io) { - struct vvp_io *vio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); - LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE); + LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE); - return vio->cui_io_subtype == IO_NORMAL; + return vio->vui_io_subtype == IO_NORMAL; } /** @@ -68,7 +68,7 @@ static bool can_populate_pages(const struct lu_env *env, struct cl_io *io, struct inode *inode) { struct ll_inode_info *lli = ll_i2info(inode); - struct vvp_io *cio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); bool rc = true; switch (io->ci_type) { @@ -76,7 +76,7 @@ static bool can_populate_pages(const struct lu_env *env, struct cl_io *io, case CIT_WRITE: /* don't need lock here to check lli_layout_gen as we have held * extent lock and GROUP lock has to hold to swap layout */ - if (ll_layout_version_get(lli) != cio->cui_layout_gen) { + if (ll_layout_version_get(lli) != vio->vui_layout_gen) { io->ci_need_restart = 1; /* this will return application a short read/write */ io->ci_continue = 0; @@ -100,12 +100,12 @@ static bool can_populate_pages(const struct lu_env *env, struct cl_io *io, static int vvp_io_write_iter_init(const struct lu_env *env, const struct cl_io_slice *ios) { - struct vvp_io *cio = cl2vvp_io(env, ios); + struct vvp_io *vio = cl2vvp_io(env, ios); - cl_page_list_init(&cio->u.write.cui_queue); - cio->u.write.cui_written = 0; - cio->u.write.cui_from = 0; - cio->u.write.cui_to = PAGE_SIZE; + cl_page_list_init(&vio->u.write.vui_queue); + vio->u.write.vui_written = 0; + vio->u.write.vui_from = 0; + vio->u.write.vui_to = PAGE_SIZE; return 0; } @@ -113,9 +113,9 @@ static int vvp_io_write_iter_init(const struct lu_env *env, static void vvp_io_write_iter_fini(const struct lu_env *env, const struct cl_io_slice *ios) { - struct vvp_io *cio = cl2vvp_io(env, ios); + struct vvp_io *vio = cl2vvp_io(env, ios); - LASSERT(cio->u.write.cui_queue.pl_nr == 0); + LASSERT(vio->u.write.vui_queue.pl_nr == 0); } static int vvp_io_fault_iter_init(const struct lu_env *env, @@ -124,7 +124,7 @@ static int vvp_io_fault_iter_init(const struct lu_env *env, struct vvp_io *vio = cl2vvp_io(env, ios); struct inode *inode = vvp_object_inode(ios->cis_obj); - LASSERT(inode == vio->cui_fd->fd_file->f_dentry->d_inode); + LASSERT(inode == vio->vui_fd->fd_file->f_dentry->d_inode); vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime); return 0; @@ -134,7 +134,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) { struct cl_io *io = ios->cis_io; struct cl_object *obj = io->ci_obj; - struct vvp_io *cio = cl2vvp_io(env, ios); + struct vvp_io *vio = cl2vvp_io(env, ios); struct inode *inode = vvp_object_inode(obj); CLOBINVRNT(env, obj, vvp_object_invariant(obj)); @@ -143,7 +143,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) "restore needed %d\n", PFID(lu_object_fid(&obj->co_lu)), io->ci_ignore_layout, io->ci_verify_layout, - cio->cui_layout_gen, io->ci_restore_needed); + vio->vui_layout_gen, io->ci_restore_needed); if (io->ci_restore_needed == 1) { int rc; @@ -177,12 +177,12 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) /* check layout version */ ll_layout_refresh(inode, &gen); - io->ci_need_restart = cio->cui_layout_gen != gen; + io->ci_need_restart = vio->vui_layout_gen != gen; if (io->ci_need_restart) { CDEBUG(D_VFSTRACE, DFID" layout changed from %d to %d.\n", PFID(lu_object_fid(&obj->co_lu)), - cio->cui_layout_gen, gen); + vio->vui_layout_gen, gen); /* today successful restore is the only possible * case */ /* restore was done, clear restoring state */ @@ -239,15 +239,15 @@ static int vvp_mmap_locks(const struct lu_env *env, if (!cl_is_normalio(env, io)) RETURN(0); - if (vio->cui_iov == NULL) /* nfs or loop back device write */ - RETURN(0); + if (vio->vui_iov == NULL) /* nfs or loop back device write */ + RETURN(0); - /* No MM (e.g. NFS)? No vmas too. */ - if (mm == NULL) - RETURN(0); + /* No MM (e.g. NFS)? No vmas too. */ + if (mm == NULL) + RETURN(0); - for (seg = 0; seg < vio->cui_nrsegs; seg++) { - const struct iovec *iv = &vio->cui_iov[seg]; + for (seg = 0; seg < vio->vui_nrsegs; seg++) { + const struct iovec *iv = &vio->vui_iov[seg]; addr = (unsigned long)iv->iov_base; count = iv->iov_len; @@ -308,19 +308,19 @@ static int vvp_mmap_locks(const struct lu_env *env, static int vvp_io_rw_lock(const struct lu_env *env, struct cl_io *io, enum cl_lock_mode mode, loff_t start, loff_t end) { - struct vvp_io *cio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); int result; int ast_flags = 0; LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE); ENTRY; - vvp_io_update_iov(env, cio, io); + vvp_io_update_iov(env, vio, io); if (io->u.ci_rw.crw_nonblock) ast_flags |= CEF_NONBLOCK; - result = vvp_mmap_locks(env, cio, io); + result = vvp_mmap_locks(env, vio, io); if (result == 0) result = vvp_io_one_lock(env, io, ast_flags, mode, start, end); @@ -386,7 +386,7 @@ static int vvp_io_setattr_iter_init(const struct lu_env *env, static int vvp_io_setattr_lock(const struct lu_env *env, const struct cl_io_slice *ios) { - struct vvp_io *cio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); struct cl_io *io = ios->cis_io; __u64 new_size; __u32 enqflags = 0; @@ -403,7 +403,8 @@ static int vvp_io_setattr_lock(const struct lu_env *env, return 0; new_size = 0; } - cio->u.setattr.cui_local_lock = SETATTR_EXTENT_LOCK; + + vio->u.setattr.vui_local_lock = SETATTR_EXTENT_LOCK; return vvp_io_one_lock(env, io, enqflags, CLM_WRITE, new_size, OBD_OBJECT_EOF); @@ -506,12 +507,12 @@ static int vvp_io_read_start(const struct lu_env *env, struct cl_io *io = ios->cis_io; struct cl_object *obj = io->ci_obj; struct inode *inode = vvp_object_inode(obj); - struct file *file = vio->cui_fd->fd_file; + struct file *file = vio->vui_fd->fd_file; int result; loff_t pos = io->u.ci_rd.rd.crw_pos; long cnt = io->u.ci_rd.rd.crw_count; - long tot = vio->cui_tot_count; + long tot = vio->vui_tot_count; int exceed = 0; CLOBINVRNT(env, obj, vvp_object_invariant(obj)); @@ -532,36 +533,36 @@ static int vvp_io_read_start(const struct lu_env *env, inode->i_ino, cnt, pos, i_size_read(inode)); /* turn off the kernel's read-ahead */ - vio->cui_fd->fd_file->f_ra.ra_pages = 0; + vio->vui_fd->fd_file->f_ra.ra_pages = 0; /* initialize read-ahead window once per syscall */ - if (!vio->cui_ra_valid) { - vio->cui_ra_valid = true; - vio->cui_ra_start = cl_index(obj, pos); - vio->cui_ra_count = cl_index(obj, tot + PAGE_CACHE_SIZE - 1); + if (!vio->vui_ra_valid) { + vio->vui_ra_valid = true; + vio->vui_ra_start = cl_index(obj, pos); + vio->vui_ra_count = cl_index(obj, tot + PAGE_CACHE_SIZE - 1); ll_ras_enter(file); } - /* BUG: 5972 */ - file_accessed(file); - switch (vio->cui_io_subtype) { - case IO_NORMAL: - LASSERT(vio->cui_iocb->ki_pos == pos); - result = generic_file_aio_read(vio->cui_iocb, - vio->cui_iov, vio->cui_nrsegs, - vio->cui_iocb->ki_pos); + /* BUG: 5972 */ + file_accessed(file); + switch (vio->vui_io_subtype) { + case IO_NORMAL: + LASSERT(vio->vui_iocb->ki_pos == pos); + result = generic_file_aio_read(vio->vui_iocb, + vio->vui_iov, vio->vui_nrsegs, + vio->vui_iocb->ki_pos); break; case IO_SPLICE: result = generic_file_splice_read(file, &pos, - vio->u.splice.cui_pipe, cnt, - vio->u.splice.cui_flags); + vio->u.splice.vui_pipe, cnt, + vio->u.splice.vui_flags); /* LU-1109: do splice read stripe by stripe otherwise if it * may make nfsd stuck if this read occupied all internal pipe * buffers. */ io->ci_continue = 0; break; default: - CERROR("Wrong IO type %u\n", vio->cui_io_subtype); + CERROR("Wrong IO type %u\n", vio->vui_io_subtype); LBUG(); } @@ -570,7 +571,7 @@ out: if (result < cnt) io->ci_continue = 0; io->ci_nob += result; - ll_rw_stats_tally(ll_i2sbi(inode), current->pid, vio->cui_fd, + ll_rw_stats_tally(ll_i2sbi(inode), current->pid, vio->vui_fd, pos, result, READ); result = 0; } @@ -685,25 +686,25 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io) { struct cl_object *obj = io->ci_obj; struct inode *inode = vvp_object_inode(obj); - struct vvp_io *cio = vvp_env_io(env); - struct cl_page_list *queue = &cio->u.write.cui_queue; + struct vvp_io *vio = vvp_env_io(env); + struct cl_page_list *queue = &vio->u.write.vui_queue; struct cl_page *page; int rc = 0; int bytes = 0; - unsigned int npages = cio->u.write.cui_queue.pl_nr; + unsigned int npages = vio->u.write.vui_queue.pl_nr; ENTRY; if (npages == 0) RETURN(0); CDEBUG(D_VFSTRACE, "commit async pages: %d, from %d, to %d\n", - npages, cio->u.write.cui_from, cio->u.write.cui_to); + npages, vio->u.write.vui_from, vio->u.write.vui_to); LASSERT(page_list_sanity_check(obj, queue)); /* submit IO with async write */ rc = cl_io_commit_async(env, io, queue, - cio->u.write.cui_from, cio->u.write.cui_to, + vio->u.write.vui_from, vio->u.write.vui_to, write_commit_callback); npages -= queue->pl_nr; /* already committed pages */ if (npages > 0) { @@ -711,18 +712,18 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io) bytes = npages << PAGE_SHIFT; /* first page */ - bytes -= cio->u.write.cui_from; + bytes -= vio->u.write.vui_from; if (queue->pl_nr == 0) /* last page */ - bytes -= PAGE_SIZE - cio->u.write.cui_to; + bytes -= PAGE_SIZE - vio->u.write.vui_to; LASSERTF(bytes > 0, "bytes = %d, pages = %d\n", bytes, npages); - cio->u.write.cui_written += bytes; + vio->u.write.vui_written += bytes; CDEBUG(D_VFSTRACE, "Committed %d pages %d bytes, tot: %ld\n", - npages, bytes, cio->u.write.cui_written); + npages, bytes, vio->u.write.vui_written); /* the first page must have been written. */ - cio->u.write.cui_from = 0; + vio->u.write.vui_from = 0; } LASSERT(page_list_sanity_check(obj, queue)); LASSERT(ergo(rc == 0, queue->pl_nr == 0)); @@ -730,10 +731,10 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io) /* out of quota, try sync write */ if (rc == -EDQUOT && !cl_io_is_mkwrite(io)) { rc = vvp_io_commit_sync(env, io, queue, - cio->u.write.cui_from, - cio->u.write.cui_to); + vio->u.write.vui_from, + vio->u.write.vui_to); if (rc > 0) { - cio->u.write.cui_written += rc; + vio->u.write.vui_written += rc; rc = 0; } } @@ -764,7 +765,7 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io) static int vvp_io_write_start(const struct lu_env *env, const struct cl_io_slice *ios) { - struct vvp_io *cio = cl2vvp_io(env, ios); + struct vvp_io *vio = cl2vvp_io(env, ios); struct cl_io *io = ios->cis_io; struct cl_object *obj = io->ci_obj; struct inode *inode = vvp_object_inode(obj); @@ -777,21 +778,21 @@ static int vvp_io_write_start(const struct lu_env *env, if (!can_populate_pages(env, io, inode)) RETURN(0); - if (cl_io_is_append(io)) { - /* - * PARALLEL IO This has to be changed for parallel IO doing - * out-of-order writes. - */ + if (cl_io_is_append(io)) { + /* + * PARALLEL IO This has to be changed for parallel IO doing + * out-of-order writes. + */ ll_merge_attr(env, inode); - pos = io->u.ci_wr.wr.crw_pos = i_size_read(inode); - cio->cui_iocb->ki_pos = pos; - } else { - LASSERT(cio->cui_iocb->ki_pos == pos); + pos = io->u.ci_wr.wr.crw_pos = i_size_read(inode); + vio->vui_iocb->ki_pos = pos; + } else { + LASSERT(vio->vui_iocb->ki_pos == pos); } CDEBUG(D_VFSTRACE, "write: [%lli, %lli)\n", pos, pos + (long long)cnt); - if (cio->cui_iov == NULL) { + if (vio->vui_iov == NULL) { /* from a temp io in ll_cl_init(). */ result = 0; } else { @@ -803,13 +804,13 @@ static int vvp_io_write_start(const struct lu_env *env, * consistency, proper locking to protect against writes, * trucates, etc. is handled in the higher layers of lustre. */ - result = __generic_file_aio_write(cio->cui_iocb, - cio->cui_iov, cio->cui_nrsegs, - &cio->cui_iocb->ki_pos); + result = __generic_file_aio_write(vio->vui_iocb, + vio->vui_iov, vio->vui_nrsegs, + &vio->vui_iocb->ki_pos); if (result > 0 || result == -EIOCBQUEUED) { ssize_t err; - err = generic_write_sync(cio->cui_iocb->ki_filp, + err = generic_write_sync(vio->vui_iocb->ki_filp, pos, result); if (err < 0 && result > 0) result = err; @@ -818,8 +819,8 @@ static int vvp_io_write_start(const struct lu_env *env, } if (result > 0) { result = vvp_io_write_commit(env, io); - if (cio->u.write.cui_written > 0) { - result = cio->u.write.cui_written; + if (vio->u.write.vui_written > 0) { + result = vio->u.write.vui_written; io->ci_nob += result; CDEBUG(D_VFSTRACE, "write: nob %zd, result: %zd\n", @@ -836,7 +837,7 @@ static int vvp_io_write_start(const struct lu_env *env, if (result < cnt) io->ci_continue = 0; ll_rw_stats_tally(ll_i2sbi(inode), current->pid, - cio->cui_fd, pos, result, WRITE); + vio->vui_fd, pos, result, WRITE); result = 0; } @@ -1074,7 +1075,7 @@ static int vvp_io_read_page(const struct lu_env *env, struct cl_page *page = slice->cpl_page; struct inode *inode = vvp_object_inode(slice->cpl_obj); struct ll_sb_info *sbi = ll_i2sbi(inode); - struct ll_file_data *fd = cl2vvp_io(env, ios)->cui_fd; + struct ll_file_data *fd = cl2vvp_io(env, ios)->vui_fd; struct ll_readahead_state *ras = &fd->fd_ras; struct cl_2queue *queue = &io->ci_queue; @@ -1158,11 +1159,11 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj, "restore needed %d\n", PFID(lu_object_fid(&obj->co_lu)), io->ci_ignore_layout, io->ci_verify_layout, - vio->cui_layout_gen, io->ci_restore_needed); + vio->vui_layout_gen, io->ci_restore_needed); - CL_IO_SLICE_CLEAN(vio, cui_cl); - cl_io_slice_add(io, &vio->cui_cl, obj, &vvp_io_ops); - vio->cui_ra_valid = false; + CL_IO_SLICE_CLEAN(vio, vui_cl); + cl_io_slice_add(io, &vio->vui_cl, obj, &vvp_io_ops); + vio->vui_ra_valid = false; result = 0; if (io->ci_type == CIT_READ || io->ci_type == CIT_WRITE) { size_t count; @@ -1174,8 +1175,8 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj, if (count == 0) result = 1; else { - vio->cui_tot_count = count; - vio->cui_tot_nrsegs = 0; + vio->vui_tot_count = count; + vio->vui_tot_nrsegs = 0; } /* for read/write, we store the jobid in the inode, and @@ -1200,7 +1201,7 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj, * even for operations requiring to open file, such as read and write, * because it might not grant layout lock in IT_OPEN. */ if (result == 0 && !io->ci_ignore_layout) { - result = ll_layout_refresh(inode, &vio->cui_layout_gen); + result = ll_layout_refresh(inode, &vio->vui_layout_gen); if (result == -ENOENT) /* If the inode on MDS has been removed, but the objects * on OSTs haven't been destroyed (async unlink), layout diff --git a/lustre/llite/vvp_page.c b/lustre/llite/vvp_page.c index f6ff571..fac1924 100644 --- a/lustre/llite/vvp_page.c +++ b/lustre/llite/vvp_page.c @@ -372,9 +372,9 @@ static int vvp_page_is_under_lock(const struct lu_env *env, if (io->ci_type == CIT_READ || io->ci_type == CIT_WRITE || io->ci_type == CIT_FAULT) { - struct vvp_io *cio = vvp_env_io(env); + struct vvp_io *vio = vvp_env_io(env); - if (unlikely(cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) + if (unlikely(vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) *max_index = CL_PAGE_EOF; } RETURN(0); -- 1.8.3.1