Skip to contentSkip to conversation

UBI WL-Subsystem: Improvement in prot tree

PATCH Artem Bityutskiy 1 participant 3 messages Dec 8, 2008 1 message not in the archive Memory technology devices (MTD)

lore
Share & tools
lore

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

#1 lore raw

Hi,

you are back. I thought you had disappeared forever and removed your git tree from my home last week, sorry. I'll create it soon and will take a look at your patch, thanks.

Quoted 15 lines · xiaochuan-xu

Hi, all.

A new PEB protection method in UBI WL-Subsystem is implemented, It's simpler and higher efficiency than the older prot RB-tree, I think.

1. without two prot RB-tree, there is only one prot array, But their functions are the same.

2. no other structure needed except @ubi_wl_entry ubi_wl_prot_entry is discarded. and we need not malloc new struct every time in ubi_wl_get_peb() function.

3. protarray add and del operation are O(1) operations, and check over opteration is O(n), which is better then the older prot RB-tree implement.

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)
#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · xiaochuan-xu

Hi, all.

A new PEB protection method in UBI WL-Subsystem is implemented, It's simpler and higher efficiency than the older prot RB-tree, I think.

1. without two prot RB-tree, there is only one prot array, But their functions are the same.

Quoted 7 lines

2. no other structure needed except @ubi_wl_entry ubi_wl_prot_entry is discarded. and we need not malloc new struct every time in ubi_wl_get_peb() function.

3. protarray add and del operation are O(1) operations, and check over opteration is O(n), which is better then the older prot RB-tree implement.

Hi,

yeah, I like the idea. Indeed there is no reason to have balanced trees for this "protection" stuff, and a list should be enough. The list does not have to be long, 8-16 entries are enough, so search should be quick enough. Every time an eraseblock is erased, we take one element from the head of the list, and we add new elements to the head of the list, so it acts as a queue.

I'll accept such a change, but not with this patch, because there are problems. Here are some of them.

1. It is line-wrapped. Please, learn how to send patches correctly. Please, try send it to yourself, then try to apply what you have received.

2. Let's call it "protection list", not array.

3. Please, split your patch on several pieces. One obvious piece would be introducing the union to

struct ubi_wl_entry {
- struct rb_node rb;
+ union {
+ struct rb_node rb;
+ } u;

and at the nest patches you add a list to the union. This way you will simplify further patches and make them easier to review because they will not contain huge number of changes like

- e1 = rb_entry(p, struct ubi_wl_entry, rb);
+ e1 = rb_entry(p, struct ubi_wl_entry, u.rb);

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)
#3 lore raw
Quoted 17 lines · Artem Bityutskiy
Quoted 8 lines · xiaochuan-xu

Hi, all.

A new PEB protection method in UBI WL-Subsystem is implemented, It's simpler and higher efficiency than the older prot RB-tree, I think.

1. without two prot RB-tree, there is only one prot array, But their functions are the same.

Quoted 7 lines

2. no other structure needed except @ubi_wl_entry ubi_wl_prot_entry is discarded. and we need not malloc new struct every time in ubi_wl_get_peb() function.

3. protarray add and del operation are O(1) operations, and check over opteration is O(n), which is better then the older prot RB-tree implement.

Quoted 8 lines

Hi,

yeah, I like the idea. Indeed there is no reason to have balanced trees for this "protection" stuff, and a list should be enough. The list does not have to be long, 8-16 entries are enough, so search should be quick enough. Every time an eraseblock is erased, we take one element from the head of the list, and we add new elements to the head of the list, so it acts as a queue.

Err, sure we add elements to the tail.

I've created a git tree for you again (xxc-ubi-2.6.git).

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)