Skip to contentSkip to conversation

ocfs2: add extent block stealing for ocfs2 v1

Ocfs2-devel Jun Yang 2 participants 4 messages Dec 14, 2009 – Dec 17, 2009 OCFS2

lore
Share & tools
lore
#1 lore raw

Hi Tiger,

@@ -731,36 +715,39 @@ int ocfs2_reserve_new_inode(struct ocfs2_super *osb,
goto bail;
}

- (*ac)->ac_bits_wanted = 1;
- (*ac)->ac_which = OCFS2_AC_USE_INODE;
-
+ (*ac)->ac_bits_wanted = blocks;
(*ac)->ac_group_search = ocfs2_block_group_search;
+ if (type == INODE_ALLOC_SYSTEM_INODE)
+ (*ac)->ac_which = OCFS2_AC_USE_INODE;
+ else if (type == EXTENT_ALLOC_SYSTEM_INODE)
+ (*ac)->ac_which = OCFS2_AC_USE_META;

/*
* stat(2) can't handle i_ino > 32bits, so we tell the
* lower levels not to allocate us a block group past that
* limit. The 'inode64' mount option avoids this behavior. */
- if (!(osb->s_mount_opt & OCFS2_MOUNT_INODE64))
+ if (type == INODE_ALLOC_SYSTEM_INODE &&
+ !(osb->s_mount_opt & OCFS2_MOUNT_INODE64))
(*ac)->ac_max_block = (u32)~0U;

/*
- * slot is set when we successfully steal inode from other nodes.
- * It is reset in 3 places:
+ * slot is set when we successfully steal inode/extent
+ * from other nodes. It is reset in 3 places:
* 1. when we flush the truncate log
* 2. when we complete local alloc recovery.
* 3. when we successfully allocate from our own slot.
- * After it is set, we will go on stealing inodes until we find the
+ * After it is set, we will go on stealing resource until we find the
* need to check our slots to see whether there is some space for us. */
if (slot != OCFS2_INVALID_SLOT &&
- atomic_read(&osb->s_num_inodes_stolen) < OCFS2_MAX_INODES_TO_STEAL)
- goto inode_steal;
+ ocfs2_could_steal_resource(osb, type))
+ goto resource_steal;

- atomic_set(&osb->s_num_inodes_stolen, 0);
+ ATOMIC_ZERO_RESOURCE_NUMBER(type);
alloc_group = osb->osb_inode_alloc_group;
here, you use the alloc_group which is only used in inode alloc and reset it after the reservation succeed. I am afraid extent alloc shouldn't use and change it?

status = ocfs2_reserve_suballoc_bits(osb, *ac,
- INODE_ALLOC_SYSTEM_INODE,
+ type,
osb->slot_num, &alloc_group, ALLOC_NEW_GROUP |

I am also curious about one thing. Have you written the test script
for it to see whether it works?
You can take ocfs2-tests/programs/inode_stealing/inode_stealing.sh for reference.

Regards,
Tao

Quoted 13 lines · Jun Yang

Hi, Joel,

The attached patch is the first version about extent stealing. Please feel free to correct me about the codes or function name or comments.

thanks,
tiger
------------------------------------------------------------------------

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel

author
#2 lore raw
Quoted 5 lines · Tao Ma

alloc_group = osb->osb_inode_alloc_group;
here, you use the alloc_group which is only used in inode alloc and reset it
after the reservation succeed. I am afraid extent alloc shouldn't use and change it?

Yes, It's a mistake. It seems I would better not merge those two functions.

Quoted 4 lines

I am also curious about one thing. Have you written the test script for it to see whether it works?
You can take ocfs2-tests/programs/inode_stealing/inode_stealing.sh for reference.

thanks for your advice. I will make a similar test for extent block stealing patches.

Thanks,
tiger

#3 lore raw
Quoted 9 lines · Jun Yang
Quoted 6 lines · Tao Ma

alloc_group = osb->osb_inode_alloc_group;
here, you use the alloc_group which is only used in inode alloc and reset it
after the reservation succeed. I am afraid extent alloc shouldn't use and
change it?

Yes, It's a mistake. It seems I would better not merge those two functions.

oh, you can merge them. Just make sure not mess extent_alloc with inode_alloc.

Quoted 7 lines
Quoted 5 lines

I am also curious about one thing. Have you written the test script for it to see whether it works?
You can take ocfs2-tests/programs/inode_stealing/inode_stealing.sh for reference.

thanks for your advice. I will make a similar test for extent block stealing patches.

cool.

Regards,
Tao