From: Seraphime Kirkovski <kirkseraph@gmail.com>
To: clm@fb.com
Cc: jbacik@fb.com, dsterba@suse.com, linux-btrfs@vger.kernel.org,
Seraphime Kirkovski <kirkseraph@gmail.com>
Subject: [PATCH] Btrfs: Coding style fixes
Date: Mon, 12 Dec 2016 15:10:05 +0100 [thread overview]
Message-ID: <20161212141005.24071-1-kirkseraph@gmail.com> (raw)
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 <kirkseraph@gmail.com>
---
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)
--
2.10.2
next reply other threads:[~2016-12-12 14:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-12 14:10 Seraphime Kirkovski [this message]
2016-12-12 16:11 ` [PATCH] Btrfs: Coding style fixes David Sterba
2016-12-12 18:28 ` Seraphime Kirkovski
2016-12-13 14:37 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161212141005.24071-1-kirkseraph@gmail.com \
--to=kirkseraph@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).