Skip to content

Commit

Permalink
Merge pull request #950 from tbzatek/btrfs-multivolume-misc
Browse files Browse the repository at this point in the history
Misc. btrfs fixes
  • Loading branch information
tbzatek committed Jan 6, 2022
2 parents 851996d + 99c1693 commit 3ca2fd7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 64 deletions.
1 change: 0 additions & 1 deletion doc/udisks2-sections.txt.daemon.sections.in
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ udisks_state_new
udisks_state_start_cleanup
udisks_state_stop_cleanup
udisks_state_check
udisks_state_check_sync
udisks_state_check_block
udisks_state_get_daemon
<SUBSECTION>
Expand Down
8 changes: 4 additions & 4 deletions modules/btrfs/udiskslinuxfilesystembtrfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ btrfs_subvolume_perform_action (UDisksFilesystemBTRFS *fs_btrfs,
udisks_linux_block_object_trigger_uevent_sync (object, UDISKS_DEFAULT_WAIT_TIMEOUT);

/* Complete DBus call. */
udisks_filesystem_btrfs_complete_set_label (fs_btrfs, invocation);
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));

out:
/* Release the resources */
Expand Down Expand Up @@ -519,12 +519,12 @@ btrfs_device_perform_action (UDisksFilesystemBTRFS *fs_btrfs,
goto out;
}

/* Update the interface. */
/* Trigger uevent on the filesystem and on the added/removed device */
udisks_linux_block_object_trigger_uevent_sync (object, UDISKS_DEFAULT_WAIT_TIMEOUT);
udisks_linux_filesystem_btrfs_update (l_fs_btrfs, object);
udisks_daemon_util_trigger_uevent_sync (daemon, device, NULL, UDISKS_DEFAULT_WAIT_TIMEOUT);

/* Complete DBus call. */
udisks_filesystem_btrfs_complete_add_device (fs_btrfs, invocation);
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));

out:
/* Release the resources */
Expand Down
58 changes: 0 additions & 58 deletions src/udisksstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,64 +425,6 @@ udisks_state_check (UDisksState *state)
state);
}


typedef struct
{
UDisksState *state;
gboolean finished;
GCond cond;
GMutex data_mutex;
} UDisksStateCheckSyncData;

static gboolean
udisks_state_check_sync_func (UDisksStateCheckSyncData *data)
{
udisks_state_check_in_thread (data->state);

/* signal the calling thread the cleanup has finished */
g_mutex_lock (&data->data_mutex);
data->finished = TRUE;
g_cond_signal (&data->cond);
g_mutex_unlock (&data->data_mutex);

return FALSE;
}

/**
* udisks_state_check_sync:
* @state: A #UDisksState.
*
* Causes the clean-up thread for @state to check if anything should be cleaned up and perform the cleanup.
*
* This can be called from any thread and in contrast to udisks_state_check() will block the calling thread until cleanup is finished.
*/
void
udisks_state_check_sync (UDisksState *state)
{
UDisksStateCheckSyncData data = {0, };

g_return_if_fail (UDISKS_IS_STATE (state));
g_return_if_fail (state->thread != NULL);

g_cond_init (&data.cond);
g_mutex_init (&data.data_mutex);
data.state = state;
data.finished = FALSE;

g_mutex_lock (&data.data_mutex);
g_main_context_invoke (state->context,
(GSourceFunc) udisks_state_check_sync_func,
&data);

/* wait for the mainloop running in the cleanup thread to process our injected task */
while (!data.finished)
g_cond_wait (&data.cond, &data.data_mutex);
g_mutex_unlock (&data.data_mutex);

g_cond_clear (&data.cond);
g_mutex_clear (&data.data_mutex);
}

/**
* udisks_state_check_block:
* @state: A #UDisksState.
Expand Down
1 change: 0 additions & 1 deletion src/udisksstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ UDisksDaemon *udisks_state_get_daemon (UDisksState *state);
void udisks_state_start_cleanup (UDisksState *state);
void udisks_state_stop_cleanup (UDisksState *state);
void udisks_state_check (UDisksState *state);
void udisks_state_check_sync (UDisksState *state);
void udisks_state_check_block (UDisksState *state,
dev_t block_device);
/* mounted-fs */
Expand Down

0 comments on commit 3ca2fd7

Please sign in to comment.