block: Modify block module 91/80991/2
authorpr.jung <pr.jung@samsung.com>
Thu, 21 Jul 2016 07:52:50 +0000 (16:52 +0900)
committerpr.jung <pr.jung@samsung.com>
Wed, 3 Aug 2016 07:16:40 +0000 (16:16 +0900)
commit657fa84fcf1213c6f9025bda2db478d73ec81126
treec4ae9a3c1aac0acf339682d15daad9749449798d
parent0707f32302169fcafa9c6c8cd31c01fcf8b32d6f
block: Modify block module

1. Merge Block interface to BlockManager
- Before, deviced creates new object for every device node,
sends signal and receives dbus methods requests using Block interface.
It cause some timing issues.
- Now, block module will not creates new object for each node,
and only have BlockManager interface.

2. Check queue has unmount operation before mount
- If operation queue has unmount operation, then deviced doesn't need to mount device.
So, deviced dequeue operations before unmount operation.

3. Check operation is already done
- If operation is already done, deviced doesn't need to do it again.

4. Use specific number of thread
- Maximum number of thread is 5.
- If new block_device which use same devnode is inserted,
same thread which used before dealt with the new block_device.
- Each thread processes operation in the order of block_device is added to block_dev_list.
- After operation queue is empty from one block_device, thread processes operation for next block_device.

5. Add thread mutex and thread wait condition
- Add thread mutex for operation queue and op_len
- Remove block_device mutex (which was for operation queue)
- Wait when all operation queue of thread is empty (op_len == 0)
- Wakeup when first operation is added (op_len is changed to 1)

6. Make block_dev_list for each thread
- Use thread mutex for each block_dev_list of thread
- Dbus method calls should not get information about physically removed block device

7. Same device is dealt with the same thread
- All partitions from same device is dealt with the same thread

8. Remove BLOCK_DEV_DEQUEUE pipe command

Change-Id: Ia4064de11afafdcbeb9811cf4884978f22f27b25
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/block/block.c
src/libdeviced/mmc.c
src/shared/dbus.h