summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-10-13 18:01:33 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-10-26 10:44:17 +0200
commite97a3c4c6f0af13fa48e251348f98881d82b5135 (patch)
tree162f24c973ce5d134e5f43081c782bb9aa9adf18 /fs/f2fs
parent0c5e36db17f5fe3dda8c5584f5f530152409a3f3 (diff)
downloadlinux-stable-e97a3c4c6f0af13fa48e251348f98881d82b5135.tar.gz
linux-stable-e97a3c4c6f0af13fa48e251348f98881d82b5135.tar.bz2
linux-stable-e97a3c4c6f0af13fa48e251348f98881d82b5135.zip
f2fs: trace f2fs_readdir
This patch adds trace for f2fs_readdir. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/dir.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index c0c933ad43c8..148927f5bc93 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -14,6 +14,7 @@
#include "node.h"
#include "acl.h"
#include "xattr.h"
+#include <trace/events/f2fs.h>
static unsigned long dir_blocks(struct inode *inode)
{
@@ -847,6 +848,7 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
struct f2fs_dentry_block *dentry_blk = NULL;
struct page *dentry_page = NULL;
struct file_ra_state *ra = &file->f_ra;
+ loff_t start_pos = ctx->pos;
unsigned int n = ((unsigned long)ctx->pos / NR_DENTRY_IN_BLOCK);
struct f2fs_dentry_ptr d;
struct fscrypt_str fstr = FSTR_INIT(NULL, 0);
@@ -855,16 +857,16 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
if (f2fs_encrypted_inode(inode)) {
err = fscrypt_get_encryption_info(inode);
if (err && err != -ENOKEY)
- return err;
+ goto out;
err = fscrypt_fname_alloc_buffer(inode, F2FS_NAME_LEN, &fstr);
if (err < 0)
- return err;
+ goto out;
}
if (f2fs_has_inline_dentry(inode)) {
err = f2fs_read_inline_dir(file, ctx, &fstr);
- goto out;
+ goto out_free;
}
/* readahead for multi pages of dir */
@@ -880,7 +882,7 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
err = 0;
continue;
} else {
- goto out;
+ goto out_free;
}
}
@@ -900,8 +902,10 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
kunmap(dentry_page);
f2fs_put_page(dentry_page, 1);
}
-out:
+out_free:
fscrypt_fname_free_buffer(&fstr);
+out:
+ trace_f2fs_readdir(inode, start_pos, ctx->pos, err);
return err < 0 ? err : 0;
}