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

« back to all changes in this revision

Viewing changes to fs/aufs/plink.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) 2007, 2008 Junjiro Okajima
 
2
 * Copyright (C) 2007-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: plink.c,v 1.18 2008/02/18 04:38:46 sfjro Exp $ */
 
19
/*
 
20
 * pseudo-link
 
21
 *
 
22
 * $Id: plink.c,v 1.20 2008/04/13 23:44:26 sfjro Exp $
 
23
 */
20
24
 
21
25
#include "aufs.h"
22
26
 
26
30
};
27
31
 
28
32
#ifdef CONFIG_AUFS_DEBUG
29
 
void au_list_plink(struct super_block *sb)
 
33
void au_plink_list(struct super_block *sb)
30
34
{
31
 
        struct aufs_sbinfo *sbinfo;
 
35
        struct au_sbinfo *sbinfo;
32
36
        struct list_head *plink_list;
33
37
        struct pseudo_link *plink;
34
38
 
35
39
        AuTraceEnter();
36
40
        SiMustAnyLock(sb);
37
 
        sbinfo = stosi(sb);
38
 
        AuDebugOn(!AuFlag(sbinfo, f_plink));
 
41
        sbinfo = au_sbi(sb);
 
42
        AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
39
43
 
40
44
        plink_list = &sbinfo->si_plink;
41
45
        spin_lock(&sbinfo->si_plink_lock);
45
49
}
46
50
#endif
47
51
 
48
 
int au_test_plink(struct super_block *sb, struct inode *inode)
 
52
int au_plink_test(struct super_block *sb, struct inode *inode)
49
53
{
50
54
        int found;
51
 
        struct aufs_sbinfo *sbinfo;
 
55
        struct au_sbinfo *sbinfo;
52
56
        struct list_head *plink_list;
53
57
        struct pseudo_link *plink;
54
58
 
55
59
        LKTRTrace("i%lu\n", inode->i_ino);
56
60
        SiMustAnyLock(sb);
57
 
        sbinfo = stosi(sb);
58
 
        AuDebugOn(!AuFlag(sbinfo, f_plink));
 
61
        sbinfo = au_sbi(sb);
 
62
        AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
59
63
 
60
64
        found = 0;
61
65
        plink_list = &sbinfo->si_plink;
87
91
        return rlen;
88
92
}
89
93
 
90
 
struct dentry *au_lkup_plink(struct super_block *sb, aufs_bindex_t bindex,
 
94
struct dentry *au_plink_lkup(struct super_block *sb, aufs_bindex_t bindex,
91
95
                             struct inode *inode)
92
96
{
93
97
        struct dentry *h_dentry, *h_parent;
94
 
        struct aufs_branch *br;
 
98
        struct au_branch *br;
95
99
        struct inode *h_dir;
96
100
        char tgtname[PLINK_NAME_LEN];
97
101
        int len;
98
 
        struct aufs_ndx ndx = {
 
102
        struct au_ndx ndx = {
99
103
                .flags  = 0,
100
104
                .nd     = NULL,
101
105
                //.br   = NULL
102
106
        };
103
107
 
104
108
        LKTRTrace("b%d, i%lu\n", bindex, inode->i_ino);
105
 
        br = stobr(sb, bindex);
 
109
        br = au_sbr(sb, bindex);
106
110
        h_parent = br->br_plink;
107
111
        AuDebugOn(!h_parent);
108
112
        h_dir = h_parent->d_inode;
113
117
        /* always superio. */
114
118
        ndx.nfsmnt = au_do_nfsmnt(br->br_mnt);
115
119
#if 0
116
 
        if (unlikely(au_need_dlgt(sb)))
 
120
        if (unlikely(au_opt_test_dlgt(au_mntflags(sb))))
117
121
                au_fset_ndx(ndx.flags, DLGT);
118
122
#endif
119
123
        vfsub_i_lock_nested(h_dir, AuLsc_I_CHILD2);
130
134
        struct dentry *h_tgt;
131
135
        struct inode *h_dir;
132
136
        struct vfsub_args vargs;
133
 
        struct aufs_ndx ndx = {
 
137
        struct au_ndx ndx = {
134
138
                .nfsmnt = nfsmnt,
135
139
                .flags  = 0,
136
140
                .nd     = NULL,
137
141
                //.br   = NULL
138
142
        };
139
143
 
140
 
        dlgt = au_need_dlgt(sb);
 
144
        dlgt = !!au_opt_test_dlgt(au_mntflags(sb));
141
145
        if (unlikely(dlgt))
142
146
                au_fset_ndx(ndx.flags, DLGT);
143
147
        h_tgt = au_lkup_one(tgt, h_parent, len, &ndx);
182
186
                   aufs_bindex_t bindex, struct super_block *sb)
183
187
{
184
188
        int err, len, wkq_err;
185
 
        struct aufs_branch *br;
 
189
        struct au_branch *br;
186
190
        struct dentry *h_parent;
187
191
        struct inode *h_dir;
188
192
        char tgtname[PLINK_NAME_LEN];
189
193
 
190
194
        LKTRTrace("%.*s\n", AuDLNPair(h_dentry));
191
 
        br = stobr(inode->i_sb, bindex);
 
195
        br = au_sbr(inode->i_sb, bindex);
192
196
        h_parent = br->br_plink;
193
197
        AuDebugOn(!h_parent);
194
198
        h_dir = h_parent->d_inode;
220
224
        return err;
221
225
}
222
226
 
223
 
void au_append_plink(struct super_block *sb, struct inode *inode,
 
227
void au_plink_append(struct super_block *sb, struct inode *inode,
224
228
                     struct dentry *h_dentry, aufs_bindex_t bindex)
225
229
{
226
 
        struct aufs_sbinfo *sbinfo;
 
230
        struct au_sbinfo *sbinfo;
227
231
        struct list_head *plink_list;
228
232
        struct pseudo_link *plink;
229
233
        int found, err, cnt;
230
234
 
231
235
        LKTRTrace("i%lu\n", inode->i_ino);
232
236
        SiMustAnyLock(sb);
233
 
        sbinfo = stosi(sb);
234
 
        AuDebugOn(!AuFlag(sbinfo, f_plink));
 
237
        sbinfo = au_sbi(sb);
 
238
        AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
235
239
 
236
240
        cnt = 0;
237
241
        found = 0;
276
280
        kfree(plink);
277
281
}
278
282
 
279
 
void au_put_plink(struct super_block *sb)
 
283
void au_plink_put(struct super_block *sb)
280
284
{
281
 
        struct aufs_sbinfo *sbinfo;
 
285
        struct au_sbinfo *sbinfo;
282
286
        struct list_head *plink_list;
283
287
        struct pseudo_link *plink, *tmp;
284
288
 
285
289
        AuTraceEnter();
286
290
        SiMustWriteLock(sb);
287
 
        sbinfo = stosi(sb);
288
 
        AuDebugOn(!AuFlag(sbinfo, f_plink));
 
291
        sbinfo = au_sbi(sb);
 
292
        AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
289
293
 
290
294
        plink_list = &sbinfo->si_plink;
291
295
        //spin_lock(&sbinfo->si_plink_lock);
295
299
        //spin_unlock(&sbinfo->si_plink_lock);
296
300
}
297
301
 
298
 
void au_half_refresh_plink(struct super_block *sb, aufs_bindex_t br_id)
 
302
void au_plink_half_refresh(struct super_block *sb, aufs_bindex_t br_id)
299
303
{
300
 
        struct aufs_sbinfo *sbinfo;
 
304
        struct au_sbinfo *sbinfo;
301
305
        struct list_head *plink_list;
302
306
        struct pseudo_link *plink, *tmp;
303
307
        struct inode *inode;
306
310
 
307
311
        AuTraceEnter();
308
312
        SiMustWriteLock(sb);
309
 
        sbinfo = stosi(sb);
310
 
        AuDebugOn(!AuFlag(sbinfo, f_plink));
 
313
        sbinfo = au_sbi(sb);
 
314
        AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
311
315
 
312
316
        plink_list = &sbinfo->si_plink;
313
317
        //spin_lock(&sbinfo->si_plink_lock);
315
319
                do_put = 0;
316
320
                inode = igrab(plink->inode);
317
321
                ii_write_lock_child(inode);
318
 
                bstart = ibstart(inode);
319
 
                bend = ibend(inode);
 
322
                bstart = au_ibstart(inode);
 
323
                bend = au_ibend(inode);
320
324
                if (bstart >= 0) {
321
325
                        for (bindex = bstart; bindex <= bend; bindex++) {
322
326
                                if (!au_h_iptr_i(inode, bindex)
323
 
                                    || itoid_index(inode, bindex) != br_id)
 
327
                                    || au_ii_br_id(inode, bindex) != br_id)
324
328
                                        continue;
325
 
                                set_h_iptr(inode, bindex, NULL, 0);
 
329
                                au_set_h_iptr(inode, bindex, NULL, 0);
326
330
                                do_put = 1;
327
331
                                break;
328
332
                        }