Skip to contentSkip to conversation

Btrfs: use arg gfp_mask to decide how to allocate tree mod

PATCH Wang Shilong 3 participants 4 messages May 5, 2013 – May 6, 2013 1 message not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

It seems the original code doesn't pass the right arg gfp_t to decide how to allocate. Just applying this patch, fsstress will fail. So please ignore this patch, will resend later..

Thanks,
Wang

Quoted 26 lines

From: Wang Shilong <[email protected]>

We have passed arg gfp_mask to tree_mod_alloc(), so just use it rather than always use GFP_ATOMIC.

---
fs/btrfs/ctree.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ctree.c +1 -1
index de6de8e..0e3514f 100644
@@ -553,7 +553,7 @@ static inline int tree_mod_alloc(struct btrfs_fs_info *fs_info, gfp_t flags,
 	 * once we switch from spin locks to something different, we should
 	 * honor the flags parameter here.
 	 */
-	tm = *tm_ret = kzalloc(sizeof(*tm), GFP_ATOMIC);
+	tm = *tm_ret = kzalloc(sizeof(*tm), flags);
 	if (!tm)
 		return -ENOMEM;
 
Signature · 1 line
1.7.11.7
#2 lore raw
Quoted 2 lines · Wang Shilong

It seems the original code doesn't pass the right arg gfp_t to decide how to allocate. Just applying this patch, fsstress will fail. So please ignore this patch, will resend later..

That's in fact what the comment above the line you changed implies :-)

-Jan

Quoted 35 lines

Thanks,
Wang

Quoted 26 lines

From: Wang Shilong <[email protected]>

We have passed arg gfp_mask to tree_mod_alloc(), so just use it rather than always use GFP_ATOMIC.

---
fs/btrfs/ctree.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ctree.c +1 -1
index de6de8e..0e3514f 100644
@@ -553,7 +553,7 @@ static inline int tree_mod_alloc(struct btrfs_fs_info *fs_info, gfp_t flags,
 	 * once we switch from spin locks to something different, we should
 	 * honor the flags parameter here.
 	 */
-	tm = *tm_ret = kzalloc(sizeof(*tm), GFP_ATOMIC);
+	tm = *tm_ret = kzalloc(sizeof(*tm), flags);
 	if (!tm)
 		return -ENOMEM;
 
Signature · 1 line
1.7.11.7

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

#3 lore raw

Hello Jan,

Quoted 5 lines · Wang Shilong
Quoted 2 lines

It seems the original code doesn't pass the right arg gfp_t to decide how to allocate. Just applying this patch, fsstress will fail. So please ignore this patch, will resend later..

That's in fact what the comment above the line you changed implies :-)

e.. It seems tree_mod_alloc() will always allocate with GFP_ATOMIC in your code. However, i think we should try best not to allocate with GTP_ATOMIC.. otherwise, at least.. the arg gfp_t you try to pass is useless and should be removed ^_^

Thanks,
Wang

Quoted 43 lines

-Jan

Quoted 26 lines

Thanks,
Wang

Quoted 23 lines

From: Wang Shilong <[email protected]>

We have passed arg gfp_mask to tree_mod_alloc(), so just use it rather than always use GFP_ATOMIC.

---
fs/btrfs/ctree.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ctree.c +1 -1
index de6de8e..0e3514f 100644
@@ -553,7 +553,7 @@ static inline int tree_mod_alloc(struct btrfs_fs_info *fs_info, gfp_t flags,
 	 * once we switch from spin locks to something different, we should
 	 * honor the flags parameter here.
 	 */
-	tm = *tm_ret = kzalloc(sizeof(*tm), GFP_ATOMIC);
+	tm = *tm_ret = kzalloc(sizeof(*tm), flags);
 	if (!tm)
 		return -ENOMEM;
 
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

oops, i just miswrite my working email "[email protected]" to "[email protected]" So please do not cc at that email address. sorry, my bad.

Thanks,
Wang

Quoted 67 lines

Hello Jan,

Quoted 4 lines · Wang Shilong
Quoted 2 lines

It seems the original code doesn't pass the right arg gfp_t to decide how to allocate. Just applying this patch, fsstress will fail. So please ignore this patch, will resend later..

That's in fact what the comment above the line you changed implies :-)

e.. It seems tree_mod_alloc() will always allocate with GFP_ATOMIC in your code. However, i think we should try best not to allocate with GTP_ATOMIC.. otherwise, at least.. the arg gfp_t you try to pass is useless and should be removed ^_^

Thanks,
Wang

Quoted 36 lines

-Jan

Quoted 26 lines

Thanks,
Wang

Quoted 23 lines

From: Wang Shilong <[email protected]>

We have passed arg gfp_mask to tree_mod_alloc(), so just use it rather than always use GFP_ATOMIC.

---
fs/btrfs/ctree.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ctree.c +1 -1
index de6de8e..0e3514f 100644
@@ -553,7 +553,7 @@ static inline int tree_mod_alloc(struct btrfs_fs_info *fs_info, gfp_t flags,
 	 * once we switch from spin locks to something different, we should
 	 * honor the flags parameter here.
 	 */
-	tm = *tm_ret = kzalloc(sizeof(*tm), GFP_ATOMIC);
+	tm = *tm_ret = kzalloc(sizeof(*tm), flags);
 	if (!tm)
 		return -ENOMEM;
 
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
1.7.11.7

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

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html