btrfs: return void in functions without error conditions
[firefly-linux-kernel-4.4.55.git] / fs / btrfs / tree-log.c
index cb877e0886a71b80e0f44f60e0d884f57203a597..37b52b8c67278ee848866a8cf5e028500d7ed43b 100644 (file)
@@ -212,14 +212,13 @@ int btrfs_pin_log_trans(struct btrfs_root *root)
  * indicate we're done making changes to the log tree
  * and wake up anyone waiting to do a sync
  */
-int btrfs_end_log_trans(struct btrfs_root *root)
+void btrfs_end_log_trans(struct btrfs_root *root)
 {
        if (atomic_dec_and_test(&root->log_writers)) {
                smp_mb();
                if (waitqueue_active(&root->log_writer_wait))
                        wake_up(&root->log_writer_wait);
        }
-       return 0;
 }
 
 
@@ -378,12 +377,11 @@ insert:
                u32 found_size;
                found_size = btrfs_item_size_nr(path->nodes[0],
                                                path->slots[0]);
-               if (found_size > item_size) {
+               if (found_size > item_size)
                        btrfs_truncate_item(trans, root, path, item_size, 1);
-               } else if (found_size < item_size) {
-                       ret = btrfs_extend_item(trans, root, path,
-                                               item_size - found_size);
-               }
+               else if (found_size < item_size)
+                       btrfs_extend_item(trans, root, path,
+                                         item_size - found_size);
        } else if (ret) {
                return ret;
        }
@@ -1957,16 +1955,18 @@ static int wait_log_commit(struct btrfs_trans_handle *trans,
 
                finish_wait(&root->log_commit_wait[index], &wait);
                mutex_lock(&root->log_mutex);
-       } while (root->log_transid < transid + 2 &&
+       } while (root->fs_info->last_trans_log_full_commit !=
+                trans->transid && root->log_transid < transid + 2 &&
                 atomic_read(&root->log_commit[index]));
        return 0;
 }
 
-static int wait_for_writer(struct btrfs_trans_handle *trans,
-                          struct btrfs_root *root)
+static void wait_for_writer(struct btrfs_trans_handle *trans,
+                           struct btrfs_root *root)
 {
        DEFINE_WAIT(wait);
-       while (atomic_read(&root->log_writers)) {
+       while (root->fs_info->last_trans_log_full_commit !=
+              trans->transid && atomic_read(&root->log_writers)) {
                prepare_to_wait(&root->log_writer_wait,
                                &wait, TASK_UNINTERRUPTIBLE);
                mutex_unlock(&root->log_mutex);
@@ -1976,7 +1976,6 @@ static int wait_for_writer(struct btrfs_trans_handle *trans,
                mutex_lock(&root->log_mutex);
                finish_wait(&root->log_writer_wait, &wait);
        }
-       return 0;
 }
 
 /*