blobfs: remove duplicated tailq operation statement.
The code can be merged into cache_free_buffers Change-Id: I5da59ae5c5ea2b91d4aecd15a611ad6731bd4c56 Signed-off-by: Ziye Yang <optimistyzy@gmail.com> Reviewed-on: https://review.gerrithub.io/372993 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
ddcc31d645
commit
95399c118e
@ -1540,8 +1540,6 @@ alloc_cache_memory_buffer(struct spdk_file *context)
|
||||
if (!file->open_for_writing &&
|
||||
file->priority == SPDK_FILE_PRIORITY_LOW &&
|
||||
file != context) {
|
||||
TAILQ_REMOVE(&g_caches, file, cache_tailq);
|
||||
TAILQ_INSERT_TAIL(&g_caches, file, cache_tailq);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1557,8 +1555,6 @@ alloc_cache_memory_buffer(struct spdk_file *context)
|
||||
pthread_spin_lock(&g_caches_lock);
|
||||
TAILQ_FOREACH(file, &g_caches, cache_tailq) {
|
||||
if (!file->open_for_writing && file != context) {
|
||||
TAILQ_REMOVE(&g_caches, file, cache_tailq);
|
||||
TAILQ_INSERT_TAIL(&g_caches, file, cache_tailq);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1574,8 +1570,6 @@ alloc_cache_memory_buffer(struct spdk_file *context)
|
||||
pthread_spin_lock(&g_caches_lock);
|
||||
TAILQ_FOREACH(file, &g_caches, cache_tailq) {
|
||||
if (file != context) {
|
||||
TAILQ_REMOVE(&g_caches, file, cache_tailq);
|
||||
TAILQ_INSERT_TAIL(&g_caches, file, cache_tailq);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2336,8 +2330,11 @@ cache_free_buffers(struct spdk_file *file)
|
||||
return;
|
||||
}
|
||||
spdk_tree_free_buffers(file->tree);
|
||||
if (file->tree->present_mask == 0) {
|
||||
TAILQ_REMOVE(&g_caches, file, cache_tailq);
|
||||
|
||||
TAILQ_REMOVE(&g_caches, file, cache_tailq);
|
||||
/* If not freed, put it in the end of the queue */
|
||||
if (file->tree->present_mask != 0) {
|
||||
TAILQ_INSERT_TAIL(&g_caches, file, cache_tailq);
|
||||
}
|
||||
file->last = NULL;
|
||||
pthread_spin_unlock(&g_caches_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user