[PATCH] btrfs: file.c: file cleanup

2016-12-16 Thread Philippe Loctaux
cleaned up the file with checkpatch

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/file.c | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 3a14c87..d131b8d 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -464,6 +464,7 @@ static noinline int btrfs_copy_from_user(loff_t pos, size_t 
write_bytes,
 static void btrfs_drop_pages(struct page **pages, size_t num_pages)
 {
size_t i;
+
for (i = 0; i < num_pages; i++) {
/* page checked is some magic around finding pages that
 * have been modified without going through btrfs_set_page_dirty
@@ -509,6 +510,7 @@ int btrfs_dirty_pages(struct btrfs_root *root, struct inode 
*inode,
 
for (i = 0; i < num_pages; i++) {
struct page *p = pages[i];
+
SetPageUptodate(p);
ClearPageChecked(p);
set_page_dirty(p);
@@ -1421,6 +1423,7 @@ lock_and_cleanup_extent_if_need(struct inode *inode, 
struct page **pages,
 
if (start_pos < inode->i_size) {
struct btrfs_ordered_extent *ordered;
+
lock_extent_bits(&BTRFS_I(inode)->io_tree,
 start_pos, last_pos, cached_state);
ordered = btrfs_lookup_ordered_range(inode, start_pos,
@@ -1481,9 +1484,8 @@ static noinline int check_can_nocow(struct inode *inode, 
loff_t pos,
lock_extent(&BTRFS_I(inode)->io_tree, lockstart, lockend);
ordered = btrfs_lookup_ordered_range(inode, lockstart,
 lockend - lockstart + 1);
-   if (!ordered) {
+   if (!ordered)
break;
-   }
unlock_extent(&BTRFS_I(inode)->io_tree, lockstart, lockend);
btrfs_start_ordered_extent(inode, ordered, 1);
btrfs_put_ordered_extent(ordered);
@@ -1495,7 +1497,7 @@ static noinline int check_can_nocow(struct inode *inode, 
loff_t pos,
ret = 0;
btrfs_end_write_no_snapshoting(root);
} else {
-   *write_bytes = min_t(size_t, *write_bytes ,
+   *write_bytes = min_t(size_t, *write_bytes,
 num_bytes - pos + lockstart);
}
 
@@ -1727,8 +1729,8 @@ static noinline ssize_t __btrfs_buffered_write(struct 
file *file,
btrfs_delalloc_release_metadata(inode, release_bytes);
} else {
btrfs_delalloc_release_space(inode,
-   round_down(pos, 
root->sectorsize),
-   release_bytes);
+   round_down(pos, root->sectorsize),
+   release_bytes);
}
}
 
@@ -1904,8 +1906,8 @@ int btrfs_release_file(struct inode *inode, struct file 
*filp)
 * application were using truncate to replace a file in place.
 */
if (test_and_clear_bit(BTRFS_INODE_ORDERED_DATA_CLOSE,
-  &BTRFS_I(inode)->runtime_flags))
-   filemap_flush(inode->i_mapping);
+   &BTRFS_I(inode)->runtime_flags))
+   filemap_flush(inode->i_mapping);
return 0;
 }
 
@@ -1943,8 +1945,9 @@ int btrfs_sync_file(struct file *file, loff_t start, 
loff_t end, int datasync)
u64 len;
 
/*
-* The range length can be represented by u64, we have to do the 
typecasts
-* to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync()
+* The range length can be represented by u64, we have to do the
+* typecasts to avoid signed overflow if it's [0, LLONG_MAX]
+* eg. from fsync()
 */
len = (u64)end - (u64)start + 1;
trace_btrfs_sync_file(file, datasync);
@@ -2409,7 +2412,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t 
offset, loff_t len)
/* Check the aligned pages after the first unaligned page,
 * if offset != orig_start, which means the first unaligned page
 * including several following pages are already in holes,
-* the extra check can be skipped */
+* the extra check can be skipped
+*/
if (offset == orig_start) {
/* after truncate page, check hole again */
len = offset + len - lockstart;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Question]: Contributing to btrfs

2016-02-20 Thread Philippe Loctaux
Hello!

I'm new to the mailing list and btrfs in general (I've been using it for
two weeks on my new arch install) and I'd like to contribute to the code :)

I know how to work w/ git and patches, I just wanted to know which
git repo I need to clone to start contributing :)

I went on the kernel wiki and I saw some git repos, that confused me,
that's why I'm asking here :)

I'd like to apologize for my english, I'm not english native (french).

I'll wait for your replies, thanks and have a nice day!

--
Phil
p...@philippeloctaux.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Question]: Contributing to btrfs

2016-02-20 Thread Philippe Loctaux
Hello!
 
I'm new to the mailing list and btrfs in general (I've been using it for
two weeks on my new arch install) and I'd like to contribute to the code :)

I know how to work w/ git and patches, I just wanted to know which
git repo I need to clone to start contributing :)

I went on the kernel wiki and I saw some git repos, that confused me,
that's why I'm asking here :)
 
I'd like to apologize for my english, I'm not english native (french).
 
I'll wait for your replies, thanks and have a nice day!
 
--
Phil
p...@philippeloctaux.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: async: fixed a brace coding style issue

2016-02-21 Thread Philippe Loctaux
Fixed a coding style issue.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/async-thread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index 5fb60ea..7914dd2 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -227,9 +227,9 @@ static inline void thresh_exec_hook(struct 
__btrfs_workqueue *wq)
 out:
spin_unlock(&wq->thres_lock);
 
-   if (need_change) {
+   if (need_change)
workqueue_set_max_active(wq->normal_wq, wq->current_active);
-   }
+
 }
 
 static void run_ordered_work(struct __btrfs_workqueue *wq)
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: async: fixed a brace coding style issue

2016-02-21 Thread Philippe Loctaux
On Sun, Feb 21, 2016 at 03:08:02PM -0600, Simon Quigley wrote:
> I thought I proposed this exact patch...hmm...

Yes you're right, I wasn't subscribed at the mailing list yet.
The maintainer will probably see it's a duplicate and he'll just ignore
that patch.

--
Philippe Loctaux
p...@philippeloctaux.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: check-integrity: fixed a comment block coding style issue

2016-02-21 Thread Philippe Loctaux
Makes the comment block start with /* on a separate line, and end
with */ on a separate line as well.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/check-integrity.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 861d472..92436c7 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -226,8 +226,10 @@ struct btrfsic_block_data_ctx {
void *mem_to_free;
 };
 
-/* This structure is used to implement recursion without occupying
- * any stack space, refer to btrfsic_process_metablock() */
+/*
+ * This structure is used to implement recursion without occupying
+ * any stack space, refer to btrfsic_process_metablock()
+ */
 struct btrfsic_stack_frame {
u32 magic;
u32 nr;
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: check-integrity: fixed comment blocks coding style issues

2016-02-21 Thread Philippe Loctaux
Makes the comment blocks start with /* on separate lines, and end
with */ on separate lines as well.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/check-integrity.c | 30 ++
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 861d472..cb5dc04 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2070,8 +2070,11 @@ again:
goto continue_loop;
}
 
-   /* this is getting ugly for the
-* include_extent_data case... */
+   /*
+* this is getting ugly for the
+* include_extent_data case...
+*/
+
bytenr = 0; /* unknown */
} else {
processed_len = state->metablock_size;
@@ -2180,8 +2183,11 @@ static void btrfsic_bio_end_io(struct bio *bp)
struct btrfsic_block *block = (struct btrfsic_block *)bp->bi_private;
int iodone_w_error;
 
-   /* mutex is not held! This is not save if IO is not yet completed
-* on umount */
+   /*
+* mutex is not held! This is not save if IO is not yet completed
+* on umount
+*/
+
iodone_w_error = 0;
if (bp->bi_error)
iodone_w_error = 1;
@@ -2861,8 +2867,12 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
return submit_bh(rw, bh);
 
mutex_lock(&btrfsic_mutex);
-   /* since btrfsic_submit_bh() might also be called before
-* btrfsic_mount(), this might return NULL */
+
+   /*
+* since btrfsic_submit_bh() might also be called before
+* btrfsic_mount(), this might return NULL
+*/
+
dev_state = btrfsic_dev_state_lookup(bh->b_bdev);
 
/* Only called to write the superblock (incl. FLUSH/FUA) */
@@ -2924,8 +2934,12 @@ static void __btrfsic_submit_bio(int rw, struct bio *bio)
return;
 
mutex_lock(&btrfsic_mutex);
-   /* since btrfsic_submit_bio() is also called before
-* btrfsic_mount(), this might return NULL */
+
+   /*
+* since btrfsic_submit_bio() is also called before
+* btrfsic_mount(), this might return NULL
+*/
+
dev_state = btrfsic_dev_state_lookup(bio->bi_bdev);
if (NULL != dev_state &&
(rw & WRITE) && NULL != bio->bi_io_vec) {
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: compression: added line after variable declaration

2016-02-21 Thread Philippe Loctaux
Added line after variable declaration, fixing checkpatch warning.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/compression.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 3346cd8..5194b6f 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -522,6 +522,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
 
if (zero_offset) {
int zeros;
+
zeros = PAGE_CACHE_SIZE - zero_offset;
userpage = kmap_atomic(page);
memset(userpage + zero_offset, 0, zeros);
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: ctree: added lines after variable declarations

2016-02-21 Thread Philippe Loctaux
Added lines after variable declarations, fixing 22 checkpatch warnings.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/ctree.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 769e0ff..c9fd42d 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -45,6 +45,7 @@ static int tree_mod_log_free_eb(struct btrfs_fs_info *fs_info,
 struct btrfs_path *btrfs_alloc_path(void)
 {
struct btrfs_path *path;
+
path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS);
return path;
 }
@@ -56,6 +57,7 @@ struct btrfs_path *btrfs_alloc_path(void)
 noinline void btrfs_set_path_blocking(struct btrfs_path *p)
 {
int i;
+
for (i = 0; i < BTRFS_MAX_LEVEL; i++) {
if (!p->nodes[i] || !p->locks[i])
continue;
@@ -873,6 +875,7 @@ tree_mod_log_eb_move(struct btrfs_fs_info *fs_info, struct 
extent_buffer *dst,
 int dst_offset, int src_offset, int nr_items)
 {
int ret;
+
ret = tree_mod_log_insert_move(fs_info, dst, dst_offset, src_offset,
   nr_items, GFP_NOFS);
BUG_ON(ret < 0);
@@ -943,6 +946,7 @@ tree_mod_log_set_root_pointer(struct btrfs_root *root,
  int log_removal)
 {
int ret;
+
ret = tree_mod_log_insert_root(root->fs_info, root->node,
   new_root_node, GFP_NOFS, log_removal);
BUG_ON(ret < 0);
@@ -1734,6 +1738,7 @@ static inline unsigned int leaf_data_end(struct 
btrfs_root *root,
 struct extent_buffer *leaf)
 {
u32 nr = btrfs_header_nritems(leaf);
+
if (nr == 0)
return BTRFS_LEAF_DATA_SIZE(root);
return btrfs_item_offset_nr(leaf, nr - 1);
@@ -2011,6 +2016,7 @@ static noinline int balance_level(struct 
btrfs_trans_handle *trans,
right = NULL;
} else {
struct btrfs_disk_key right_key;
+
btrfs_node_key(right, &right_key, 0);
tree_mod_log_set_node_key(root->fs_info, parent,
  pslot + 1, 0);
@@ -2056,6 +2062,7 @@ static noinline int balance_level(struct 
btrfs_trans_handle *trans,
} else {
/* update the parent key to reflect our changes */
struct btrfs_disk_key mid_key;
+
btrfs_node_key(mid, &mid_key, 0);
tree_mod_log_set_node_key(root->fs_info, parent,
  pslot, 0);
@@ -2154,6 +2161,7 @@ static noinline int push_nodes_for_insert(struct 
btrfs_trans_handle *trans,
ret = wret;
if (wret == 0) {
struct btrfs_disk_key disk_key;
+
orig_slot += left_nr;
btrfs_node_key(mid, &disk_key, 0);
tree_mod_log_set_node_key(root->fs_info, parent,
@@ -2382,6 +2390,7 @@ static noinline void unlock_up(struct btrfs_path *path, 
int level,
}
if (!no_skips && path->keep_locks) {
u32 nritems;
+
t = path->nodes[i];
nritems = btrfs_header_nritems(t);
if (nritems < 1 || path->slots[i] >= nritems - 1) {
@@ -2529,6 +2538,7 @@ setup_nodes_for_search(struct btrfs_trans_handle *trans,
   int *write_lock_level)
 {
int ret;
+
if ((p->search_for_split || ins_len > 0) && btrfs_header_nritems(b) >=
BTRFS_NODEPTRS_PER_BLOCK(root) - 3) {
int sret;
@@ -2825,6 +2835,7 @@ cow_done:
 
if (level != 0) {
int dec = 0;
+
if (ret && slot > 0) {
dec = 1;
slot -= 1;
@@ -2993,6 +3004,7 @@ again:
 
if (level != 0) {
int dec = 0;
+
if (ret && slot > 0) {
dec = 1;
slot -= 1;
@@ -3139,6 +3151,7 @@ static void fixup_low_keys(struct btrfs_fs_info *fs_info,
 
for (i = level; i < BTRFS_MAX_LEVEL; i++) {
int tslot = path->slots[i];
+
if (!path->nodes[i])
break;
t = path->nodes[i];
@@ -3574,6 +3587,7 @@ noinline int btrfs_leaf_free_space(struct btrfs_root 
*root,
 {
int nritems = btrfs_header_nritems(leaf);
int ret;
+
ret = BTRFS_LEAF_DATA_SIZE(root) - leaf_space_used(leaf, 0, nritems);
if (ret < 0) {
btrfs_crit(root->fs_info,
@@ -3630,6 +3644,7 @@ static noinline int __push_leaf_right

[PATCH] Btrfs: delayed-inode: Fixed indentation coding style issue

2016-02-21 Thread Philippe Loctaux
Use tabs instead of spaces, fixing checkpatch error.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/delayed-inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index b57daa8..2e25aa54 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1802,7 +1802,7 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev)
set_nlink(inode, btrfs_stack_inode_nlink(inode_item));
inode_set_bytes(inode, btrfs_stack_inode_nbytes(inode_item));
BTRFS_I(inode)->generation = btrfs_stack_inode_generation(inode_item);
-BTRFS_I(inode)->last_trans = btrfs_stack_inode_transid(inode_item);
+   BTRFS_I(inode)->last_trans = btrfs_stack_inode_transid(inode_item);
 
inode->i_version = btrfs_stack_inode_sequence(inode_item);
inode->i_rdev = 0;
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: ctree: added lines after variable declarations

2016-02-21 Thread Philippe Loctaux
Is there no need of additional blank line here particulary
or in all lines that I changed?

--
Philippe Loctaux
p...@philippeloctaux.com

On Sun, Feb 21, 2016 at 03:53:04PM -0800, Joe Perches wrote:
> On Mon, 2016-02-22 at 00:46 +0100, Philippe Loctaux wrote:
> > Added lines after variable declarations, fixing 22 checkpatch warnings.
> []
> > diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> []
> > @@ -4592,6 +4610,7 @@ void btrfs_truncate_item(struct btrfs_root *root, 
> > struct btrfs_path *path,
> >       data_end, old_data_start + new_size - data_end);
> >     } else {
> >     struct btrfs_disk_key disk_key;
> > +
> >     u64 offset;
> 
> Overzealous here.
> No additional blank line required.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] Btrfs: dev-replace: Fixed indentation coding style issues

2016-02-21 Thread Philippe Loctaux
Use tabs instead of spaces, fixing 3 checkpatch errors.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/dev-replace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index cbb7dbf..b89a8c6 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -378,7 +378,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
btrfs_info_in_rcu(root->fs_info,
  "dev_replace from %s (devid %llu) to %s started",
  src_device->missing ? "" :
-   rcu_str_deref(src_device->name),
+ rcu_str_deref(src_device->name),
  src_device->devid,
  rcu_str_deref(tgt_device->name));
 
@@ -525,7 +525,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info 
*fs_info,
btrfs_err_in_rcu(root->fs_info,
  "btrfs_scrub_dev(%s, %llu, %s) failed %d",
  src_device->missing ? "" :
-   rcu_str_deref(src_device->name),
+ rcu_str_deref(src_device->name),
  src_device->devid,
  rcu_str_deref(tgt_device->name), scrub_ret);
btrfs_dev_replace_unlock(dev_replace);
@@ -542,7 +542,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info 
*fs_info,
btrfs_info_in_rcu(root->fs_info,
  "dev_replace from %s (devid %llu) to %s finished",
  src_device->missing ? "" :
-   rcu_str_deref(src_device->name),
+ rcu_str_deref(src_device->name),
  src_device->devid,
  rcu_str_deref(tgt_device->name));
tgt_device->is_tgtdev_for_dev_replace = 0;
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: ctree: added lines after variable declarations

2016-02-21 Thread Philippe Loctaux
Hi,
I'm really sorry, but I don't understand what you're trying to mean.
Could you simplify your sentence please (since I'm not english native)?
I'd really apreciate that, thanks :)

--
Philippe Loctaux
p...@philippeloctaux.com

On Sun, Feb 21, 2016 at 04:06:03PM -0800, Joe Perches wrote:
> On Mon, 2016-02-22 at 01:01 +0100, Philippe Loctaux wrote:
> > Is there no need of additional blank line here particulary
> > or in all lines that I changed?
> 
> Please don't top post and just here.
> > On Sun, Feb 21, 2016 at 03:53:04PM -0800, Joe Perches wrote:
> > > On Mon, 2016-02-22 at 00:46 +0100, Philippe Loctaux wrote:
> > > > Added lines after variable declarations, fixing 22 checkpatch warnings.
> > > []
> > > > diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> > > []
> > > > @@ -4592,6 +4610,7 @@ void btrfs_truncate_item(struct btrfs_root *root, 
> > > > struct btrfs_path *path,
> > > >       data_end, old_data_start + new_size - 
> > > > data_end);
> > > >     } else {
> > > >     struct btrfs_disk_key disk_key;
> > > > +
> > > >     u64 offset;
> > > 
> > > Overzealous here.
> > > No additional blank line required.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Btrfs: dev-replace: fixed comment blocks coding style issues

2016-02-21 Thread Philippe Loctaux
Makes the comment blocks start with /* on separate lines, and end
with */ on separate lines as well.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/dev-replace.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index b89a8c6..0d817aa 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -650,8 +650,10 @@ void btrfs_dev_replace_status(struct btrfs_fs_info 
*fs_info,
struct btrfs_device *srcdev;
 
btrfs_dev_replace_lock(dev_replace);
-   /* even if !dev_replace_is_valid, the values are good enough for
-* the replace_status ioctl */
+   /*
+* even if !dev_replace_is_valid, the values are good enough for
+* the replace_status ioctl
+*/
args->result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR;
args->status.replace_state = dev_replace->replace_state;
args->status.time_started = dev_replace->time_started;
@@ -870,8 +872,10 @@ void btrfs_dev_replace_lock(struct btrfs_dev_replace 
*dev_replace)
/* the beginning is just an optimization for the typical case */
if (atomic_read(&dev_replace->nesting_level) == 0) {
 acquire_lock:
-   /* this is not a nested case where the same thread
-* is trying to acqurire the same lock twice */
+   /*
+* this is not a nested case where the same thread
+* is trying to acqurire the same lock twice
+*/
mutex_lock(&dev_replace->lock);
mutex_lock(&dev_replace->lock_management_lock);
dev_replace->lock_owner = current->pid;
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: compression: added line after variable declaration

2016-02-21 Thread Philippe Loctaux
Oh, I see now :)
I'll try your changes and tell if they work or not :)

--
Philippe Loctaux
p...@philippeloctaux.com


On Sun, Feb 21, 2016 at 04:37:54PM -0800, Joe Perches wrote:
> On Mon, 2016-02-22 at 00:26 +0100, Philippe Loctaux wrote:
> > Added line after variable declaration, fixing checkpatch warning.
> []
> > diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> []
> > @@ -522,6 +522,7 @@ static noinline int add_ra_bio_pages(struct inode 
> > *inode,
> >  
> >     if (zero_offset) {
> >     int zeros;
> > +
> >     zeros = PAGE_CACHE_SIZE - zero_offset;
> >     userpage = kmap_atomic(page);
> >     memset(userpage + zero_offset, 0, zeros);
> 
> This zeros temporary is used once.
> Perhaps it should just be removed instead.
> 
> Maybe the userpage declaration should move too.
> 
> Something like:
> ---
>  fs/btrfs/compression.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index 3346cd8..be41f83 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -517,14 +517,13 @@ static noinline int add_ra_bio_pages(struct inode 
> *inode,
>   free_extent_map(em);
>  
>   if (page->index == end_index) {
> - char *userpage;
>   size_t zero_offset = isize & (PAGE_CACHE_SIZE - 1);
>  
>   if (zero_offset) {
> - int zeros;
> - zeros = PAGE_CACHE_SIZE - zero_offset;
> - userpage = kmap_atomic(page);
> - memset(userpage + zero_offset, 0, zeros);
> + char *userpage = kmap_atomic(page);
> +
> + memset(userpage + zero_offset, 0,
> +    PAGE_CACHE_SIZE - zero_offset);
>   flush_dcache_page(page);
>   kunmap_atomic(userpage);
>   }
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Question]: Contributing to btrfs

2016-02-21 Thread Philippe Loctaux
On Mon, Feb 22, 2016 at 09:18:04AM +0800, Qu Wenruo wrote:
> https://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git
> For branch, normally I use 'integration-X.X' as base for kernel development.
> 
> And for btrfs-progs,
> https://github.com/kdave/btrfs-progs.git devel

Allright, I'll work from these repos!

Is it fine if I work from Linus's repo?
Will my patches get rejected if I do so?

--
Philippe Loctaux
p...@philippeloctaux.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: ctree: added lines after variable declarations

2016-02-22 Thread Philippe Loctaux
Oh okay, thanks :)

--
Philippe Loctaux
p...@philippeloctaux.com

On Sun, Feb 21, 2016 at 04:44:14PM -0800, Joe Perches wrote:
> On Mon, 2016-02-22 at 01:31 +0100, Philippe Loctaux wrote:
> > Hi,
> > I'm really sorry, but I don't understand what you're trying to mean.
> > Could you simplify your sentence please (since I'm not english
> > native)?
> > I'd really apreciate that, thanks :)
> 
> Please do not put your reply at the top of the email. (top-post)
> 
> This was the only instance I found where your modifications
> were inappropriate (just here)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: dir-item: added line after variable declaration

2016-02-22 Thread Philippe Loctaux
Added line after variable declaration, fixing checkpatch warning.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/dir-item.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 1752625..70c39a3 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -46,6 +46,7 @@ static struct btrfs_dir_item *insert_with_overflow(struct 
btrfs_trans_handle
ret = btrfs_insert_empty_item(trans, root, path, cpu_key, data_size);
if (ret == -EEXIST) {
struct btrfs_dir_item *di;
+
di = btrfs_match_dir_item_name(root, path, name, name_len);
if (di)
return ERR_PTR(-EEXIST);
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Question]: Contributing to btrfs

2016-02-22 Thread Philippe Loctaux
On Mon, Feb 22, 2016 at 03:34:32PM +0800, Qu Wenruo wrote:
> 
> It depends.
> If it's just small fix, and can be applied on Chris' integration branch,
> that's OK.

Allright, the patches I sent added/removed a couple of lines,
so it should be fine.


> 
> But for huge modifications, it's recommended to use integration branch, as
> the final pull request is sent to btrfs maintainer Chris, not Linus.

For the moment I'll send small ones, I don't wanna get dirty too fast :P

Thanks for your quick reply!

--
Philippe Loctaux
p...@philippeloctaux.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] Btrfs: disk-io: fixed a comment block coding style issue

2016-02-22 Thread Philippe Loctaux
Makes the comment block start with /* on a separate line, and end
with */ on a separate line as well.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/disk-io.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f642b30..2545d01 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4416,9 +4416,9 @@ void btrfs_cleanup_one_transaction(struct 
btrfs_transaction *cur_trans,
wake_up(&cur_trans->commit_wait);
 
/*
-   memset(cur_trans, 0, sizeof(*cur_trans));
-   kmem_cache_free(btrfs_transaction_cachep, cur_trans);
-   */
+* memset(cur_trans, 0, sizeof(*cur_trans));
+* kmem_cache_free(btrfs_transaction_cachep, cur_trans);
+*/
 }
 
 static int btrfs_cleanup_transaction(struct btrfs_root *root)
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] Btrfs: disk-io: fixed an assignment error

2016-02-22 Thread Philippe Loctaux
Added spaces required around the equal sign, fixing a checkpatch error.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/disk-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 84cbf16..f642b30 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4412,7 +4412,7 @@ void btrfs_cleanup_one_transaction(struct 
btrfs_transaction *cur_trans,
btrfs_destroy_pinned_extent(root,
root->fs_info->pinned_extents);
 
-   cur_trans->state =TRANS_STATE_COMPLETED;
+   cur_trans->state = TRANS_STATE_COMPLETED;
wake_up(&cur_trans->commit_wait);
 
/*
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] Btrfs: disk-io: fixed a brace coding style issue

2016-02-22 Thread Philippe Loctaux
Fixed a coding style issue.

Signed-off-by: Philippe Loctaux 
---
 fs/btrfs/disk-io.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4545e2e..84cbf16 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1908,11 +1908,11 @@ static int transaction_kthread(void *arg)
cannot_commit = true;
goto sleep;
}
-   if (transid == trans->transid) {
+   if (transid == trans->transid)
btrfs_commit_transaction(trans, root);
-   } else {
+   else
btrfs_end_transaction(trans, root);
-   }
+
 sleep:
wake_up_process(root->fs_info->cleaner_kthread);
mutex_unlock(&root->fs_info->transaction_kthread_mutex);
@@ -1978,11 +1978,11 @@ static void find_oldest_super_backup(struct 
btrfs_fs_info *info,
 
newest_index = find_newest_super_backup(info, newest_gen);
/* if there was garbage in there, just move along */
-   if (newest_index == -1) {
+   if (newest_index == -1)
info->backup_root_index = 0;
-   } else {
+   else
info->backup_root_index = (newest_index + 1) % 
BTRFS_NUM_BACKUP_ROOTS;
-   }
+
 }
 
 /*
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Question]: Contributing to btrfs

2016-02-22 Thread Philippe Loctaux
On Mon, Feb 22, 2016 at 12:34:12PM +0100, David Sterba wrote:
> But otherwise whitespace-only changes are not considered worth the time,
> and I don't want to encourage people to do that. My usual answer to that
> is at
> 
> https://btrfs.wiki.kernel.org/index.php/Project_ideas#Cleanup_projects

Thanks, I'll take a look and see what I can do!

--
Philippe Loctaux
p...@philippeloctaux.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Question]: Contributing to btrfs

2016-02-22 Thread Philippe Loctaux
On Mon, Feb 22, 2016 at 01:18:05PM +0100, David Sterba wrote:
> 
> Thanks for the writeup. Should we ever need it again, it's now on the
> wiki.
> 
> https://btrfs.wiki.kernel.org/index.php/Developer's_FAQ#How_not_to_start

Thanks for putting that on the wiki, so that the new persons (hopefully)
won't make the same mistakes that I did :)

Is there a way we can put this onto the main kernel wiki so that almost
anyone can read that, not just the btrfs people?

--
Philippe Loctaux
p...@philippeloctaux.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Question]: Contributing to btrfs

2016-02-22 Thread Philippe Loctaux
On Mon, Feb 22, 2016 at 01:29:31PM +, Filipe Manana wrote:
> Whitespace/style patches I doubt. He probably encourages for small
> cleanup/optimizations as the first patch, like he did recently at
> https://lkml.org/lkml/2015/9/15/919. That's something that requires
> some thinking and understanding. Now running checkpatch and fix its
> warnings, doesn't require any skill at all.
> What were you planning? Sending more 100 patches, each one to fix a
> different style issue for each function? There's probably hundreds or
> thousands more style/whitespace "issues" to fix in btrfs alone.

I agree with you, I won't spend all my time fixing style/whitespace
issues, now that I know what I can do, thanks for that :)

--
Philippe Loctaux
p...@philippeloctaux.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html