mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 22:52:35 +02:00
f2fs: allow readdir() to be interrupted
This patch follows ext4 to allow readdir() in large empty directory to
be interrupted. Referenced commit of ext4: 1f60fbe727 ("ext4: allow
readdir()'s of large empty directories to be interrupted").
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
2b903fe94c
commit
c8be47b540
|
|
@ -10,6 +10,7 @@
|
||||||
*/
|
*/
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <linux/f2fs_fs.h>
|
#include <linux/f2fs_fs.h>
|
||||||
|
#include <linux/sched.h>
|
||||||
#include "f2fs.h"
|
#include "f2fs.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "acl.h"
|
#include "acl.h"
|
||||||
|
|
@ -875,6 +876,14 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
|
||||||
min(npages - n, (pgoff_t)MAX_DIR_RA_PAGES));
|
min(npages - n, (pgoff_t)MAX_DIR_RA_PAGES));
|
||||||
|
|
||||||
for (; n < npages; n++) {
|
for (; n < npages; n++) {
|
||||||
|
|
||||||
|
/* allow readdir() to be interrupted */
|
||||||
|
if (fatal_signal_pending(current)) {
|
||||||
|
err = -ERESTARTSYS;
|
||||||
|
goto out_free;
|
||||||
|
}
|
||||||
|
cond_resched();
|
||||||
|
|
||||||
dentry_page = get_lock_data_page(inode, n, false);
|
dentry_page = get_lock_data_page(inode, n, false);
|
||||||
if (IS_ERR(dentry_page)) {
|
if (IS_ERR(dentry_page)) {
|
||||||
err = PTR_ERR(dentry_page);
|
err = PTR_ERR(dentry_page);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user