* [PATCH] btrfs: Remove some dead code
@ 2016-11-01 10:26 ` Christophe JAILLET
0 siblings, 0 replies; 12+ messages in thread
From: Christophe JAILLET @ 2016-11-01 10:26 UTC (permalink / raw)
To: clm, jbacik, dsterba
Cc: linux-btrfs, linux-kernel, kernel-janitors, Christophe JAILLET
'btrfs_iget()' can not return an error pointer, so this test can be
removed.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
fs/btrfs/free-space-cache.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index e4b48f377d3a..afd8b0c10acd 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -75,8 +75,6 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
btrfs_release_path(path);
inode = btrfs_iget(root->fs_info->sb, &location, root, NULL);
- if (!inode)
- return ERR_PTR(-ENOENT);
if (IS_ERR(inode))
return inode;
if (is_bad_inode(inode)) {
--
2.9.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] btrfs: Remove some dead code
@ 2016-11-01 10:26 ` Christophe JAILLET
0 siblings, 0 replies; 12+ messages in thread
From: Christophe JAILLET @ 2016-11-01 10:26 UTC (permalink / raw)
To: clm, jbacik, dsterba
Cc: linux-btrfs, linux-kernel, kernel-janitors, Christophe JAILLET
'btrfs_iget()' can not return an error pointer, so this test can be
removed.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
fs/btrfs/free-space-cache.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index e4b48f377d3a..afd8b0c10acd 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -75,8 +75,6 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
btrfs_release_path(path);
inode = btrfs_iget(root->fs_info->sb, &location, root, NULL);
- if (!inode)
- return ERR_PTR(-ENOENT);
if (IS_ERR(inode))
return inode;
if (is_bad_inode(inode)) {
--
2.9.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] btrfs: Remove some dead code
2016-11-01 10:26 ` Christophe JAILLET
@ 2016-11-02 14:30 ` David Sterba
-1 siblings, 0 replies; 12+ messages in thread
From: David Sterba @ 2016-11-02 14:30 UTC (permalink / raw)
To: Christophe JAILLET
Cc: clm, jbacik, dsterba, linux-btrfs, linux-kernel, kernel-janitors
On Tue, Nov 01, 2016 at 11:26:06AM +0100, Christophe JAILLET wrote:
> 'btrfs_iget()' can not return an error pointer, so this test can be
> removed.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] btrfs: Remove some dead code
@ 2016-11-02 14:30 ` David Sterba
0 siblings, 0 replies; 12+ messages in thread
From: David Sterba @ 2016-11-02 14:30 UTC (permalink / raw)
To: Christophe JAILLET
Cc: clm, jbacik, dsterba, linux-btrfs, linux-kernel, kernel-janitors
On Tue, Nov 01, 2016 at 11:26:06AM +0100, Christophe JAILLET wrote:
> 'btrfs_iget()' can not return an error pointer, so this test can be
> removed.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] btrfs: Remove some dead code
2016-11-01 10:26 ` Christophe JAILLET
@ 2016-11-03 12:43 ` Tobias Klauser
-1 siblings, 0 replies; 12+ messages in thread
From: Tobias Klauser @ 2016-11-03 12:43 UTC (permalink / raw)
To: Christophe JAILLET
Cc: clm, jbacik, dsterba, linux-btrfs, linux-kernel, kernel-janitors
On 2016-11-01 at 11:26:06 +0100, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> 'btrfs_iget()' can not return an error pointer, so this test can be
> removed.
This descrption does not match what the patch actually does. Shouldn't
it say "...can not return NULL, so this test can be removed."?
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> fs/btrfs/free-space-cache.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index e4b48f377d3a..afd8b0c10acd 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -75,8 +75,6 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
> btrfs_release_path(path);
>
> inode = btrfs_iget(root->fs_info->sb, &location, root, NULL);
> - if (!inode)
> - return ERR_PTR(-ENOENT);
> if (IS_ERR(inode))
> return inode;
> if (is_bad_inode(inode)) {
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] btrfs: Remove some dead code
@ 2016-11-03 12:43 ` Tobias Klauser
0 siblings, 0 replies; 12+ messages in thread
From: Tobias Klauser @ 2016-11-03 12:43 UTC (permalink / raw)
To: Christophe JAILLET
Cc: clm, jbacik, dsterba, linux-btrfs, linux-kernel, kernel-janitors
On 2016-11-01 at 11:26:06 +0100, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> 'btrfs_iget()' can not return an error pointer, so this test can be
> removed.
This descrption does not match what the patch actually does. Shouldn't
it say "...can not return NULL, so this test can be removed."?
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> fs/btrfs/free-space-cache.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index e4b48f377d3a..afd8b0c10acd 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -75,8 +75,6 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
> btrfs_release_path(path);
>
> inode = btrfs_iget(root->fs_info->sb, &location, root, NULL);
> - if (!inode)
> - return ERR_PTR(-ENOENT);
> if (IS_ERR(inode))
> return inode;
> if (is_bad_inode(inode)) {
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] btrfs: Remove some dead code
2016-11-03 12:43 ` Tobias Klauser
@ 2016-11-03 18:24 ` Christophe JAILLET
-1 siblings, 0 replies; 12+ messages in thread
From: Christophe JAILLET @ 2016-11-03 18:24 UTC (permalink / raw)
To: Tobias Klauser
Cc: clm, jbacik, dsterba, linux-btrfs, linux-kernel, kernel-janitors
Le 03/11/2016 à 13:43, Tobias Klauser a écrit :
> On 2016-11-01 at 11:26:06 +0100, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
>> 'btrfs_iget()' can not return an error pointer, so this test can be
>> removed.
> This descrption does not match what the patch actually does. Shouldn't
> it say "...can not return NULL, so this test can be removed."?
>
You are obviously correct. Cut'n'Paste error while sending other patches.
I will send a V2 with an updated description.
Thanks for the review.
CJ
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] btrfs: Remove some dead code
@ 2016-11-03 18:24 ` Christophe JAILLET
0 siblings, 0 replies; 12+ messages in thread
From: Christophe JAILLET @ 2016-11-03 18:24 UTC (permalink / raw)
To: Tobias Klauser
Cc: clm, jbacik, dsterba, linux-btrfs, linux-kernel, kernel-janitors
Le 03/11/2016 à 13:43, Tobias Klauser a écrit :
> On 2016-11-01 at 11:26:06 +0100, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
>> 'btrfs_iget()' can not return an error pointer, so this test can be
>> removed.
> This descrption does not match what the patch actually does. Shouldn't
> it say "...can not return NULL, so this test can be removed."?
>
You are obviously correct. Cut'n'Paste error while sending other patches.
I will send a V2 with an updated description.
Thanks for the review.
CJ
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Btrfs: remove some dead code
2017-04-11 8:57 ` Dan Carpenter
@ 2017-04-12 13:36 ` David Sterba
-1 siblings, 0 replies; 12+ messages in thread
From: David Sterba @ 2017-04-12 13:36 UTC (permalink / raw)
To: Dan Carpenter
Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, kernel-janitors
On Tue, Apr 11, 2017 at 11:57:15AM +0300, Dan Carpenter wrote:
> btrfs_get_extent() never returns NULL pointers, so this code introduces
> a static checker warning.
>
> The btrfs_get_extent() is a bit complex, but trust me that it doesn't
> return NULLs and also if it did we would trigger the BUG_ON(!em) before
> the last return statement.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Added to 4.12, thanks. I've updated the subject line so it reflects what
the patch does.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Btrfs: remove some dead code
@ 2017-04-12 13:36 ` David Sterba
0 siblings, 0 replies; 12+ messages in thread
From: David Sterba @ 2017-04-12 13:36 UTC (permalink / raw)
To: Dan Carpenter
Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, kernel-janitors
On Tue, Apr 11, 2017 at 11:57:15AM +0300, Dan Carpenter wrote:
> btrfs_get_extent() never returns NULL pointers, so this code introduces
> a static checker warning.
>
> The btrfs_get_extent() is a bit complex, but trust me that it doesn't
> return NULLs and also if it did we would trigger the BUG_ON(!em) before
> the last return statement.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Added to 4.12, thanks. I've updated the subject line so it reflects what
the patch does.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Btrfs: remove some dead code
@ 2017-04-11 8:57 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-04-11 8:57 UTC (permalink / raw)
To: Chris Mason; +Cc: Josef Bacik, David Sterba, linux-btrfs, kernel-janitors
btrfs_get_extent() never returns NULL pointers, so this code introduces
a static checker warning.
The btrfs_get_extent() is a bit complex, but trust me that it doesn't
return NULLs and also if it did we would trigger the BUG_ON(!em) before
the last return statement.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 315fbbf84fa2..1519d29dec01 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2397,13 +2397,8 @@ static int find_first_non_hole(struct inode *inode, u64 *start, u64 *len)
int ret = 0;
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, *start, *len, 0);
- if (IS_ERR_OR_NULL(em)) {
- if (!em)
- ret = -ENOMEM;
- else
- ret = PTR_ERR(em);
- return ret;
- }
+ if (IS_ERR(em))
+ return PTR_ERR(em);
/* Hole or vacuum extent(only exists in no-hole mode) */
if (em->block_start == EXTENT_MAP_HOLE) {
@@ -2893,11 +2888,8 @@ static long btrfs_fallocate(struct file *file, int mode,
while (1) {
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, cur_offset,
alloc_end - cur_offset, 0);
- if (IS_ERR_OR_NULL(em)) {
- if (!em)
- ret = -ENOMEM;
- else
- ret = PTR_ERR(em);
+ if (IS_ERR(em)) {
+ ret = PTR_ERR(em);
break;
}
last_byte = min(extent_map_end(em), alloc_end);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index df937f8c71df..dc5f9002593d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6866,7 +6866,6 @@ static noinline int uncompress_inline(struct btrfs_path *path,
*
* This also copies inline extents directly into the page.
*/
-
struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
struct page *page,
size_t pg_offset, u64 start, u64 len,
@@ -7175,19 +7174,17 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
em = btrfs_get_extent(inode, page, pg_offset, start, len, create);
if (IS_ERR(em))
return em;
- if (em) {
- /*
- * if our em maps to
- * - a hole or
- * - a pre-alloc extent,
- * there might actually be delalloc bytes behind it.
- */
- if (em->block_start != EXTENT_MAP_HOLE &&
- !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
- return em;
- else
- hole_em = em;
- }
+ /*
+ * if our em maps to
+ * - a hole or
+ * - a pre-alloc extent,
+ * there might actually be delalloc bytes behind it.
+ */
+ if (em->block_start != EXTENT_MAP_HOLE &&
+ !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
+ return em;
+ else
+ hole_em = em;
/* check to see if we've wrapped (len == -1 or similar) */
end = start + len;
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] Btrfs: remove some dead code
@ 2017-04-11 8:57 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-04-11 8:57 UTC (permalink / raw)
To: Chris Mason; +Cc: Josef Bacik, David Sterba, linux-btrfs, kernel-janitors
btrfs_get_extent() never returns NULL pointers, so this code introduces
a static checker warning.
The btrfs_get_extent() is a bit complex, but trust me that it doesn't
return NULLs and also if it did we would trigger the BUG_ON(!em) before
the last return statement.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 315fbbf84fa2..1519d29dec01 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2397,13 +2397,8 @@ static int find_first_non_hole(struct inode *inode, u64 *start, u64 *len)
int ret = 0;
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, *start, *len, 0);
- if (IS_ERR_OR_NULL(em)) {
- if (!em)
- ret = -ENOMEM;
- else
- ret = PTR_ERR(em);
- return ret;
- }
+ if (IS_ERR(em))
+ return PTR_ERR(em);
/* Hole or vacuum extent(only exists in no-hole mode) */
if (em->block_start = EXTENT_MAP_HOLE) {
@@ -2893,11 +2888,8 @@ static long btrfs_fallocate(struct file *file, int mode,
while (1) {
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, cur_offset,
alloc_end - cur_offset, 0);
- if (IS_ERR_OR_NULL(em)) {
- if (!em)
- ret = -ENOMEM;
- else
- ret = PTR_ERR(em);
+ if (IS_ERR(em)) {
+ ret = PTR_ERR(em);
break;
}
last_byte = min(extent_map_end(em), alloc_end);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index df937f8c71df..dc5f9002593d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6866,7 +6866,6 @@ static noinline int uncompress_inline(struct btrfs_path *path,
*
* This also copies inline extents directly into the page.
*/
-
struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
struct page *page,
size_t pg_offset, u64 start, u64 len,
@@ -7175,19 +7174,17 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
em = btrfs_get_extent(inode, page, pg_offset, start, len, create);
if (IS_ERR(em))
return em;
- if (em) {
- /*
- * if our em maps to
- * - a hole or
- * - a pre-alloc extent,
- * there might actually be delalloc bytes behind it.
- */
- if (em->block_start != EXTENT_MAP_HOLE &&
- !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
- return em;
- else
- hole_em = em;
- }
+ /*
+ * if our em maps to
+ * - a hole or
+ * - a pre-alloc extent,
+ * there might actually be delalloc bytes behind it.
+ */
+ if (em->block_start != EXTENT_MAP_HOLE &&
+ !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
+ return em;
+ else
+ hole_em = em;
/* check to see if we've wrapped (len = -1 or similar) */
end = start + len;
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-04-12 13:36 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-01 10:26 [PATCH] btrfs: Remove some dead code Christophe JAILLET
2016-11-01 10:26 ` Christophe JAILLET
2016-11-02 14:30 ` David Sterba
2016-11-02 14:30 ` David Sterba
2016-11-03 12:43 ` Tobias Klauser
2016-11-03 12:43 ` Tobias Klauser
2016-11-03 18:24 ` Christophe JAILLET
2016-11-03 18:24 ` Christophe JAILLET
2017-04-11 8:57 [PATCH] Btrfs: remove " Dan Carpenter
2017-04-11 8:57 ` Dan Carpenter
2017-04-12 13:36 ` David Sterba
2017-04-12 13:36 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.