2
* Copyright (C) 2005, 2006, 2007, 2008 Junjiro Okajima
2
* Copyright (C) 2005-2008 Junjiro Okajima
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
19
/* $Id: sbinfo.c,v 1.48 2008/03/31 07:42:52 sfjro Exp $ */
20
* superblock private data
22
* $Id: sbinfo.c,v 1.50 2008/04/13 23:44:46 sfjro Exp $
23
struct aufs_sbinfo *stosi(struct super_block *sb)
25
struct aufs_sbinfo *sbinfo;
26
sbinfo = sb->s_fs_info;
27
//AuDebugOn(sbinfo->si_bend < 0);
31
aufs_bindex_t sbend(struct super_block *sb)
34
return stosi(sb)->si_bend;
37
struct aufs_branch *stobr(struct super_block *sb, aufs_bindex_t bindex)
39
struct aufs_branch *br;
42
AuDebugOn(bindex < 0 || sbend(sb) < bindex);
43
br = stosi(sb)->si_branch[0 + bindex];
27
struct au_branch *au_sbr(struct super_block *sb, aufs_bindex_t bindex)
32
AuDebugOn(bindex < 0 || au_sbend(sb) < bindex);
33
br = au_sbi(sb)->si_branch[0 + bindex];
48
au_gen_t au_sigen(struct super_block *sb)
51
return stosi(sb)->si_generation;
54
38
au_gen_t au_sigen_inc(struct super_block *sb)
58
42
SiMustWriteLock(sb);
59
gen = ++stosi(sb)->si_generation;
43
gen = ++au_sbi(sb)->si_generation;
60
44
au_update_digen(sb->s_root);
61
45
au_update_iigen(sb->s_root->d_inode);
62
46
sb->s_root->d_inode->i_version++;
66
int find_bindex(struct super_block *sb, struct aufs_branch *br)
50
int au_find_bindex(struct super_block *sb, struct au_branch *br)
68
52
aufs_bindex_t bindex, bend;
71
55
for (bindex = 0; bindex <= bend; bindex++)
72
if (stobr(sb, bindex) == br)
56
if (au_sbr(sb, bindex) == br)
112
96
AuDebugOn(d1 == d2 || d1->d_sb != d2->d_sb);
113
97
si_read_lock(d1->d_sb, flags);
114
di_write_lock2_child(d1, d2, flags);
98
di_write_lock2_child(d1, d2, au_ftest_lock(flags, DIR));
117
101
void aufs_read_and_write_unlock2(struct dentry *d1, struct dentry *d2)
124
108
/* ---------------------------------------------------------------------- */
126
aufs_bindex_t new_br_id(struct super_block *sb)
110
aufs_bindex_t au_new_br_id(struct super_block *sb)
128
112
aufs_bindex_t br_id;
129
struct aufs_sbinfo *sbinfo;
113
struct au_sbinfo *sbinfo;
132
116
SiMustWriteLock(sb);
136
120
br_id = ++sbinfo->si_last_br_id;
137
if (br_id && find_brindex(sb, br_id) < 0)
121
if (br_id && au_br_index(sb, br_id) < 0)