aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-10-29 07:11:47 -0400
committerBen Myers <bpm@sgi.com>2013-10-30 14:38:59 -0400
commit4740175e75f70ab71f76ae98ab00f7db731a48f7 (patch)
tree716ca450f8fc545b6dd14d8052a81d6d440a7f16 /fs/xfs
parent32c5483a8a13a43264809144210ec114dd70b611 (diff)
xfs: vectorise remaining shortform dir2 ops
Following from the initial patch to introduce the directory operations vector, convert the rest of the shortform directory operations to use vectored ops rather than superblock feature checks. This further reduces the size of the built binary: text data bss dec hex filename 794490 96802 1096 892388 d9de4 fs/xfs/xfs.o.orig 792986 96802 1096 890884 d9804 fs/xfs/xfs.o.p1 792350 96802 1096 890248 d9588 fs/xfs/xfs.o.p2 Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_da_format.c152
-rw-r--r--fs/xfs/xfs_da_format.h47
-rw-r--r--fs/xfs/xfs_dir2.h20
-rw-r--r--fs/xfs/xfs_dir2_block.c6
-rw-r--r--fs/xfs/xfs_dir2_readdir.c6
-rw-r--r--fs/xfs/xfs_dir2_sf.c151
6 files changed, 199 insertions, 183 deletions
diff --git a/fs/xfs/xfs_da_format.c b/fs/xfs/xfs_da_format.c
index 982d105d012f..62f55a0186ae 100644
--- a/fs/xfs/xfs_da_format.c
+++ b/fs/xfs/xfs_da_format.c
@@ -69,17 +69,169 @@ xfs_dir3_sf_nextentry(
69} 69}
70 70
71 71
72/*
73 * For filetype enabled shortform directories, the file type field is stored at
74 * the end of the name. Because it's only a single byte, endian conversion is
75 * not necessary. For non-filetype enable directories, the type is always
76 * unknown and we never store the value.
77 */
78static __uint8_t
79xfs_dir2_sfe_get_ftype(
80 struct xfs_dir2_sf_entry *sfep)
81{
82 return XFS_DIR3_FT_UNKNOWN;
83}
84
85static void
86xfs_dir2_sfe_put_ftype(
87 struct xfs_dir2_sf_entry *sfep,
88 __uint8_t ftype)
89{
90 ASSERT(ftype < XFS_DIR3_FT_MAX);
91}
92
93static __uint8_t
94xfs_dir3_sfe_get_ftype(
95 struct xfs_dir2_sf_entry *sfep)
96{
97 __uint8_t ftype;
98
99 ftype = sfep->name[sfep->namelen];
100 if (ftype >= XFS_DIR3_FT_MAX)
101 return XFS_DIR3_FT_UNKNOWN;
102 return ftype;
103}
104
105static void
106xfs_dir3_sfe_put_ftype(
107 struct xfs_dir2_sf_entry *sfep,
108 __uint8_t ftype)
109{
110 ASSERT(ftype < XFS_DIR3_FT_MAX);
111
112 sfep->name[sfep->namelen] = ftype;
113}
114
115/*
116 * Inode numbers in short-form directories can come in two versions,
117 * either 4 bytes or 8 bytes wide. These helpers deal with the
118 * two forms transparently by looking at the headers i8count field.
119 *
120 * For 64-bit inode number the most significant byte must be zero.
121 */
122static xfs_ino_t
123xfs_dir2_sf_get_ino(
124 struct xfs_dir2_sf_hdr *hdr,
125 xfs_dir2_inou_t *from)
126{
127 if (hdr->i8count)
128 return get_unaligned_be64(&from->i8.i) & 0x00ffffffffffffffULL;
129 else
130 return get_unaligned_be32(&from->i4.i);
131}
132
133static void
134xfs_dir2_sf_put_ino(
135 struct xfs_dir2_sf_hdr *hdr,
136 xfs_dir2_inou_t *to,
137 xfs_ino_t ino)
138{
139 ASSERT((ino & 0xff00000000000000ULL) == 0);
140
141 if (hdr->i8count)
142 put_unaligned_be64(ino, &to->i8.i);
143 else
144 put_unaligned_be32(ino, &to->i4.i);
145}
146
147static xfs_ino_t
148xfs_dir2_sf_get_parent_ino(
149 struct xfs_dir2_sf_hdr *hdr)
150{
151 return xfs_dir2_sf_get_ino(hdr, &hdr->parent);
152}
153
154static void
155xfs_dir2_sf_put_parent_ino(
156 struct xfs_dir2_sf_hdr *hdr,
157 xfs_ino_t ino)
158{
159 xfs_dir2_sf_put_ino(hdr, &hdr->parent, ino);
160}
161
162/*
163 * In short-form directory entries the inode numbers are stored at variable
164 * offset behind the entry name. If the entry stores a filetype value, then it
165 * sits between the name and the inode number. Hence the inode numbers may only
166 * be accessed through the helpers below.
167 */
168static xfs_ino_t
169xfs_dir2_sfe_get_ino(
170 struct xfs_dir2_sf_hdr *hdr,
171 struct xfs_dir2_sf_entry *sfep)
172{
173 return xfs_dir2_sf_get_ino(hdr,
174 (xfs_dir2_inou_t *)&sfep->name[sfep->namelen]);
175}
176
177static void
178xfs_dir2_sfe_put_ino(
179 struct xfs_dir2_sf_hdr *hdr,
180 struct xfs_dir2_sf_entry *sfep,
181 xfs_ino_t ino)
182{
183 xfs_dir2_sf_put_ino(hdr,
184 (xfs_dir2_inou_t *)&sfep->name[sfep->namelen], ino);
185}
186
187static xfs_ino_t
188xfs_dir3_sfe_get_ino(
189 struct xfs_dir2_sf_hdr *hdr,
190 struct xfs_dir2_sf_entry *sfep)
191{
192 return xfs_dir2_sf_get_ino(hdr,
193 (xfs_dir2_inou_t *)&sfep->name[sfep->namelen + 1]);
194}
195
196static void
197xfs_dir3_sfe_put_ino(
198 struct xfs_dir2_sf_hdr *hdr,
199 struct xfs_dir2_sf_entry *sfep,
200 xfs_ino_t ino)
201{
202 xfs_dir2_sf_put_ino(hdr,
203 (xfs_dir2_inou_t *)&sfep->name[sfep->namelen + 1], ino);
204}
205
72const struct xfs_dir_ops xfs_dir2_ops = { 206const struct xfs_dir_ops xfs_dir2_ops = {
73 .sf_entsize = xfs_dir2_sf_entsize, 207 .sf_entsize = xfs_dir2_sf_entsize,
74 .sf_nextentry = xfs_dir2_sf_nextentry, 208 .sf_nextentry = xfs_dir2_sf_nextentry,
209 .sf_get_ftype = xfs_dir2_sfe_get_ftype,
210 .sf_put_ftype = xfs_dir2_sfe_put_ftype,
211 .sf_get_ino = xfs_dir2_sfe_get_ino,
212 .sf_put_ino = xfs_dir2_sfe_put_ino,
213 .sf_get_parent_ino = xfs_dir2_sf_get_parent_ino,
214 .sf_put_parent_ino = xfs_dir2_sf_put_parent_ino,
75}; 215};
76 216
77const struct xfs_dir_ops xfs_dir2_ftype_ops = { 217const struct xfs_dir_ops xfs_dir2_ftype_ops = {
78 .sf_entsize = xfs_dir3_sf_entsize, 218 .sf_entsize = xfs_dir3_sf_entsize,
79 .sf_nextentry = xfs_dir3_sf_nextentry, 219 .sf_nextentry = xfs_dir3_sf_nextentry,
220 .sf_get_ftype = xfs_dir3_sfe_get_ftype,
221 .sf_put_ftype = xfs_dir3_sfe_put_ftype,
222 .sf_get_ino = xfs_dir3_sfe_get_ino,
223 .sf_put_ino = xfs_dir3_sfe_put_ino,
224 .sf_get_parent_ino = xfs_dir2_sf_get_parent_ino,
225 .sf_put_parent_ino = xfs_dir2_sf_put_parent_ino,
80}; 226};
81 227
82const struct xfs_dir_ops xfs_dir3_ops = { 228const struct xfs_dir_ops xfs_dir3_ops = {
83 .sf_entsize = xfs_dir3_sf_entsize, 229 .sf_entsize = xfs_dir3_sf_entsize,
84 .sf_nextentry = xfs_dir3_sf_nextentry, 230 .sf_nextentry = xfs_dir3_sf_nextentry,
231 .sf_get_ftype = xfs_dir3_sfe_get_ftype,
232 .sf_put_ftype = xfs_dir3_sfe_put_ftype,
233 .sf_get_ino = xfs_dir3_sfe_get_ino,
234 .sf_put_ino = xfs_dir3_sfe_put_ino,
235 .sf_get_parent_ino = xfs_dir2_sf_get_parent_ino,
236 .sf_put_parent_ino = xfs_dir2_sf_put_parent_ino,
85}; 237};
diff --git a/fs/xfs/xfs_da_format.h b/fs/xfs/xfs_da_format.h
index d54726d0fc10..68c2ad5ba54f 100644
--- a/fs/xfs/xfs_da_format.h
+++ b/fs/xfs/xfs_da_format.h
@@ -330,53 +330,6 @@ xfs_dir2_sf_firstentry(struct xfs_dir2_sf_hdr *hdr)
330} 330}
331 331
332/* 332/*
333 * in dir3 shortform directories, the file type field is stored at a variable
334 * offset after the inode number. Because it's only a single byte, endian
335 * conversion is not necessary.
336 */
337static inline __uint8_t *
338xfs_dir3_sfe_ftypep(
339 struct xfs_dir2_sf_hdr *hdr,
340 struct xfs_dir2_sf_entry *sfep)
341{
342 return (__uint8_t *)&sfep->name[sfep->namelen];
343}
344
345static inline __uint8_t
346xfs_dir3_sfe_get_ftype(
347 struct xfs_mount *mp,
348 struct xfs_dir2_sf_hdr *hdr,
349 struct xfs_dir2_sf_entry *sfep)
350{
351 __uint8_t *ftp;
352
353 if (!xfs_sb_version_hasftype(&mp->m_sb))
354 return XFS_DIR3_FT_UNKNOWN;
355
356 ftp = xfs_dir3_sfe_ftypep(hdr, sfep);
357 if (*ftp >= XFS_DIR3_FT_MAX)
358 return XFS_DIR3_FT_UNKNOWN;
359 return *ftp;
360}
361
362static inline void
363xfs_dir3_sfe_put_ftype(
364 struct xfs_mount *mp,
365 struct xfs_dir2_sf_hdr *hdr,
366 struct xfs_dir2_sf_entry *sfep,
367 __uint8_t ftype)
368{
369 __uint8_t *ftp;
370
371 ASSERT(ftype < XFS_DIR3_FT_MAX);
372
373 if (!xfs_sb_version_hasftype(&mp->m_sb))
374 return;
375 ftp = xfs_dir3_sfe_ftypep(hdr, sfep);
376 *ftp = ftype;
377}
378
379/*
380 * Data block structures. 333 * Data block structures.
381 * 334 *
382 * A pure data block looks like the following drawing on disk: 335 * A pure data block looks like the following drawing on disk:
diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h
index 1909d9faff71..0e94b3e662af 100644
--- a/fs/xfs/xfs_dir2.h
+++ b/fs/xfs/xfs_dir2.h
@@ -39,6 +39,17 @@ struct xfs_dir_ops {
39 struct xfs_dir2_sf_entry * 39 struct xfs_dir2_sf_entry *
40 (*sf_nextentry)(struct xfs_dir2_sf_hdr *hdr, 40 (*sf_nextentry)(struct xfs_dir2_sf_hdr *hdr,
41 struct xfs_dir2_sf_entry *sfep); 41 struct xfs_dir2_sf_entry *sfep);
42 __uint8_t (*sf_get_ftype)(struct xfs_dir2_sf_entry *sfep);
43 void (*sf_put_ftype)(struct xfs_dir2_sf_entry *sfep,
44 __uint8_t ftype);
45 xfs_ino_t (*sf_get_ino)(struct xfs_dir2_sf_hdr *hdr,
46 struct xfs_dir2_sf_entry *sfep);
47 void (*sf_put_ino)(struct xfs_dir2_sf_hdr *hdr,
48 struct xfs_dir2_sf_entry *sfep,
49 xfs_ino_t ino);
50 xfs_ino_t (*sf_get_parent_ino)(struct xfs_dir2_sf_hdr *hdr);
51 void (*sf_put_parent_ino)(struct xfs_dir2_sf_hdr *hdr,
52 xfs_ino_t ino);
42}; 53};
43 54
44extern const struct xfs_dir_ops xfs_dir2_ops; 55extern const struct xfs_dir_ops xfs_dir2_ops;
@@ -79,15 +90,6 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
79/* 90/*
80 * Interface routines used by userspace utilities 91 * Interface routines used by userspace utilities
81 */ 92 */
82extern xfs_ino_t xfs_dir2_sf_get_parent_ino(struct xfs_dir2_sf_hdr *sfp);
83extern void xfs_dir2_sf_put_parent_ino(struct xfs_dir2_sf_hdr *sfp,
84 xfs_ino_t ino);
85extern xfs_ino_t xfs_dir3_sfe_get_ino(struct xfs_mount *mp,
86 struct xfs_dir2_sf_hdr *sfp, struct xfs_dir2_sf_entry *sfep);
87extern void xfs_dir3_sfe_put_ino(struct xfs_mount *mp,
88 struct xfs_dir2_sf_hdr *hdr, struct xfs_dir2_sf_entry *sfep,
89 xfs_ino_t ino);
90
91extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *r); 93extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
92extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r); 94extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
93extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db, 95extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index 9d86b6f9e80f..960f3ab526f6 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -1173,7 +1173,7 @@ xfs_dir2_sf_to_block(
1173 * Create entry for .. 1173 * Create entry for ..
1174 */ 1174 */
1175 dep = xfs_dir3_data_dotdot_entry_p(mp, hdr); 1175 dep = xfs_dir3_data_dotdot_entry_p(mp, hdr);
1176 dep->inumber = cpu_to_be64(xfs_dir2_sf_get_parent_ino(sfp)); 1176 dep->inumber = cpu_to_be64(dp->d_ops->sf_get_parent_ino(sfp));
1177 dep->namelen = 2; 1177 dep->namelen = 2;
1178 dep->name[0] = dep->name[1] = '.'; 1178 dep->name[0] = dep->name[1] = '.';
1179 xfs_dir3_dirent_put_ftype(mp, dep, XFS_DIR3_FT_DIR); 1179 xfs_dir3_dirent_put_ftype(mp, dep, XFS_DIR3_FT_DIR);
@@ -1222,10 +1222,10 @@ xfs_dir2_sf_to_block(
1222 * Copy a real entry. 1222 * Copy a real entry.
1223 */ 1223 */
1224 dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset); 1224 dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset);
1225 dep->inumber = cpu_to_be64(xfs_dir3_sfe_get_ino(mp, sfp, sfep)); 1225 dep->inumber = cpu_to_be64(dp->d_ops->sf_get_ino(sfp, sfep));
1226 dep->namelen = sfep->namelen; 1226 dep->namelen = sfep->namelen;
1227 xfs_dir3_dirent_put_ftype(mp, dep, 1227 xfs_dir3_dirent_put_ftype(mp, dep,
1228 xfs_dir3_sfe_get_ftype(mp, sfp, sfep)); 1228 dp->d_ops->sf_get_ftype(sfep));
1229 memcpy(dep->name, sfep->name, dep->namelen); 1229 memcpy(dep->name, sfep->name, dep->namelen);
1230 tagp = xfs_dir3_data_entry_tag_p(mp, dep); 1230 tagp = xfs_dir3_data_entry_tag_p(mp, dep);
1231 *tagp = cpu_to_be16((char *)dep - (char *)hdr); 1231 *tagp = cpu_to_be16((char *)dep - (char *)hdr);
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index 80333055df34..2d2c8fb05541 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.c
@@ -136,7 +136,7 @@ xfs_dir2_sf_getdents(
136 * Put .. entry unless we're starting past it. 136 * Put .. entry unless we're starting past it.
137 */ 137 */
138 if (ctx->pos <= dotdot_offset) { 138 if (ctx->pos <= dotdot_offset) {
139 ino = xfs_dir2_sf_get_parent_ino(sfp); 139 ino = dp->d_ops->sf_get_parent_ino(sfp);
140 ctx->pos = dotdot_offset & 0x7fffffff; 140 ctx->pos = dotdot_offset & 0x7fffffff;
141 if (!dir_emit(ctx, "..", 2, ino, DT_DIR)) 141 if (!dir_emit(ctx, "..", 2, ino, DT_DIR))
142 return 0; 142 return 0;
@@ -157,8 +157,8 @@ xfs_dir2_sf_getdents(
157 continue; 157 continue;
158 } 158 }
159 159
160 ino = xfs_dir3_sfe_get_ino(mp, sfp, sfep); 160 ino = dp->d_ops->sf_get_ino(sfp, sfep);
161 filetype = xfs_dir3_sfe_get_ftype(mp, sfp, sfep); 161 filetype = dp->d_ops->sf_get_ftype(sfep);
162 ctx->pos = off & 0x7fffffff; 162 ctx->pos = off & 0x7fffffff;
163 if (!dir_emit(ctx, (char *)sfep->name, sfep->namelen, ino, 163 if (!dir_emit(ctx, (char *)sfep->name, sfep->namelen, ino,
164 xfs_dir3_get_dtype(mp, filetype))) 164 xfs_dir3_get_dtype(mp, filetype)))
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index 73881c9f40d6..ec0d39b5fa12 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -57,89 +57,6 @@ static void xfs_dir2_sf_toino8(xfs_da_args_t *args);
57#endif /* XFS_BIG_INUMS */ 57#endif /* XFS_BIG_INUMS */
58 58
59/* 59/*
60 * Inode numbers in short-form directories can come in two versions,
61 * either 4 bytes or 8 bytes wide. These helpers deal with the
62 * two forms transparently by looking at the headers i8count field.
63 *
64 * For 64-bit inode number the most significant byte must be zero.
65 */
66static xfs_ino_t
67xfs_dir2_sf_get_ino(
68 struct xfs_dir2_sf_hdr *hdr,
69 xfs_dir2_inou_t *from)
70{
71 if (hdr->i8count)
72 return get_unaligned_be64(&from->i8.i) & 0x00ffffffffffffffULL;
73 else
74 return get_unaligned_be32(&from->i4.i);
75}
76
77static void
78xfs_dir2_sf_put_ino(
79 struct xfs_dir2_sf_hdr *hdr,
80 xfs_dir2_inou_t *to,
81 xfs_ino_t ino)
82{
83 ASSERT((ino & 0xff00000000000000ULL) == 0);
84
85 if (hdr->i8count)
86 put_unaligned_be64(ino, &to->i8.i);
87 else
88 put_unaligned_be32(ino, &to->i4.i);
89}
90
91xfs_ino_t
92xfs_dir2_sf_get_parent_ino(
93 struct xfs_dir2_sf_hdr *hdr)
94{
95 return xfs_dir2_sf_get_ino(hdr, &hdr->parent);
96}
97
98void
99xfs_dir2_sf_put_parent_ino(
100 struct xfs_dir2_sf_hdr *hdr,
101 xfs_ino_t ino)
102{
103 xfs_dir2_sf_put_ino(hdr, &hdr->parent, ino);
104}
105
106/*
107 * In short-form directory entries the inode numbers are stored at variable
108 * offset behind the entry name. If the entry stores a filetype value, then it
109 * sits between the name and the inode number. Hence the inode numbers may only
110 * be accessed through the helpers below.
111 */
112static xfs_dir2_inou_t *
113xfs_dir3_sfe_inop(
114 struct xfs_mount *mp,
115 struct xfs_dir2_sf_entry *sfep)
116{
117 __uint8_t *ptr = &sfep->name[sfep->namelen];
118 if (xfs_sb_version_hasftype(&mp->m_sb))
119 ptr++;
120 return (xfs_dir2_inou_t *)ptr;
121}
122
123xfs_ino_t
124xfs_dir3_sfe_get_ino(
125 struct xfs_mount *mp,
126 struct xfs_dir2_sf_hdr *hdr,
127 struct xfs_dir2_sf_entry *sfep)
128{
129 return xfs_dir2_sf_get_ino(hdr, xfs_dir3_sfe_inop(mp, sfep));
130}
131
132void
133xfs_dir3_sfe_put_ino(
134 struct xfs_mount *mp,
135 struct xfs_dir2_sf_hdr *hdr,
136 struct xfs_dir2_sf_entry *sfep,
137 xfs_ino_t ino)
138{
139 xfs_dir2_sf_put_ino(hdr, xfs_dir3_sfe_inop(mp, sfep), ino);
140}
141
142/*
143 * Given a block directory (dp/block), calculate its size as a shortform (sf) 60 * Given a block directory (dp/block), calculate its size as a shortform (sf)
144 * directory and a header for the sf directory, if it will fit it the 61 * directory and a header for the sf directory, if it will fit it the
145 * space currently present in the inode. If it won't fit, the output 62 * space currently present in the inode. If it won't fit, the output
@@ -226,7 +143,7 @@ xfs_dir2_block_sfsize(
226 */ 143 */
227 sfhp->count = count; 144 sfhp->count = count;
228 sfhp->i8count = i8count; 145 sfhp->i8count = i8count;
229 xfs_dir2_sf_put_parent_ino(sfhp, parent); 146 dp->d_ops->sf_put_parent_ino(sfhp, parent);
230 return size; 147 return size;
231} 148}
232 149
@@ -321,7 +238,7 @@ xfs_dir2_block_to_sf(
321 else if (dep->namelen == 2 && 238 else if (dep->namelen == 2 &&
322 dep->name[0] == '.' && dep->name[1] == '.') 239 dep->name[0] == '.' && dep->name[1] == '.')
323 ASSERT(be64_to_cpu(dep->inumber) == 240 ASSERT(be64_to_cpu(dep->inumber) ==
324 xfs_dir2_sf_get_parent_ino(sfp)); 241 dp->d_ops->sf_get_parent_ino(sfp));
325 /* 242 /*
326 * Normal entry, copy it into shortform. 243 * Normal entry, copy it into shortform.
327 */ 244 */
@@ -331,9 +248,9 @@ xfs_dir2_block_to_sf(
331 (xfs_dir2_data_aoff_t) 248 (xfs_dir2_data_aoff_t)
332 ((char *)dep - (char *)hdr)); 249 ((char *)dep - (char *)hdr));
333 memcpy(sfep->name, dep->name, dep->namelen); 250 memcpy(sfep->name, dep->name, dep->namelen);
334 xfs_dir3_sfe_put_ino(mp, sfp, sfep, 251 dp->d_ops->sf_put_ino(sfp, sfep,
335 be64_to_cpu(dep->inumber)); 252 be64_to_cpu(dep->inumber));
336 xfs_dir3_sfe_put_ftype(mp, sfp, sfep, 253 dp->d_ops->sf_put_ftype(sfep,
337 xfs_dir3_dirent_get_ftype(mp, dep)); 254 xfs_dir3_dirent_get_ftype(mp, dep));
338 255
339 sfep = dp->d_ops->sf_nextentry(sfp, sfep); 256 sfep = dp->d_ops->sf_nextentry(sfp, sfep);
@@ -496,8 +413,8 @@ xfs_dir2_sf_addname_easy(
496 sfep->namelen = args->namelen; 413 sfep->namelen = args->namelen;
497 xfs_dir2_sf_put_offset(sfep, offset); 414 xfs_dir2_sf_put_offset(sfep, offset);
498 memcpy(sfep->name, args->name, sfep->namelen); 415 memcpy(sfep->name, args->name, sfep->namelen);
499 xfs_dir3_sfe_put_ino(dp->i_mount, sfp, sfep, args->inumber); 416 dp->d_ops->sf_put_ino(sfp, sfep, args->inumber);
500 xfs_dir3_sfe_put_ftype(dp->i_mount, sfp, sfep, args->filetype); 417 dp->d_ops->sf_put_ftype(sfep, args->filetype);
501 418
502 /* 419 /*
503 * Update the header and inode. 420 * Update the header and inode.
@@ -591,8 +508,8 @@ xfs_dir2_sf_addname_hard(
591 sfep->namelen = args->namelen; 508 sfep->namelen = args->namelen;
592 xfs_dir2_sf_put_offset(sfep, offset); 509 xfs_dir2_sf_put_offset(sfep, offset);
593 memcpy(sfep->name, args->name, sfep->namelen); 510 memcpy(sfep->name, args->name, sfep->namelen);
594 xfs_dir3_sfe_put_ino(mp, sfp, sfep, args->inumber); 511 dp->d_ops->sf_put_ino(sfp, sfep, args->inumber);
595 xfs_dir3_sfe_put_ftype(mp, sfp, sfep, args->filetype); 512 dp->d_ops->sf_put_ftype(sfep, args->filetype);
596 sfp->count++; 513 sfp->count++;
597#if XFS_BIG_INUMS 514#if XFS_BIG_INUMS
598 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange) 515 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange)
@@ -713,20 +630,19 @@ xfs_dir2_sf_check(
713 630
714 sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; 631 sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
715 offset = xfs_dir3_data_first_offset(mp); 632 offset = xfs_dir3_data_first_offset(mp);
716 ino = xfs_dir2_sf_get_parent_ino(sfp); 633 ino = dp->d_ops->sf_get_parent_ino(sfp);
717 i8count = ino > XFS_DIR2_MAX_SHORT_INUM; 634 i8count = ino > XFS_DIR2_MAX_SHORT_INUM;
718 635
719 for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp); 636 for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
720 i < sfp->count; 637 i < sfp->count;
721 i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep)) { 638 i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep)) {
722 ASSERT(xfs_dir2_sf_get_offset(sfep) >= offset); 639 ASSERT(xfs_dir2_sf_get_offset(sfep) >= offset);
723 ino = xfs_dir3_sfe_get_ino(mp, sfp, sfep); 640 ino = dp->d_ops->sf_get_ino(sfp, sfep);
724 i8count += ino > XFS_DIR2_MAX_SHORT_INUM; 641 i8count += ino > XFS_DIR2_MAX_SHORT_INUM;
725 offset = 642 offset =
726 xfs_dir2_sf_get_offset(sfep) + 643 xfs_dir2_sf_get_offset(sfep) +
727 xfs_dir3_data_entsize(mp, sfep->namelen); 644 xfs_dir3_data_entsize(mp, sfep->namelen);
728 ASSERT(xfs_dir3_sfe_get_ftype(mp, sfp, sfep) < 645 ASSERT(dp->d_ops->sf_get_ftype(sfep) < XFS_DIR3_FT_MAX);
729 XFS_DIR3_FT_MAX);
730 } 646 }
731 ASSERT(i8count == sfp->i8count); 647 ASSERT(i8count == sfp->i8count);
732 ASSERT(XFS_BIG_INUMS || i8count == 0); 648 ASSERT(XFS_BIG_INUMS || i8count == 0);
@@ -782,7 +698,7 @@ xfs_dir2_sf_create(
782 /* 698 /*
783 * Now can put in the inode number, since i8count is set. 699 * Now can put in the inode number, since i8count is set.
784 */ 700 */
785 xfs_dir2_sf_put_parent_ino(sfp, pino); 701 dp->d_ops->sf_put_parent_ino(sfp, pino);
786 sfp->count = 0; 702 sfp->count = 0;
787 dp->i_d.di_size = size; 703 dp->i_d.di_size = size;
788 xfs_dir2_sf_check(args); 704 xfs_dir2_sf_check(args);
@@ -837,7 +753,7 @@ xfs_dir2_sf_lookup(
837 */ 753 */
838 if (args->namelen == 2 && 754 if (args->namelen == 2 &&
839 args->name[0] == '.' && args->name[1] == '.') { 755 args->name[0] == '.' && args->name[1] == '.') {
840 args->inumber = xfs_dir2_sf_get_parent_ino(sfp); 756 args->inumber = dp->d_ops->sf_get_parent_ino(sfp);
841 args->cmpresult = XFS_CMP_EXACT; 757 args->cmpresult = XFS_CMP_EXACT;
842 args->filetype = XFS_DIR3_FT_DIR; 758 args->filetype = XFS_DIR3_FT_DIR;
843 return XFS_ERROR(EEXIST); 759 return XFS_ERROR(EEXIST);
@@ -857,10 +773,8 @@ xfs_dir2_sf_lookup(
857 sfep->namelen); 773 sfep->namelen);
858 if (cmp != XFS_CMP_DIFFERENT && cmp != args->cmpresult) { 774 if (cmp != XFS_CMP_DIFFERENT && cmp != args->cmpresult) {
859 args->cmpresult = cmp; 775 args->cmpresult = cmp;
860 args->inumber = xfs_dir3_sfe_get_ino(dp->i_mount, 776 args->inumber = dp->d_ops->sf_get_ino(sfp, sfep);
861 sfp, sfep); 777 args->filetype = dp->d_ops->sf_get_ftype(sfep);
862 args->filetype = xfs_dir3_sfe_get_ftype(dp->i_mount,
863 sfp, sfep);
864 if (cmp == XFS_CMP_EXACT) 778 if (cmp == XFS_CMP_EXACT)
865 return XFS_ERROR(EEXIST); 779 return XFS_ERROR(EEXIST);
866 ci_sfep = sfep; 780 ci_sfep = sfep;
@@ -919,7 +833,7 @@ xfs_dir2_sf_removename(
919 i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep)) { 833 i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep)) {
920 if (xfs_da_compname(args, sfep->name, sfep->namelen) == 834 if (xfs_da_compname(args, sfep->name, sfep->namelen) ==
921 XFS_CMP_EXACT) { 835 XFS_CMP_EXACT) {
922 ASSERT(xfs_dir3_sfe_get_ino(dp->i_mount, sfp, sfep) == 836 ASSERT(dp->d_ops->sf_get_ino(sfp, sfep) ==
923 args->inumber); 837 args->inumber);
924 break; 838 break;
925 } 839 }
@@ -1040,10 +954,10 @@ xfs_dir2_sf_replace(
1040 if (args->namelen == 2 && 954 if (args->namelen == 2 &&
1041 args->name[0] == '.' && args->name[1] == '.') { 955 args->name[0] == '.' && args->name[1] == '.') {
1042#if XFS_BIG_INUMS || defined(DEBUG) 956#if XFS_BIG_INUMS || defined(DEBUG)
1043 ino = xfs_dir2_sf_get_parent_ino(sfp); 957 ino = dp->d_ops->sf_get_parent_ino(sfp);
1044 ASSERT(args->inumber != ino); 958 ASSERT(args->inumber != ino);
1045#endif 959#endif
1046 xfs_dir2_sf_put_parent_ino(sfp, args->inumber); 960 dp->d_ops->sf_put_parent_ino(sfp, args->inumber);
1047 } 961 }
1048 /* 962 /*
1049 * Normal entry, look for the name. 963 * Normal entry, look for the name.
@@ -1054,14 +968,11 @@ xfs_dir2_sf_replace(
1054 if (xfs_da_compname(args, sfep->name, sfep->namelen) == 968 if (xfs_da_compname(args, sfep->name, sfep->namelen) ==
1055 XFS_CMP_EXACT) { 969 XFS_CMP_EXACT) {
1056#if XFS_BIG_INUMS || defined(DEBUG) 970#if XFS_BIG_INUMS || defined(DEBUG)
1057 ino = xfs_dir3_sfe_get_ino(dp->i_mount, 971 ino = dp->d_ops->sf_get_ino(sfp, sfep);
1058 sfp, sfep);
1059 ASSERT(args->inumber != ino); 972 ASSERT(args->inumber != ino);
1060#endif 973#endif
1061 xfs_dir3_sfe_put_ino(dp->i_mount, sfp, sfep, 974 dp->d_ops->sf_put_ino(sfp, sfep, args->inumber);
1062 args->inumber); 975 dp->d_ops->sf_put_ftype(sfep, args->filetype);
1063 xfs_dir3_sfe_put_ftype(dp->i_mount, sfp, sfep,
1064 args->filetype);
1065 break; 976 break;
1066 } 977 }
1067 } 978 }
@@ -1164,7 +1075,7 @@ xfs_dir2_sf_toino4(
1164 */ 1075 */
1165 sfp->count = oldsfp->count; 1076 sfp->count = oldsfp->count;
1166 sfp->i8count = 0; 1077 sfp->i8count = 0;
1167 xfs_dir2_sf_put_parent_ino(sfp, xfs_dir2_sf_get_parent_ino(oldsfp)); 1078 dp->d_ops->sf_put_parent_ino(sfp, dp->d_ops->sf_get_parent_ino(oldsfp));
1168 /* 1079 /*
1169 * Copy the entries field by field. 1080 * Copy the entries field by field.
1170 */ 1081 */
@@ -1176,10 +1087,9 @@ xfs_dir2_sf_toino4(
1176 sfep->namelen = oldsfep->namelen; 1087 sfep->namelen = oldsfep->namelen;
1177 sfep->offset = oldsfep->offset; 1088 sfep->offset = oldsfep->offset;
1178 memcpy(sfep->name, oldsfep->name, sfep->namelen); 1089 memcpy(sfep->name, oldsfep->name, sfep->namelen);
1179 xfs_dir3_sfe_put_ino(mp, sfp, sfep, 1090 dp->d_ops->sf_put_ino(sfp, sfep,
1180 xfs_dir3_sfe_get_ino(mp, oldsfp, oldsfep)); 1091 dp->d_ops->sf_get_ino(oldsfp, oldsfep));
1181 xfs_dir3_sfe_put_ftype(mp, sfp, sfep, 1092 dp->d_ops->sf_put_ftype(sfep, dp->d_ops->sf_get_ftype(oldsfep));
1182 xfs_dir3_sfe_get_ftype(mp, oldsfp, oldsfep));
1183 } 1093 }
1184 /* 1094 /*
1185 * Clean up the inode. 1095 * Clean up the inode.
@@ -1243,7 +1153,7 @@ xfs_dir2_sf_toino8(
1243 */ 1153 */
1244 sfp->count = oldsfp->count; 1154 sfp->count = oldsfp->count;
1245 sfp->i8count = 1; 1155 sfp->i8count = 1;
1246 xfs_dir2_sf_put_parent_ino(sfp, xfs_dir2_sf_get_parent_ino(oldsfp)); 1156 dp->d_ops->sf_put_parent_ino(sfp, dp->d_ops->sf_get_parent_ino(oldsfp));
1247 /* 1157 /*
1248 * Copy the entries field by field. 1158 * Copy the entries field by field.
1249 */ 1159 */
@@ -1255,10 +1165,9 @@ xfs_dir2_sf_toino8(
1255 sfep->namelen = oldsfep->namelen; 1165 sfep->namelen = oldsfep->namelen;
1256 sfep->offset = oldsfep->offset; 1166 sfep->offset = oldsfep->offset;
1257 memcpy(sfep->name, oldsfep->name, sfep->namelen); 1167 memcpy(sfep->name, oldsfep->name, sfep->namelen);
1258 xfs_dir3_sfe_put_ino(mp, sfp, sfep, 1168 dp->d_ops->sf_put_ino(sfp, sfep,
1259 xfs_dir3_sfe_get_ino(mp, oldsfp, oldsfep)); 1169 dp->d_ops->sf_get_ino(oldsfp, oldsfep));
1260 xfs_dir3_sfe_put_ftype(mp, sfp, sfep, 1170 dp->d_ops->sf_put_ftype(sfep, dp->d_ops->sf_get_ftype(oldsfep));
1261 xfs_dir3_sfe_get_ftype(mp, oldsfp, oldsfep));
1262 } 1171 }
1263 /* 1172 /*
1264 * Clean up the inode. 1173 * Clean up the inode.