From: James Simmons Date: Mon, 31 Jul 2017 18:24:19 +0000 (-0400) Subject: LU-8958 llite: remove llite_loop left overs X-Git-Tag: 2.10.52~41 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=2e875d5fc5b73f735bd42f5da54c23e4c2d35d5c;p=fs%2Flustre-release.git LU-8958 llite: remove llite_loop left overs With the removal of llite_loop several pieces of code are still present in the llite layer that were only used by the lloop device. We can remove these no longer used pieces. Change-Id: I67f2761ae29b8ba7bb3bc9bcc3e3f8ece73a3ea3 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/26795 Tested-by: Jenkins Reviewed-by: Dmitry Eremin Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index bc593c4..ffced12 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -747,23 +747,6 @@ inode_ops_truncate, [ ]) # LC_IOP_TRUNCATE # -# LC_REQUEST_QUEUE_UNPLUG_FN -# -# 2.6.39 remove unplug_fn from request_queue. -# -AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN], [ -LB_CHECK_COMPILE([if 'request_queue' has 'unplug_fn' field], -request_queue_unplug_fn, [ - #include -],[ - do {} while(sizeof(((struct request_queue *)0)->unplug_fn)); -],[ - AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1, - [request_queue has unplug_fn field]) -]) -]) # LC_REQUEST_QUEUE_UNPLUG_FN - -# # LC_HAVE_FSTYPE_MOUNT # # 2.6.39 replace get_sb with mount in struct file_system_type @@ -959,26 +942,6 @@ radix_tree_exceptional_entry, [ ]) # LC_RADIX_EXCEPTION_ENTRY # -# LC_HAVE_VOID_MAKE_REQUEST_FN -# -# 3.2 request_queue.make_request_fn defined as function returns with void -# see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f -# -AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN], [ -LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns void but not int], -make_request_fn_void, [ - #include -],[ - int ret; - make_request_fn *mrf; - ret = mrf(NULL, NULL); -],[],[ - AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1, - [request_queue.make_request_fn returns void but not int]) -]) -]) # LC_HAVE_VOID_MAKE_REQUEST_FN - -# # LC_HAVE_PROTECT_I_NLINK # # 3.2 protects inode->i_nlink from direct modification @@ -1487,26 +1450,6 @@ proc_remove, [ ]) ]) # LC_HAVE_PROC_REMOVE -# -# LC_BLKDEV_RELEASE_RETURN_INT -# -# 3.10 release for block device doesn't return int -# -AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT], [ -LB_CHECK_COMPILE([if 'block_device_operations' release returns 'int'], -block_device_ops_release_return_int, [ - #include -],[ - struct block_device_operations fops; - int i __attribute__ ((unused)); - - i = fops.release(NULL, 0); -],[ - AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1, - [block device release returns int]) -]) -]) # LC_BLKDEV_RELEASE_RETURN_INT - AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [ LB_CHECK_COMPILE([if get_projid exists], get_projid, [ @@ -2289,26 +2232,6 @@ locks_lock_file_wait, [ ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT # -# LC_HAVE_QC_MAKE_REQUEST_FN -# -# 4.4 request_queue.make_request_fn defined as function returns with blk_qc_t -# see kernel commit dece16353ef47d8d33f5302bc158072a9d65e26f -# -AC_DEFUN([LC_HAVE_QC_MAKE_REQUEST_FN], [ -LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns blk_qc_t], -make_request_fn_blk_qc_t, [ - #include -],[ - blk_qc_t ret; - make_request_fn *mrf; - ret = mrf(NULL, NULL); -],[ - AC_DEFINE(HAVE_QC_MAKE_REQUEST_FN, 1, - [request_queue.make_request_fn returns blk_qc_t]) -]) -]) # LC_HAVE_QC_MAKE_REQUEST_FN - -# # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY # # 4.4 kernel merged type-specific data with the payload data for keys @@ -2726,7 +2649,6 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_HAVE_BLK_PLUG # 2.6.39 - LC_REQUEST_QUEUE_UNPLUG_FN LC_HAVE_FHANDLE_SYSCALLS LC_HAVE_FSTYPE_MOUNT LC_IOP_TRUNCATE @@ -2747,7 +2669,6 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_HAVE_LOOP_CTL_GET_FREE # 3.2 - LC_HAVE_VOID_MAKE_REQUEST_FN LC_HAVE_PROTECT_I_NLINK # 3.3 @@ -2786,7 +2707,6 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_HAVE_IS_SXID # 3.10 - LC_BLKDEV_RELEASE_RETURN_INT LC_HAVE_REMOVE_PROC_SUBTREE LC_HAVE_PROC_REMOVE LC_HAVE_PROJECT_QUOTA @@ -2857,7 +2777,6 @@ AC_DEFUN([LC_PROG_LINUX], [ # 4.4 LC_HAVE_LOCKS_LOCK_FILE_WAIT - LC_HAVE_QC_MAKE_REQUEST_FN LC_HAVE_KEY_PAYLOAD_DATA_ARRAY LC_HAVE_BI_CNT diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index 11217c2..8e2a9c6 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -290,19 +290,6 @@ static inline int ll_namei_to_lookup_intent_flag(int flag) return flag; } -#ifdef HAVE_QC_MAKE_REQUEST_FN -# define ll_mrf_ret blk_qc_t -# define LL_MRF_RETURN(rc) RETURN(BLK_QC_T_NONE) -#else -# ifdef HAVE_VOID_MAKE_REQUEST_FN -# define ll_mrf_ret void -# define LL_MRF_RETURN(rc) -# else -# define ll_mrf_ret int -# define LL_MRF_RETURN(rc) RETURN(rc) -# endif -#endif - #include #ifndef HAVE_PROTECT_I_NLINK static inline void set_nlink(struct inode *inode, unsigned int nlink) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 2607591..0a89689 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -60,10 +60,6 @@ ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg); static int ll_lease_close(struct obd_client_handle *och, struct inode *inode, bool *lease_broken); -static enum llioc_iter -ll_iocontrol_call(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, int *rcp); - static struct ll_file_data *ll_file_data_get(void) { struct ll_file_data *fd; @@ -2943,17 +2939,10 @@ out_ladvise: RETURN(ll_ioctl_fsgetxattr(inode, cmd, arg)); case LL_IOC_FSSETXATTR: RETURN(ll_ioctl_fssetxattr(inode, cmd, arg)); - default: { - int err; - - if (LLIOC_STOP == - ll_iocontrol_call(inode, file, cmd, arg, &err)) - RETURN(err); - + default: RETURN(obd_iocontrol(cmd, ll_i2dtexp(inode), 0, NULL, (void __user *)arg)); } - } } #ifndef HAVE_FILE_LLSEEK_SIZE @@ -4147,107 +4136,6 @@ struct inode_operations ll_file_inode_operations = { #endif }; -/* dynamic ioctl number support routins */ -static struct llioc_ctl_data { - struct rw_semaphore ioc_sem; - struct list_head ioc_head; -} llioc = { - __RWSEM_INITIALIZER(llioc.ioc_sem), - LIST_HEAD_INIT(llioc.ioc_head) -}; - - -struct llioc_data { - struct list_head iocd_list; - unsigned int iocd_size; - llioc_callback_t iocd_cb; - unsigned int iocd_count; - unsigned int iocd_cmd[0]; -}; - -void *ll_iocontrol_register(llioc_callback_t cb, int count, unsigned int *cmd) -{ - unsigned int size; - struct llioc_data *in_data = NULL; - ENTRY; - - if (cb == NULL || cmd == NULL || - count > LLIOC_MAX_CMD || count < 0) - RETURN(NULL); - - size = sizeof(*in_data) + count * sizeof(unsigned int); - OBD_ALLOC(in_data, size); - if (in_data == NULL) - RETURN(NULL); - - memset(in_data, 0, sizeof(*in_data)); - in_data->iocd_size = size; - in_data->iocd_cb = cb; - in_data->iocd_count = count; - memcpy(in_data->iocd_cmd, cmd, sizeof(unsigned int) * count); - - down_write(&llioc.ioc_sem); - list_add_tail(&in_data->iocd_list, &llioc.ioc_head); - up_write(&llioc.ioc_sem); - - RETURN(in_data); -} - -void ll_iocontrol_unregister(void *magic) -{ - struct llioc_data *tmp; - - if (magic == NULL) - return; - - down_write(&llioc.ioc_sem); - list_for_each_entry(tmp, &llioc.ioc_head, iocd_list) { - if (tmp == magic) { - unsigned int size = tmp->iocd_size; - - list_del(&tmp->iocd_list); - up_write(&llioc.ioc_sem); - - OBD_FREE(tmp, size); - return; - } - } - up_write(&llioc.ioc_sem); - - CWARN("didn't find iocontrol register block with magic: %p\n", magic); -} - -EXPORT_SYMBOL(ll_iocontrol_register); -EXPORT_SYMBOL(ll_iocontrol_unregister); - -static enum llioc_iter -ll_iocontrol_call(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, int *rcp) -{ - enum llioc_iter ret = LLIOC_CONT; - struct llioc_data *data; - int rc = -EINVAL, i; - - down_read(&llioc.ioc_sem); - list_for_each_entry(data, &llioc.ioc_head, iocd_list) { - for (i = 0; i < data->iocd_count; i++) { - if (cmd != data->iocd_cmd[i]) - continue; - - ret = data->iocd_cb(inode, file, cmd, arg, data, &rc); - break; - } - - if (ret == LLIOC_STOP) - break; - } - up_read(&llioc.ioc_sem); - - if (rcp) - *rcp = rc; - return ret; -} - int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf) { struct ll_inode_info *lli = ll_i2info(inode); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 4957a06..1e472ca 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1285,71 +1285,9 @@ dentry_may_statahead(struct inode *dir, struct dentry *dentry) return true; } -/* llite ioctl register support rountine */ -enum llioc_iter { - LLIOC_CONT = 0, - LLIOC_STOP -}; - -#define LLIOC_MAX_CMD 256 - -/* - * Rules to write a callback function: - * - * Parameters: - * @magic: Dynamic ioctl call routine will feed this vaule with the pointer - * returned to ll_iocontrol_register. Callback functions should use this - * data to check the potential collasion of ioctl cmd. If collasion is - * found, callback function should return LLIOC_CONT. - * @rcp: The result of ioctl command. - * - * Return values: - * If @magic matches the pointer returned by ll_iocontrol_data, the - * callback should return LLIOC_STOP; return LLIOC_STOP otherwise. - */ -typedef enum llioc_iter (*llioc_callback_t)(struct inode *inode, - struct file *file, unsigned int cmd, unsigned long arg, - void *magic, int *rcp); - -/* export functions */ -/* Register ioctl block dynamatically for a regular file. - * - * @cmd: the array of ioctl command set - * @count: number of commands in the @cmd - * @cb: callback function, it will be called if an ioctl command is found to - * belong to the command list @cmd. - * - * Return vaule: - * A magic pointer will be returned if success; - * otherwise, NULL will be returned. - * */ -void *ll_iocontrol_register(llioc_callback_t cb, int count, unsigned int *cmd); -void ll_iocontrol_unregister(void *magic); - int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, enum cl_fsync_mode mode, int ignore_layout); -/** direct write pages */ -struct ll_dio_pages { - /** page array to be written. we don't support - * partial pages except the last one. */ - struct page **ldp_pages; - /* offset of each page */ - loff_t *ldp_offsets; - /** if ldp_offsets is NULL, it means a sequential - * pages to be written, then this is the file offset - * of the * first page. */ - loff_t ldp_start_offset; - /** how many bytes are to be written. */ - size_t ldp_size; - /** # of pages in the array. */ - int ldp_nr; -}; - -extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, - int rw, struct inode *inode, - struct ll_dio_pages *pv); - static inline int ll_file_nolock(const struct file *file) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 79a252a..1d44187 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -179,125 +179,107 @@ static int ll_releasepage(struct page *vmpage, RELEASEPAGE_ARG_TYPE gfp_mask) #define MAX_DIRECTIO_SIZE 2*1024*1024*1024UL -ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, - int rw, struct inode *inode, - struct ll_dio_pages *pv) +static ssize_t +ll_direct_IO_seg(const struct lu_env *env, struct cl_io *io, int rw, + struct inode *inode, size_t size, loff_t file_offset, + struct page **pages, int page_count) { - struct cl_page *clp; - struct cl_2queue *queue; - struct cl_object *obj = io->ci_obj; + struct cl_page *clp; + struct cl_2queue *queue; + struct cl_object *obj = io->ci_obj; int i; ssize_t rc = 0; - loff_t file_offset = pv->ldp_start_offset; - size_t size = pv->ldp_size; - int page_count = pv->ldp_nr; - struct page **pages = pv->ldp_pages; - size_t page_size = cl_page_size(obj); + size_t page_size = cl_page_size(obj); + size_t orig_size = size; bool do_io; - int io_pages = 0; - ENTRY; + int io_pages = 0; - queue = &io->ci_queue; - cl_2queue_init(queue); - for (i = 0; i < page_count; i++) { - if (pv->ldp_offsets) - file_offset = pv->ldp_offsets[i]; - - LASSERT(!(file_offset & (page_size - 1))); - clp = cl_page_find(env, obj, cl_index(obj, file_offset), - pv->ldp_pages[i], CPT_TRANSIENT); - if (IS_ERR(clp)) { - rc = PTR_ERR(clp); - break; - } + ENTRY; + queue = &io->ci_queue; + cl_2queue_init(queue); + for (i = 0; i < page_count; i++) { + LASSERT(!(file_offset & (page_size - 1))); + clp = cl_page_find(env, obj, cl_index(obj, file_offset), + pages[i], CPT_TRANSIENT); + if (IS_ERR(clp)) { + rc = PTR_ERR(clp); + break; + } - rc = cl_page_own(env, io, clp); - if (rc) { - LASSERT(clp->cp_state == CPS_FREEING); - cl_page_put(env, clp); - break; - } + rc = cl_page_own(env, io, clp); + if (rc) { + LASSERT(clp->cp_state == CPS_FREEING); + cl_page_put(env, clp); + break; + } - do_io = true; + do_io = true; - /* check the page type: if the page is a host page, then do - * write directly */ - if (clp->cp_type == CPT_CACHEABLE) { + /* check the page type: if the page is a host page, then do + * write directly + */ + if (clp->cp_type == CPT_CACHEABLE) { struct page *vmpage = cl_page_vmpage(clp); struct page *src_page; struct page *dst_page; - void *src; - void *dst; - - src_page = (rw == WRITE) ? pages[i] : vmpage; - dst_page = (rw == WRITE) ? vmpage : pages[i]; - - src = ll_kmap_atomic(src_page, KM_USER0); - dst = ll_kmap_atomic(dst_page, KM_USER1); - memcpy(dst, src, min(page_size, size)); - ll_kunmap_atomic(dst, KM_USER1); - ll_kunmap_atomic(src, KM_USER0); - - /* make sure page will be added to the transfer by - * cl_io_submit()->...->vvp_page_prep_write(). */ - if (rw == WRITE) - set_page_dirty(vmpage); - - if (rw == READ) { - /* do not issue the page for read, since it - * may reread a ra page which has NOT uptodate - * bit set. */ - cl_page_disown(env, io, clp); - do_io = false; - } - } + void *src; + void *dst; + + src_page = (rw == WRITE) ? pages[i] : vmpage; + dst_page = (rw == WRITE) ? vmpage : pages[i]; + + src = ll_kmap_atomic(src_page, KM_USER0); + dst = ll_kmap_atomic(dst_page, KM_USER1); + memcpy(dst, src, min(page_size, size)); + ll_kunmap_atomic(dst, KM_USER1); + ll_kunmap_atomic(src, KM_USER0); + + /* make sure page will be added to the transfer by + * cl_io_submit()->...->vvp_page_prep_write(). + */ + if (rw == WRITE) + set_page_dirty(vmpage); + + if (rw == READ) { + /* do not issue the page for read, since it + * may reread a ra page which has NOT uptodate + * bit set. + */ + cl_page_disown(env, io, clp); + do_io = false; + } + } - if (likely(do_io)) { - cl_2queue_add(queue, clp); + if (likely(do_io)) { + cl_2queue_add(queue, clp); - /* - * Set page clip to tell transfer formation engine - * that page has to be sent even if it is beyond KMS. - */ - cl_page_clip(env, clp, 0, min(size, page_size)); + /* + * Set page clip to tell transfer formation engine + * that page has to be sent even if it is beyond KMS. + */ + cl_page_clip(env, clp, 0, min(size, page_size)); - ++io_pages; - } + ++io_pages; + } - /* drop the reference count for cl_page_find */ - cl_page_put(env, clp); - size -= page_size; - file_offset += page_size; - } + /* drop the reference count for cl_page_find */ + cl_page_put(env, clp); + size -= page_size; + file_offset += page_size; + } - if (rc == 0 && io_pages) { - rc = cl_io_submit_sync(env, io, - rw == READ ? CRT_READ : CRT_WRITE, + if (rc == 0 && io_pages) { + rc = cl_io_submit_sync(env, io, + rw == READ ? CRT_READ : CRT_WRITE, queue, 0); - } - if (rc == 0) - rc = pv->ldp_size; - - cl_2queue_discard(env, io, queue); - cl_2queue_disown(env, io, queue); - cl_2queue_fini(env, queue); - RETURN(rc); -} -EXPORT_SYMBOL(ll_direct_rw_pages); + } + if (rc == 0) + rc = orig_size; -static ssize_t -ll_direct_IO_seg(const struct lu_env *env, struct cl_io *io, int rw, - struct inode *inode, size_t size, loff_t file_offset, - struct page **pages, int page_count) -{ - struct ll_dio_pages pvec = { .ldp_pages = pages, - .ldp_nr = page_count, - .ldp_size = size, - .ldp_offsets = NULL, - .ldp_start_offset = file_offset - }; - - return ll_direct_rw_pages(env, io, rw, inode, &pvec); + cl_2queue_discard(env, io, queue); + cl_2queue_disown(env, io, queue); + cl_2queue_fini(env, queue); + RETURN(rc); } /* ll_free_user_pages - tear down page struct array diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index d3c80b4..395e391 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5840,23 +5840,6 @@ test_66() { } run_test 66 "update inode blocks count on client ===============" -LLOOP= -LLITELOOPLOAD= -cleanup_68() { - [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - trap 0 - if [ ! -z "$LLOOP" ]; then - if swapon -s | grep -q $LLOOP; then - swapoff $LLOOP || error "swapoff failed" - fi - - $LCTL blockdev_detach $LLOOP || error "detach failed" - rm -f $LLOOP - unset LLOOP - fi - rm -f $DIR/f68* -} - meminfo() { awk '($1 == "'$1':") { print $2 }' /proc/meminfo }