diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-31 15:38:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-23 05:13:06 -0400 |
commit | d88f1833fcbb5663c86253039966f880f8f46b1a (patch) | |
tree | c21458082d33ed4557f81f9b399d20e1c9b270e4 /fs/xfs | |
parent | 14f7dd632011bb89c035722edd6ea0d90ca6b078 (diff) |
[PATCH] Remove XFS buffered readdir hack
Now that we've moved the readdir hack to the nfsd code, we can
remove the local version from the XFS code.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 5311c1acdd40..3fee790f138b 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -204,15 +204,6 @@ xfs_file_fsync( | |||
204 | return -xfs_fsync(XFS_I(dentry->d_inode)); | 204 | return -xfs_fsync(XFS_I(dentry->d_inode)); |
205 | } | 205 | } |
206 | 206 | ||
207 | /* | ||
208 | * Unfortunately we can't just use the clean and simple readdir implementation | ||
209 | * below, because nfs might call back into ->lookup from the filldir callback | ||
210 | * and that will deadlock the low-level btree code. | ||
211 | * | ||
212 | * Hopefully we'll find a better workaround that allows to use the optimal | ||
213 | * version at least for local readdirs for 2.6.25. | ||
214 | */ | ||
215 | #if 0 | ||
216 | STATIC int | 207 | STATIC int |
217 | xfs_file_readdir( | 208 | xfs_file_readdir( |
218 | struct file *filp, | 209 | struct file *filp, |
@@ -244,125 +235,6 @@ xfs_file_readdir( | |||
244 | return -error; | 235 | return -error; |
245 | return 0; | 236 | return 0; |
246 | } | 237 | } |
247 | #else | ||
248 | |||
249 | struct hack_dirent { | ||
250 | u64 ino; | ||
251 | loff_t offset; | ||
252 | int namlen; | ||
253 | unsigned int d_type; | ||
254 | char name[]; | ||
255 | }; | ||
256 | |||
257 | struct hack_callback { | ||
258 | char *dirent; | ||
259 | size_t len; | ||
260 | size_t used; | ||
261 | }; | ||
262 | |||
263 | STATIC int | ||
264 | xfs_hack_filldir( | ||
265 | void *__buf, | ||
266 | const char *name, | ||
267 | int namlen, | ||
268 | loff_t offset, | ||
269 | u64 ino, | ||
270 | unsigned int d_type) | ||
271 | { | ||
272 | struct hack_callback *buf = __buf; | ||
273 | struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + buf->used); | ||
274 | unsigned int reclen; | ||
275 | |||
276 | reclen = ALIGN(sizeof(struct hack_dirent) + namlen, sizeof(u64)); | ||
277 | if (buf->used + reclen > buf->len) | ||
278 | return -EINVAL; | ||
279 | |||
280 | de->namlen = namlen; | ||
281 | de->offset = offset; | ||
282 | de->ino = ino; | ||
283 | de->d_type = d_type; | ||
284 | memcpy(de->name, name, namlen); | ||
285 | buf->used += reclen; | ||
286 | return 0; | ||
287 | } | ||
288 | |||
289 | STATIC int | ||
290 | xfs_file_readdir( | ||
291 | struct file *filp, | ||
292 | void *dirent, | ||
293 | filldir_t filldir) | ||
294 | { | ||
295 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
296 | xfs_inode_t *ip = XFS_I(inode); | ||
297 | struct hack_callback buf; | ||
298 | struct hack_dirent *de; | ||
299 | int error; | ||
300 | loff_t size; | ||
301 | int eof = 0; | ||
302 | xfs_off_t start_offset, curr_offset, offset; | ||
303 | |||
304 | /* | ||
305 | * Try fairly hard to get memory | ||
306 | */ | ||
307 | buf.len = PAGE_CACHE_SIZE; | ||
308 | do { | ||
309 | buf.dirent = kmalloc(buf.len, GFP_KERNEL); | ||
310 | if (buf.dirent) | ||
311 | break; | ||
312 | buf.len >>= 1; | ||
313 | } while (buf.len >= 1024); | ||
314 | |||
315 | if (!buf.dirent) | ||
316 | return -ENOMEM; | ||
317 | |||
318 | curr_offset = filp->f_pos; | ||
319 | if (curr_offset == 0x7fffffff) | ||
320 | offset = 0xffffffff; | ||
321 | else | ||
322 | offset = filp->f_pos; | ||
323 | |||
324 | while (!eof) { | ||
325 | unsigned int reclen; | ||
326 | |||
327 | start_offset = offset; | ||
328 | |||
329 | buf.used = 0; | ||
330 | error = -xfs_readdir(ip, &buf, buf.len, &offset, | ||
331 | xfs_hack_filldir); | ||
332 | if (error || offset == start_offset) { | ||
333 | size = 0; | ||
334 | break; | ||
335 | } | ||
336 | |||
337 | size = buf.used; | ||
338 | de = (struct hack_dirent *)buf.dirent; | ||
339 | while (size > 0) { | ||
340 | curr_offset = de->offset /* & 0x7fffffff */; | ||
341 | if (filldir(dirent, de->name, de->namlen, | ||
342 | curr_offset & 0x7fffffff, | ||
343 | de->ino, de->d_type)) { | ||
344 | goto done; | ||
345 | } | ||
346 | |||
347 | reclen = ALIGN(sizeof(struct hack_dirent) + de->namlen, | ||
348 | sizeof(u64)); | ||
349 | size -= reclen; | ||
350 | de = (struct hack_dirent *)((char *)de + reclen); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | done: | ||
355 | if (!error) { | ||
356 | if (size == 0) | ||
357 | filp->f_pos = offset & 0x7fffffff; | ||
358 | else if (de) | ||
359 | filp->f_pos = curr_offset; | ||
360 | } | ||
361 | |||
362 | kfree(buf.dirent); | ||
363 | return error; | ||
364 | } | ||
365 | #endif | ||
366 | 238 | ||
367 | STATIC int | 239 | STATIC int |
368 | xfs_file_mmap( | 240 | xfs_file_mmap( |