summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-09-07 15:57:25 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-09-08 15:16:43 -0700
commit5579d2f5cdda0286d908e4975c0cd9f5361b8df0 (patch)
tree978a64d0b152906c96dcfb1fd8708cb1fb0348a3 /src/lib/eio
parentd7fbd6f13ef0f32838db89f331790edbeb8a2bf1 (diff)
eio: make xattr list packed for better performance.
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/eio_xattr.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/src/lib/eio/eio_xattr.c b/src/lib/eio/eio_xattr.c
index a795b9535f..0dfec5b367 100644
--- a/src/lib/eio/eio_xattr.c
+++ b/src/lib/eio/eio_xattr.c
@@ -33,11 +33,17 @@ _eio_ls_xattr_heavy(void *data, Ecore_Thread *thread)
33{ 33{
34 Eio_File_Char_Ls *async = data; 34 Eio_File_Char_Ls *async = data;
35 Eina_Iterator *it; 35 Eina_Iterator *it;
36 Eina_List *pack = NULL;
36 const char *tmp; 37 const char *tmp;
38 double start;
37 39
38 it = eina_xattr_ls(async->ls.directory); 40 it = eina_xattr_ls(async->ls.directory);
39 if (!it) return; 41 if (!it) return;
40 42
43 eio_file_container_set(&async->ls.common, eina_iterator_container_get(it));
44
45 start = ecore_time_get();
46
41 EINA_ITERATOR_FOREACH(it, tmp) 47 EINA_ITERATOR_FOREACH(it, tmp)
42 { 48 {
43 Eina_Bool filter = EINA_TRUE; 49 Eina_Bool filter = EINA_TRUE;
@@ -49,22 +55,38 @@ _eio_ls_xattr_heavy(void *data, Ecore_Thread *thread)
49 tmp); 55 tmp);
50 } 56 }
51 57
52 if (filter) ecore_thread_feedback(thread, eina_stringshare_add(tmp)); 58 if (filter)
59 {
60 Eio_File_Char *send_fc;
61
62 send_fc = eio_char_malloc();
63 if (!send_fc) goto on_error;
64
65 send_fc->filename = eina_stringshare_add(tmp);
66 send_fc->associated = async->ls.common.worker.associated;
67 async->ls.common.worker.associated = NULL;
68
69 pack = eina_list_append(pack, send_fc);
70 }
71 else
72 {
73 on_error:
74 if (async->ls.common.worker.associated)
75 {
76 eina_hash_free(async->ls.common.worker.associated);
77 async->ls.common.worker.associated = NULL;
78 }
79 }
80
81 pack = eio_pack_send(thread, pack, &start);
53 82
54 if (ecore_thread_check(thread)) 83 if (ecore_thread_check(thread))
55 break; 84 break;
56 } 85 }
57 86
58 eina_iterator_free(it); 87 if (pack) ecore_thread_feedback(thread, pack);
59}
60
61static void
62_eio_ls_xattr_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data)
63{
64 Eio_File_Char_Ls *async = data;
65 const char *xattr = msg_data;
66 88
67 async->main_cb((void*) async->ls.common.data, &async->ls.common, xattr); 89 async->ls.ls = it;
68} 90}
69 91
70static void 92static void
@@ -310,7 +332,7 @@ eio_file_xattr(const char *path,
310 error_cb, 332 error_cb,
311 data, 333 data,
312 _eio_ls_xattr_heavy, 334 _eio_ls_xattr_heavy,
313 _eio_ls_xattr_notify, 335 _eio_string_notify,
314 eio_async_end, 336 eio_async_end,
315 eio_async_error)) 337 eio_async_error))
316 return NULL; 338 return NULL;