gvfs/gdu-0013-pass-the-flush-mou...

100 lines
3.2 KiB
Diff

From 7fd9061afbd0ec4664adb17aed706e12fd5f3eee Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Wed, 15 Apr 2009 14:41:27 -0400
Subject: [PATCH 13/13] pass the 'flush' mount option for vfat
This mount option makes the vfat filesystem driver flush data more
often. As a consequence
1. users never get to see the gnome-disk-utility notification daemon
dialog just added
http://people.freedesktop.org/~david/gdu-unmount-busy-1.png
but that's useful for other filesystems as well.
2. The Nautilus copy dialog stays up until things are on the disk
We do this in gvfs rather than DeviceKit-disks because in some
scenarios 'flush' may be unwanted and there is currently no way to
turn it off (e.g. no 'noflush' or 'flush=0' option).
Ideally the kernel would get this kind of thing right by itself.
---
monitor/gdu/ggduvolume.c | 36 +++++++++++++++++++++++++++++++++---
1 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c
index 49494a1..871a1c5 100644
--- a/monitor/gdu/ggduvolume.c
+++ b/monitor/gdu/ggduvolume.c
@@ -648,6 +648,27 @@ g_gdu_volume_get_mount (GVolume *volume)
/* ---------------------------------------------------------------------------------------------------- */
+static gchar **
+get_mount_options (GduDevice *device)
+{
+ gchar **ret;
+
+ /* one day we might read this from user settings */
+ if (g_strcmp0 (gdu_device_id_get_usage (device), "filesystem") == 0 &&
+ g_strcmp0 (gdu_device_id_get_type (device), "vfat") == 0)
+ {
+ ret = g_new0 (gchar *, 2);
+ ret[0] = g_strdup ("flush");
+ ret[1] = NULL;
+ }
+ else
+ ret = NULL;
+
+ return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
struct MountOpData
{
GGduVolume *volume;
@@ -735,8 +756,11 @@ mount_obtain_authz_cb (GObject *source_object,
}
else
{
+ gchar **mount_options;
/* got the authz, now try again */
- gdu_device_op_filesystem_mount (data->device_to_mount, mount_cb, data);
+ mount_options = get_mount_options (data->device_to_mount);
+ gdu_device_op_filesystem_mount (data->device_to_mount, mount_options, mount_cb, data);
+ g_strfreev (mount_options);
goto out;
}
@@ -842,7 +866,10 @@ mount_cleartext_device (MountOpData *data,
}
else
{
- gdu_device_op_filesystem_mount (data->device_to_mount, mount_cb, data);
+ gchar **mount_options;
+ mount_options = get_mount_options (data->device_to_mount);
+ gdu_device_op_filesystem_mount (data->device_to_mount, mount_options, mount_cb, data);
+ g_strfreev (mount_options);
}
g_object_unref (pool);
@@ -1260,8 +1287,11 @@ g_gdu_volume_mount (GVolume *_volume,
}
else
{
+ gchar **mount_options;
data->device_to_mount = g_object_ref (device);
- gdu_device_op_filesystem_mount (data->device_to_mount, mount_cb, data);
+ mount_options = get_mount_options (data->device_to_mount);
+ gdu_device_op_filesystem_mount (data->device_to_mount, mount_options, mount_cb, data);
+ g_strfreev (mount_options);
}
out:
--
1.6.2.2