From patchwork Tue Jul 28 20:27:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Marshall X-Patchwork-Id: 6888391 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AA3AF9F380 for ; Tue, 28 Jul 2015 20:27:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2791C2049E for ; Tue, 28 Jul 2015 20:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A2523203F1 for ; Tue, 28 Jul 2015 20:27:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752564AbbG1U1Z (ORCPT ); Tue, 28 Jul 2015 16:27:25 -0400 Received: from mail-qk0-f179.google.com ([209.85.220.179]:33176 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752383AbbG1U1Y (ORCPT ); Tue, 28 Jul 2015 16:27:24 -0400 Received: by qkdg63 with SMTP id g63so2547055qkd.0 for ; Tue, 28 Jul 2015 13:27:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cUP+2eyYD5Vwu9/OEFWx/ql1r+2I0mfmrrcGvJNyUTM=; b=SdNRvtvQiDZFRdBJwyO6OQ4NsMem2++8DIG5EGzQaUOBc4zPhRQozyiueBHnge4aJB JUAN/EfJyqcZAP8fn7WhdBmtFALKApHaEbZ3gaRNOYnfiIss8MJLXxEg+s2HX3x0CwZl BAW4/WHXu6z63n7JD4GCClZhzHfEFq1lF2N+Vxuqvv0qDzTMc9RXzFYP4wlt/PSdmDY8 smwKeaPk2wRNJOag+WHxK84qWfa37sG3TDeN4eJyRztWjDzyUhNKfAP1ceYP/LplO/lv uuPZAx8XzgK2u71RT36O8s4Mwsf4t+YYN/80MSCNTLJTx/r9L6eM7rhu9gGEgGAsCu07 S4aQ== X-Gm-Message-State: ALoCoQl72gbHsI6KZokXp1sEYd249T+vTFzQb22W/0c7BBNam0jgk/bINviiJvkqUwbCmuG5x7rP X-Received: by 10.55.40.65 with SMTP id o62mr50785079qkh.41.1438115243605; Tue, 28 Jul 2015 13:27:23 -0700 (PDT) Received: from logtruck.clemson.edu (logtruck.clemson.edu. [130.127.148.78]) by smtp.gmail.com with ESMTPSA id d9sm11941035qga.6.2015.07.28.13.27.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jul 2015 13:27:22 -0700 (PDT) From: hubcap X-Google-Original-From: hubcap To: viro@zeniv.linux.org.uk Cc: Mike Marshall , linux-fsdevel@vger.kernel.org Subject: [PATCH V3 9/7] Orangefs: sooth most sparse complaints Date: Tue, 28 Jul 2015 16:27:08 -0400 Message-Id: <1438115228-24230-1-git-send-email-hubcap@logtruck.clemson.edu> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1437143897-9069-1-git-send-email-root@logtruck.clemson.edu> References: <1437143897-9069-1-git-send-email-root@logtruck.clemson.edu> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mike Marshall Signed-off-by: Mike Marshall --- fs/orangefs/devpvfs2-req.c | 2 +- fs/orangefs/file.c | 13 ++++++++----- fs/orangefs/inode.c | 2 +- fs/orangefs/protocol.h | 12 +----------- fs/orangefs/pvfs2-bufmap.c | 10 +++++++--- fs/orangefs/pvfs2-debugfs.c | 2 +- fs/orangefs/pvfs2-kernel.h | 2 +- fs/orangefs/pvfs2-mod.c | 1 - fs/orangefs/pvfs2-sysfs.c | 4 ++-- fs/orangefs/super.c | 8 ++++---- fs/orangefs/waitqueue.c | 7 +++++++ 11 files changed, 33 insertions(+), 30 deletions(-) diff --git a/fs/orangefs/devpvfs2-req.c b/fs/orangefs/devpvfs2-req.c index 7e60fd0..13878ca 100644 --- a/fs/orangefs/devpvfs2-req.c +++ b/fs/orangefs/devpvfs2-req.c @@ -857,7 +857,7 @@ static unsigned long translate_dev_map26(unsigned long args, long *error) */ struct PVFS_dev_map_desc __user *p = compat_alloc_user_space(sizeof(*p)); - u32 addr; + compat_uptr_t addr; *error = 0; /* get the ptr from the 32 bit user-space */ diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 8e26f9f..4ba1b6c 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -799,7 +799,7 @@ out: /* * Perform a miscellaneous operation on a file. */ -long pvfs2_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +static long pvfs2_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret = -ENOTTY; __u64 val = 0; @@ -885,7 +885,7 @@ static int pvfs2_file_mmap(struct file *file, struct vm_area_struct *vma) * * \note Not called when each file is closed. */ -int pvfs2_file_release(struct inode *inode, struct file *file) +static int pvfs2_file_release(struct inode *inode, struct file *file) { gossip_debug(GOSSIP_FILE_DEBUG, "pvfs2_file_release: called on %s\n", @@ -909,7 +909,10 @@ int pvfs2_file_release(struct inode *inode, struct file *file) /* * Push all data for a specific file onto permanent storage. */ -int pvfs2_fsync(struct file *file, loff_t start, loff_t end, int datasync) +static int pvfs2_fsync(struct file *file, + loff_t start, + loff_t end, + int datasync) { int ret = -EINVAL; struct pvfs2_inode_s *pvfs2_inode = @@ -947,7 +950,7 @@ int pvfs2_fsync(struct file *file, loff_t start, loff_t end, int datasync) * Future upgrade could support SEEK_DATA and SEEK_HOLE but would * require much changes to the FS */ -loff_t pvfs2_file_llseek(struct file *file, loff_t offset, int origin) +static loff_t pvfs2_file_llseek(struct file *file, loff_t offset, int origin) { int ret = -EINVAL; struct inode *inode = file->f_path.dentry->d_inode; @@ -989,7 +992,7 @@ loff_t pvfs2_file_llseek(struct file *file, loff_t offset, int origin) * Support local locks (locks that only this kernel knows about) * if Orangefs was mounted -o local_lock. */ -int pvfs2_lock(struct file *filp, int cmd, struct file_lock *fl) +static int pvfs2_lock(struct file *filp, int cmd, struct file_lock *fl) { int rc = -ENOLCK; diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index feda00f..9ff6b29 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -33,7 +33,7 @@ static int read_one_page(struct page *page) loff_t blockptr_offset = (((loff_t) page->index) << blockbits); bytes_read = pvfs2_inode_read(inode, - page_data, + (char __user *) page_data, blocksize, &blockptr_offset, inode->i_size); diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h index 8e0c8a6..ca7cef9 100644 --- a/fs/orangefs/protocol.h +++ b/fs/orangefs/protocol.h @@ -341,7 +341,7 @@ __s32 PINT_non_errno_mapping[] = { \ extern __s32 PINT_errno_mapping[]; \ extern __s32 PINT_non_errno_mapping[]; \ extern const char *PINT_non_errno_strerror_mapping[]; \ -__s32 PVFS_get_errno_mapping(__s32 error) \ +static __s32 PVFS_get_errno_mapping(__s32 error) \ { \ __s32 ret = error, mask = 0; \ __s32 positive = ((error > -1) ? 1 : 0); \ @@ -364,16 +364,6 @@ __s32 PVFS_get_errno_mapping(__s32 error) \ } \ return ret; \ } \ -__s32 PVFS_errno_to_error(int err) \ -{ \ - __s32 e = 0; \ - \ - for (; e < PVFS_ERRNO_MAX; ++e) \ - if (PINT_errno_mapping[e] == err) \ - return e | PVFS_ERROR_BIT; \ - \ - return err; \ -} \ DECLARE_ERRNO_MAPPING() /* permission bits */ diff --git a/fs/orangefs/pvfs2-bufmap.c b/fs/orangefs/pvfs2-bufmap.c index aa14c37..a439163 100644 --- a/fs/orangefs/pvfs2-bufmap.c +++ b/fs/orangefs/pvfs2-bufmap.c @@ -9,7 +9,7 @@ DECLARE_WAIT_QUEUE_HEAD(pvfs2_bufmap_init_waitq); -struct pvfs2_bufmap { +static struct pvfs2_bufmap { atomic_t refcnt; int desc_size; @@ -663,6 +663,7 @@ int pvfs_bufmap_copy_iovec_from_kernel(struct pvfs2_bufmap *bufmap, int to_page_index = 0; void *to_kaddr = NULL; void *from_kaddr = NULL; + struct kvec *iv = NULL; struct iovec *copied_iovec = NULL; struct pvfs_bufmap_desc *to; unsigned int seg; @@ -708,9 +709,10 @@ int pvfs_bufmap_copy_iovec_from_kernel(struct pvfs2_bufmap *bufmap, * buffer into the mapped buffer one page at a time though */ while (amt_copied < size) { - struct iovec *iv = &copied_iovec[seg]; int inc_to_page_index; + iv = (struct kvec *) &copied_iovec[seg]; + if (iv->iov_len < (PAGE_SIZE - to_page_offset)) { cur_copy_size = PVFS_util_min(iv->iov_len, size - amt_copied); @@ -885,6 +887,7 @@ int pvfs_bufmap_copy_to_kernel_iovec(struct pvfs2_bufmap *bufmap, int from_page_index = 0; void *from_kaddr = NULL; void *to_kaddr = NULL; + struct kvec *iv; struct iovec *copied_iovec = NULL; struct pvfs_bufmap_desc *from; unsigned int seg; @@ -930,9 +933,10 @@ int pvfs_bufmap_copy_to_kernel_iovec(struct pvfs2_bufmap *bufmap, * but make sure that we do so one page at a time. */ while (amt_copied < size) { - struct iovec *iv = &copied_iovec[seg]; int inc_from_page_index; + iv = (struct kvec *) &copied_iovec[seg]; + if (iv->iov_len < (PAGE_SIZE - from_page_offset)) { cur_copy_size = PVFS_util_min(iv->iov_len, size - amt_copied); diff --git a/fs/orangefs/pvfs2-debugfs.c b/fs/orangefs/pvfs2-debugfs.c index 8d118da..ba5bfef 100644 --- a/fs/orangefs/pvfs2-debugfs.c +++ b/fs/orangefs/pvfs2-debugfs.c @@ -70,7 +70,7 @@ static const struct seq_operations help_debug_ops = { * Used to protect data in ORANGEFS_KMOD_DEBUG_FILE and * ORANGEFS_KMOD_DEBUG_FILE. */ -DEFINE_MUTEX(orangefs_debug_lock); +static DEFINE_MUTEX(orangefs_debug_lock); int orangefs_debug_open(struct inode *, struct file *); diff --git a/fs/orangefs/pvfs2-kernel.h b/fs/orangefs/pvfs2-kernel.h index 6c787c4..be30111 100644 --- a/fs/orangefs/pvfs2-kernel.h +++ b/fs/orangefs/pvfs2-kernel.h @@ -608,7 +608,7 @@ struct inode *pvfs2_iget(struct super_block *sb, struct pvfs2_object_kref *ref); ssize_t pvfs2_inode_read(struct inode *inode, - char *buf, + char __user *buf, size_t count, loff_t *offset, loff_t readahead_size); diff --git a/fs/orangefs/pvfs2-mod.c b/fs/orangefs/pvfs2-mod.c index 9cbc992..69289c5 100644 --- a/fs/orangefs/pvfs2-mod.c +++ b/fs/orangefs/pvfs2-mod.c @@ -47,7 +47,6 @@ struct client_debug_mask client_debug_mask = { NULL, 0, 0 }; unsigned int kernel_mask_set_mod_init; /* implicitly false */ int op_timeout_secs = PVFS2_DEFAULT_OP_TIMEOUT_SECS; int slot_timeout_secs = PVFS2_DEFAULT_SLOT_TIMEOUT_SECS; -__u32 DEBUG_LINE = 50; MODULE_LICENSE("GPL"); MODULE_AUTHOR("PVFS2 Development Team"); diff --git a/fs/orangefs/pvfs2-sysfs.c b/fs/orangefs/pvfs2-sysfs.c index 6d0e18b..ea635b5 100644 --- a/fs/orangefs/pvfs2-sysfs.c +++ b/fs/orangefs/pvfs2-sysfs.c @@ -750,7 +750,7 @@ out: /* * obtain attribute values from userspace with a service operation. */ -int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) +static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) { struct pvfs2_kernel_op_s *new_op = NULL; int rc = 0; @@ -1023,7 +1023,7 @@ static ssize_t * We want to return 1 if we think everything went OK, and * EINVAL if not. */ -int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) +static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) { struct pvfs2_kernel_op_s *new_op = NULL; int val = 0; diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index a854390..90c7a1c 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -269,7 +269,7 @@ static void pvfs2_dirty_inode(struct inode *inode, int flags) SetAtimeFlag(pvfs2_inode); } -struct super_operations pvfs2_s_ops = { +static const struct super_operations pvfs2_s_ops = { .alloc_inode = pvfs2_alloc_inode, .destroy_inode = pvfs2_destroy_inode, .dirty_inode = pvfs2_dirty_inode, @@ -279,7 +279,7 @@ struct super_operations pvfs2_s_ops = { .show_options = generic_show_options, }; -struct dentry *pvfs2_fh_to_dentry(struct super_block *sb, +static struct dentry *pvfs2_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) @@ -299,7 +299,7 @@ struct dentry *pvfs2_fh_to_dentry(struct super_block *sb, return d_obtain_alias(pvfs2_iget(sb, &refn)); } -int pvfs2_encode_fh(struct inode *inode, +static int pvfs2_encode_fh(struct inode *inode, __u32 *fh, int *max_len, struct inode *parent) @@ -347,7 +347,7 @@ static struct export_operations pvfs2_export_ops = { .fh_to_dentry = pvfs2_fh_to_dentry, }; -int pvfs2_fill_sb(struct super_block *sb, void *data, int silent) +static int pvfs2_fill_sb(struct super_block *sb, void *data, int silent) { int ret = -EINVAL; struct inode *root = NULL; diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c index 9b32286..ad79e53 100644 --- a/fs/orangefs/waitqueue.c +++ b/fs/orangefs/waitqueue.c @@ -314,6 +314,13 @@ void pvfs2_clean_up_interrupted_operation(struct pvfs2_kernel_op_s *op) spin_unlock(&op->lock); gossip_err("interrupted operation is in a weird state 0x%x\n", op->op_state); + } else { + /* + * It is not intended for execution to flow here, + * but having this unlock here makes sparse happy. + */ + gossip_err("%s: can't get here.\n", __func__); + spin_unlock(&op->lock); } }