Skip to content

Commit ccf7cf9

Browse files
ebiggersJaegeuk Kim
authored andcommitted
f2fs: fix the f2fs_file_write_iter tracepoint
Pass in the original position and count rather than the position and count that were updated by the write. Also use the correct types for all arguments, in particular the file offset which was being truncated to 32 bits on 32-bit platforms. Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent d4dd19e commit ccf7cf9

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

fs/f2fs/file.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,6 +4312,8 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
43124312
{
43134313
struct file *file = iocb->ki_filp;
43144314
struct inode *inode = file_inode(file);
4315+
const loff_t orig_pos = iocb->ki_pos;
4316+
const size_t orig_count = iov_iter_count(from);
43154317
loff_t target_size;
43164318
int preallocated;
43174319
ssize_t ret;
@@ -4392,8 +4394,7 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
43924394
out_unlock:
43934395
inode_unlock(inode);
43944396
out:
4395-
trace_f2fs_file_write_iter(inode, iocb->ki_pos,
4396-
iov_iter_count(from), ret);
4397+
trace_f2fs_file_write_iter(inode, orig_pos, orig_count, ret);
43974398
if (ret > 0)
43984399
ret = generic_write_sync(iocb, ret);
43994400
return ret;

include/trace/events/f2fs.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,17 +540,17 @@ TRACE_EVENT(f2fs_truncate_partial_nodes,
540540

541541
TRACE_EVENT(f2fs_file_write_iter,
542542

543-
TP_PROTO(struct inode *inode, unsigned long offset,
544-
unsigned long length, int ret),
543+
TP_PROTO(struct inode *inode, loff_t offset, size_t length,
544+
ssize_t ret),
545545

546546
TP_ARGS(inode, offset, length, ret),
547547

548548
TP_STRUCT__entry(
549549
__field(dev_t, dev)
550550
__field(ino_t, ino)
551-
__field(unsigned long, offset)
552-
__field(unsigned long, length)
553-
__field(int, ret)
551+
__field(loff_t, offset)
552+
__field(size_t, length)
553+
__field(ssize_t, ret)
554554
),
555555

556556
TP_fast_assign(
@@ -562,7 +562,7 @@ TRACE_EVENT(f2fs_file_write_iter,
562562
),
563563

564564
TP_printk("dev = (%d,%d), ino = %lu, "
565-
"offset = %lu, length = %lu, written(err) = %d",
565+
"offset = %lld, length = %zu, written(err) = %zd",
566566
show_dev_ino(__entry),
567567
__entry->offset,
568568
__entry->length,

0 commit comments

Comments
 (0)