OSDN Git Service

btrfs: set trans->drity in btrfs_commit_transaction
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / kernel / async.c
index 4c3773c..f1fd155 100644 (file)
@@ -84,20 +84,24 @@ static atomic_t entry_count;
 
 static async_cookie_t lowest_in_progress(struct async_domain *domain)
 {
-       struct list_head *pending;
+       struct async_entry *first = NULL;
        async_cookie_t ret = ASYNC_COOKIE_MAX;
        unsigned long flags;
 
        spin_lock_irqsave(&async_lock, flags);
 
-       if (domain)
-               pending = &domain->pending;
-       else
-               pending = &async_global_pending;
+       if (domain) {
+               if (!list_empty(&domain->pending))
+                       first = list_first_entry(&domain->pending,
+                                       struct async_entry, domain_list);
+       } else {
+               if (!list_empty(&async_global_pending))
+                       first = list_first_entry(&async_global_pending,
+                                       struct async_entry, global_list);
+       }
 
-       if (!list_empty(pending))
-               ret = list_first_entry(pending, struct async_entry,
-                                      domain_list)->cookie;
+       if (first)
+               ret = first->cookie;
 
        spin_unlock_irqrestore(&async_lock, flags);
        return ret;