xfs: report zeroed or not correctly in xfs_zero_range()
PATCH 1/2 xfs: report zeroed or not correctly in xfs_zero_range()
The 'did_zero' param of xfs_zero_range() was not passed to iomap_zero_range() correctly. This was introduced by commit 7bb41db3ea16 ("xfs: handle 64-bit length in xfs_iozero"), and found by code inspection.
--- fs/xfs/xfs_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_file.c +1 -1
@@ -58,7 +58,7 @@ xfs_zero_range(xfs_off_t count, bool *did_zero) { - return iomap_zero_range(VFS_I(ip), pos, count, NULL, &xfs_iomap_ops); + return iomap_zero_range(VFS_I(ip), pos, count, did_zero, &xfs_iomap_ops); }int
Signature · 1 line
2.13.5
PATCH 2/2 xfs: kill meaningless variable 'zero'
In xfs_file_aio_write_checks(), variable 'zero' is there only to satisfy xfs_zero_eof(), the result of it is ignored. Now, with iomap_zero_range() based xfs_zero_eof(), we can safely pass NULL as the last param of it and kill 'zero'.
--- fs/xfs/xfs_file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/xfs/xfs_file.c +1 -3
@@ -373,8 +373,6 @@ xfs_file_aio_write_checks(*/ spin_lock (&ip->i_flags_lock);if (iocb->ki_pos >i_size_read (inode)) { -bool zero = false; -spin_unlock (&ip->i_flags_lock);if (!drained_dio) {if (*iolock ==XFS_IOLOCK_SHARED ) {
@@ -395,7 +393,7 @@ xfs_file_aio_write_checks( drained_dio = true; goto restart; } - error =xfs_zero_eof (ip, iocb->ki_pos,i_size_read (inode), &zero); + error =xfs_zero_eof (ip, iocb->ki_pos,i_size_read (inode),NULL );if (error)return error; }else
Signature · 1 line
2.13.5
Re: [PATCH 2/2] xfs: kill meaningless variable 'zero'
Quoted 5 lines · Eryu Guan
In
xfs_file_aio_write_checks(), variable 'zero' is there only to satisfyxfs_zero_eof(), the result of it is ignored. Now, withiomap_zero_range()basedxfs_zero_eof(), we can safely pass NULL as the last param of it and kill 'zero'.
Looks good to me, you can add:
Quoted 34 lines
Signed-off-by Eryu Guan <[email protected]>--- fs/xfs/xfs_file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/xfs/xfs_file.c +1
-3@@ -373,8 +373,6 @@ xfs_file_aio_write_checks(*/ spin_lock (&ip->i_flags_lock);if (iocb->ki_pos >i_size_read (inode)) { -bool zero = false; -spin_unlock (&ip->i_flags_lock);if (!drained_dio) {if (*iolock ==XFS_IOLOCK_SHARED ) {@@ -395,7 +393,7 @@ xfs_file_aio_write_checks( drained_dio = true; goto restart; } - error =xfs_zero_eof (ip, iocb->ki_pos,i_size_read (inode), &zero); + error =xfs_zero_eof (ip, iocb->ki_pos,i_size_read (inode),NULL );if (error)return error; }else Signature · 6 lines
2.13.5 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Carlos
Re: [PATCH 2/2] xfs: kill meaningless variable 'zero'
In reply to Eryu GuanLooks good,
Quoted 5 lines · Eryu Guan
The '
did_zero' param ofxfs_zero_range()was not passed toiomap_zero_range()correctly. This was introduced by commit7bb41db3ea16("xfs: handle 64-bit length inxfs_iozero"), and found by code inspection.
Looks good,
Quoted 25 lines
Signed-off-by Eryu Guan <[email protected]>--- fs/xfs/xfs_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_file.c +1
-1@@ -58,7 +58,7 @@ xfs_zero_range(xfs_off_t count, bool *did_zero) { - return iomap_zero_range(VFS_I(ip), pos, count, NULL, &xfs_iomap_ops); + return iomap_zero_range(VFS_I(ip), pos, count, did_zero, &xfs_iomap_ops); }int Signature · 6 lines
2.13.5 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Carlos
Quoted 4 lines · Eryu Guan
The '
did_zero' param ofxfs_zero_range()was not passed toiomap_zero_range()correctly. This was introduced by commit7bb41db3ea16("xfs: handle 64-bit length inxfs_iozero"), and found by code inspection.
Looks good. Although this makes me wonder why we pass the argument at all, given that it doesn't seem to matter :)
Joking aside: xfs_setattr_size seems to care to write out the buffer cache zeroed byes, so this looks good to me:
Quoted 6 lines · Eryu Guan
The '
did_zero' param ofxfs_zero_range()was not passed toiomap_zero_range()correctly. This was introduced by commit7bb41db3ea16("xfs: handle 64-bit length inxfs_iozero"), and found by code inspection.Signed-off-by Eryu Guan <[email protected]>
Both look ok,
Quoted 24 lines
--- fs/xfs/xfs_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_file.c +1
-1@@ -58,7 +58,7 @@ xfs_zero_range(xfs_off_t count, bool *did_zero) { - return iomap_zero_range(VFS_I(ip), pos, count, NULL, &xfs_iomap_ops); + return iomap_zero_range(VFS_I(ip), pos, count, did_zero, &xfs_iomap_ops); }int Signature · 6 lines
2.13.5 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html