From patchwork Mon Dec 12 14:10:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraphime Kirkovski X-Patchwork-Id: 9470761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 386D560573 for ; Mon, 12 Dec 2016 14:13:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 227612849F for ; Mon, 12 Dec 2016 14:13:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15733284A1; Mon, 12 Dec 2016 14:13:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9714B2849F for ; Mon, 12 Dec 2016 14:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753029AbcLLONp (ORCPT ); Mon, 12 Dec 2016 09:13:45 -0500 Received: from mail-wj0-f194.google.com ([209.85.210.194]:32813 "EHLO mail-wj0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753025AbcLLONo (ORCPT ); Mon, 12 Dec 2016 09:13:44 -0500 Received: by mail-wj0-f194.google.com with SMTP id kp2so11757861wjc.0 for ; Mon, 12 Dec 2016 06:13:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=qvBd19kVYu1Ak4fiXhMDlo4bqcvHn6hR7940tcz2i3Y=; b=OyDZknlRrquF06NCAHGg7etjnpK7ReELBNi9Snaz0rIlsx+aYvevAstmTyl7fngrUP Lo/A3dsDo64ll781+ToCuM1S6COYkaaJWKnKsey+SQI961Ka40/gl5Y2OBMDdc5rMTfl j6hysHk1T3SDyJ11PAZEbZB81PogRUEZlKPCh/EHKtR/uMKrBABrlfJi0xsuzRRheYtG ZdQ2+JHhbi8NLkVo5c5DUXD1OVf+DcKXtEPBEFExOKRLGRPmeFUG+g3Vtv8cEg2fnLW+ 9sta8r89rqF7hFb5h38TJ78kv0y8BkBqJO1DH+mV9AJkykiaK2HU5Chr06lKqWeD17/l zavw== 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; bh=qvBd19kVYu1Ak4fiXhMDlo4bqcvHn6hR7940tcz2i3Y=; b=hdm5TArBYLw+zX5et7kXbdMl0rq52zUfVGl5qpnIlVH7bcJDShOY0wUbPftax4H4PB NA/Vk+Bt27o9kSki/WI6S1v3b+JOED2V4oN+AGcP07L/bP1Jvt9Wf4zrO7ehQlINvUHE n9IUkSThDe32ZPuZxtysACuA8V2z0MiwlKEyH48sF9lGKMO23hWSCcObP60ys3YGGISH nE31z5zMxaWXbz5SqPhB2SPBg7IaaEVmrUJrdvP1uzf7j5Wfy+cqCWxoujhz4IDvE0ei dMipz8RxsRSgjB8ixIBLTIbVVO5+3WaX1pqVi+Kg43bxdUTLGQapVCzHai9jWUohIutJ Z0Gw== X-Gm-Message-State: AKaTC00NbUDZLN/D2ngheGrMXrkYkbvjBIS4GlrNkNPTUROzjXa7M68k1RS/njxKL92NXw== X-Received: by 10.194.38.37 with SMTP id d5mr36436472wjk.45.1481552022847; Mon, 12 Dec 2016 06:13:42 -0800 (PST) Received: from localhost (cha92-19-78-239-153-115.fbx.proxad.net. [78.239.153.115]) by smtp.gmail.com with ESMTPSA id yj10sm57483659wjb.3.2016.12.12.06.13.40 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 12 Dec 2016 06:13:42 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Mon, 12 Dec 2016 15:13:40 +0100 From: Seraphime Kirkovski To: clm@fb.com Cc: jbacik@fb.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, Seraphime Kirkovski Subject: [PATCH] Btrfs: Coding style fixes Date: Mon, 12 Dec 2016 15:10:05 +0100 Message-Id: <20161212141005.24071-1-kirkseraph@gmail.com> X-Mailer: git-send-email 2.10.2 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Per Documentation/CodingStyle remove brackets on single expression if statements, add missing spaces after `,` and around `=`, remove unnecessary line continuations, add missing blank lines after declarations and fix mixed spaces and tabs. Signed-off-by: Seraphime Kirkovski --- fs/btrfs/ioctl.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7acbd2c..fc6dc14 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -200,9 +200,9 @@ static int btrfs_ioctl_getflags(struct file *file, void __user *arg) static int check_flags(unsigned int flags) { - if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \ - FS_NOATIME_FL | FS_NODUMP_FL | \ - FS_SYNC_FL | FS_DIRSYNC_FL | \ + if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | + FS_NOATIME_FL | FS_NODUMP_FL | + FS_SYNC_FL | FS_DIRSYNC_FL | FS_NOCOMP_FL | FS_COMPR_FL | FS_NOCOW_FL)) return -EOPNOTSUPP; @@ -301,7 +301,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) if (S_ISREG(mode)) { if (inode->i_size == 0) ip->flags &= ~(BTRFS_INODE_NODATACOW - | BTRFS_INODE_NODATASUM); + | BTRFS_INODE_NODATASUM); } else { ip->flags &= ~BTRFS_INODE_NODATACOW; } @@ -394,7 +394,7 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) q = bdev_get_queue(device->bdev); if (blk_queue_discard(q)) { num_devices++; - minlen = min((u64)q->limits.discard_granularity, + minlen = min_t(u64, q->limits.discard_granularity, minlen); } } @@ -1464,9 +1464,8 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, atomic_dec(&root->fs_info->async_submit_draining); } - if (range->compress_type == BTRFS_COMPRESS_LZO) { + if (range->compress_type == BTRFS_COMPRESS_LZO) btrfs_set_fs_incompat(root->fs_info, COMPRESS_LZO); - } ret = defrag_count; @@ -1659,6 +1658,7 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file, } else { struct fd src = fdget(fd); struct inode *src_inode; + if (!src.file) { ret = -EINVAL; goto out_drop_write; @@ -2236,7 +2236,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, struct btrfs_path *path; if (dirid == BTRFS_FIRST_FREE_OBJECTID) { - name[0]='\0'; + name[0] = '\0'; return 0; } @@ -2679,7 +2679,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) ret = btrfs_init_new_device(root, vol_args->name); if (!ret) - btrfs_info(root->fs_info, "disk added %s",vol_args->name); + btrfs_info(root->fs_info, "disk added %s", vol_args->name); kfree(vol_args); out: @@ -2773,7 +2773,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) mutex_unlock(&root->fs_info->volume_mutex); if (!ret) - btrfs_info(root->fs_info, "disk deleted %s",vol_args->name); + btrfs_info(root->fs_info, "disk deleted %s", vol_args->name); kfree(vol_args); out: atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); @@ -2927,6 +2927,7 @@ static int lock_extent_range(struct inode *inode, u64 off, u64 len, */ while (1) { struct btrfs_ordered_extent *ordered; + lock_extent(&BTRFS_I(inode)->io_tree, off, off + len - 1); ordered = btrfs_lookup_first_ordered_extent(inode, off + len - 1); @@ -3895,11 +3896,10 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode)) return -EISDIR; - if (!same_inode) { + if (!same_inode) btrfs_double_inode_lock(src, inode); - } else { + else inode_lock(src); - } /* determine range to clone */ ret = -EINVAL; @@ -4972,11 +4972,10 @@ static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg) } /* FIXME: check if the IDs really exist */ - if (sa->create) { + if (sa->create) ret = btrfs_create_qgroup(trans, root->fs_info, sa->qgroupid); - } else { + else ret = btrfs_remove_qgroup(trans, root->fs_info, sa->qgroupid); - } err = btrfs_end_transaction(trans, root); if (err && !ret)