~ubuntu-branches/ubuntu/vivid/aufs/vivid

« back to all changes in this revision

Viewing changes to fs/aufs/wkq.c

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2008-05-06 18:35:50 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080506183550-0b6c974kkgc46oeh
Tags: 0+20080506-1
* New upstream release, supports Kernel 2.6.25 (Closes: #479717)
* Fix building with older Kernels (Closes: #475042)
* Update the patches 01, 04 and 07 to also patch fs/aufs25

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2005, 2006, 2007, 2008 Junjiro Okajima
 
2
 * Copyright (C) 2005-2008 Junjiro Okajima
3
3
 *
4
4
 * This program, aufs is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
16
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 */
18
18
 
19
 
/* $Id: wkq.c,v 1.27 2008/03/16 23:46:30 sfjro Exp $ */
 
19
/*
 
20
 * workqueue for asynchronous/super-io/delegated operations
 
21
 *
 
22
 * $Id: wkq.c,v 1.30 2008/04/21 01:59:57 sfjro Exp $
 
23
 */
20
24
 
21
25
#include <linux/module.h>
22
26
#include "aufs.h"
79
83
        cred_store(old);
80
84
        cred_revert(new);
81
85
}
82
 
#endif
 
86
 
 
87
static void dlgt_cred_store(unsigned int flags, struct au_wkinfo *wkinfo)
 
88
{
 
89
        if (unlikely(au_ftest_wkq(flags, DLGT)))
 
90
                cred_store(&wkinfo->cred);
 
91
}
 
92
 
 
93
static void dlgt_func(struct au_wkinfo *wkinfo)
 
94
{
 
95
        LKTRTrace("wkinfo{0x%x, %p, %p, %p, %p}\n",
 
96
                  wkinfo->flags, wkinfo->func, wkinfo->args, wkinfo->busyp,
 
97
                  wkinfo->comp);
 
98
 
 
99
        if (!au_ftest_wkq(wkinfo->flags, DLGT))
 
100
                wkinfo->func(wkinfo->args);
 
101
        else {
 
102
                struct au_cred cred;
 
103
                cred_switch(&cred, &wkinfo->cred);
 
104
                wkinfo->func(wkinfo->args);
 
105
                cred_revert(&cred);
 
106
        }
 
107
}
 
108
#else
 
109
static void dlgt_cred_store(unsigned int flags, struct au_wkinfo *wkinfo)
 
110
{
 
111
        /* empty */
 
112
}
 
113
 
 
114
static void dlgt_func(struct au_wkinfo *wkinfo)
 
115
{
 
116
        wkinfo->func(wkinfo->args);
 
117
}
 
118
#endif /* CONFIG_AUFS_DLGT */
83
119
 
84
120
/* ---------------------------------------------------------------------- */
85
121
 
146
182
static AuWkqFunc(wkq_func, wk)
147
183
{
148
184
        struct au_wkinfo *wkinfo = container_of(wk, struct au_wkinfo, wk);
149
 
        struct aufs_sbinfo *sbinfo;
 
185
        struct au_sbinfo *sbinfo;
150
186
 
151
187
        LKTRTrace("wkinfo{0x%x, %p, %p, %p}\n",
152
188
                  wkinfo->flags, wkinfo->func, wkinfo->busyp, wkinfo->comp);
153
 
#ifdef CONFIG_AUFS_DLGT
154
 
        if (!au_ftest_wkq(wkinfo->flags, DLGT))
155
 
                wkinfo->func(wkinfo->args);
156
 
        else {
157
 
                struct au_cred cred;
158
 
                cred_switch(&cred, &wkinfo->cred);
159
 
                wkinfo->func(wkinfo->args);
160
 
                cred_revert(&cred);
161
 
        }
162
 
#else
163
 
        wkinfo->func(wkinfo->args);
164
 
#endif
 
189
 
 
190
        dlgt_func(wkinfo);
165
191
        atomic_dec_return(wkinfo->busyp);
166
192
        if (au_ftest_wkq(wkinfo->flags, WAIT))
167
193
                complete(wkinfo->comp);
168
194
        else {
169
 
                sbinfo = stosi(wkinfo->sb);
 
195
                sbinfo = au_sbi(wkinfo->sb);
170
196
#if 0 // rfu
171
197
                if (atomic_dec_and_test(&sbinfo->si_wkq_nowait))
172
198
                        wake_up_all(&sbinfo->si_wkq_nowait_wq);
183
209
        int err;
184
210
        //int queued;
185
211
        //struct workqueue_struct *wkq;
186
 
        struct aufs_sbinfo *sbinfo;
 
212
        struct au_sbinfo *sbinfo;
187
213
        DECLARE_COMPLETION_ONSTACK(comp);
188
214
        struct au_wkinfo _wkinfo = {
189
215
                //.sb   = sb,
216
242
                wkinfo->comp = NULL;
217
243
                /* prohibit umount */
218
244
                __module_get(THIS_MODULE);
219
 
                sbinfo = stosi(sb);
 
245
                sbinfo = au_sbi(sb);
220
246
                au_mntget(sb);
221
247
        }
222
248
 
223
249
        AuInitWkq(&wkinfo->wk, wkq_func);
224
 
#ifdef CONFIG_AUFS_DLGT
225
 
        if (unlikely(au_ftest_wkq(flags, DLGT)))
226
 
                cred_store(&wkinfo->cred);
227
 
#endif
228
 
 
 
250
        dlgt_cred_store(flags, wkinfo);
229
251
        do_wkq(wkinfo);
230
252
#if 0 // remove
231
253
        /* never fail */