From: Edward Shishkin this patch addresses the following todo item: > blocknr_set_add() modifies a list_head without any apparent > locking. Certainly without any _documented_ locking... > Ditto blocknr_set_destroy(). I'm sure there's locking, but > it's harder than it should be to work out what it is. > Given that proper locking is in place, the filesystem seems > to use list_*_careful() a lot more than is necessary? Use list_empty() instead of list_empty_careful() for reiser4 blocknr sets protected by atom lock. Signed-off-by: Edward Shishkin Signed-off-by: Andrew Morton --- fs/reiser4/blocknrset.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff -puN fs/reiser4/blocknrset.c~reiser4-use-list_empty-instead-of-list_empty_careful-for fs/reiser4/blocknrset.c --- a/fs/reiser4/blocknrset.c~reiser4-use-list_empty-instead-of-list_empty_careful-for +++ a/fs/reiser4/blocknrset.c @@ -28,6 +28,9 @@ * extent; atom's wandered map is also stored as a blocknr set, blocknr pairs * there represent a (real block) -> (wandered block) mapping. */ +/* Protection: blocknr sets belong to reiser4 atom, and + * their modifications are performed with the atom lock held */ + typedef struct blocknr_pair blocknr_pair; /* The total size of a blocknr_set_entry. */ @@ -231,7 +234,7 @@ void blocknr_set_destroy(struct list_hea { blocknr_set_entry *bse; - while (!list_empty_careful(bset)) { + while (!list_empty(bset)) { bse = list_entry(bset->next, blocknr_set_entry, link); list_del_init(&bse->link); bse_free(bse); @@ -253,10 +256,10 @@ void blocknr_set_merge(struct list_head blocknr_set_entry *bse_into = NULL; /* If @from is empty, no work to perform. */ - if (list_empty_careful(from)) + if (list_empty(from)) return; /* If @into is not empty, try merging partial-entries. */ - if (!list_empty_careful(into)) { + if (!list_empty(into)) { /* Neither set is empty, pop the front to members and try to combine them. */ blocknr_set_entry *bse_from; _