Skip to contentSkip to conversation

f2fs: fix an error return value in truncate_partial_data_page

PATCH In review Yunlei He 3 participants 5 messages Feb 28, 2017 – Mar 2, 2017 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 f2fs: fix an error return value in truncate_partial_data_page

This patch fix a error return value in truncate_partial_data_page

---
 fs/f2fs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/file.c +1 -1
index c6ca00c..c186d75 100644
@@ -529,7 +529,7 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
 
 	page = get_lock_data_page(inode, index, true);
 	if (IS_ERR(page))
-		return 0;
+		return page;
 truncate_out:
 	f2fs_wait_on_page_writeback(page, DATA, true);
 	zero_user(page, offset, PAGE_SIZE - offset);
Signature · 6 lines
2.10.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
#1 lore raw
Quoted 12 lines · Yunlei He

This patch fix a error return value in truncate_partial_data_page

---
 fs/f2fs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/file.c +0 -0
index c6ca00c..c186d75 100644

fs/f2fs/file.c static int truncate_partial_data_page(struct inode *inode, u64 from, · line 532

Quoted 5 lines
fs/f2fs/file.c +1 -1
@@ -529,7 +529,7 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
 
 	page = get_lock_data_page(inode, index, true);
 	if (IS_ERR(page))
-		return 0;
+		return page;

return PTR_ERR(page);

Thanks,

fs/f2fs/file.c static int truncate_partial_data_page(struct inode *inode, u64 from, · line 535

Quoted 4 lines
fs/f2fs/file.c +0 -0
 truncate_out:
 	f2fs_wait_on_page_writeback(page, DATA, true);
 	zero_user(page, offset, PAGE_SIZE - offset);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

maintainer
#2 lore raw
Quoted 14 lines · Chao Yu
Quoted 13 lines · Yunlei He

This patch fix a error return value in truncate_partial_data_page

---
 fs/f2fs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/file.c +0 -0
index c6ca00c..c186d75 100644
@@ -529,7 +529,7 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
 
Quoted 6 lines

fs/f2fs/file.c static int truncate_partial_data_page(struct inode *inode, u64 from, · line 532

Quoted 4 lines
fs/f2fs/file.c +1 -1
 	page = get_lock_data_page(inode, index, true);
 	if (IS_ERR(page))
-		return 0;
+		return page;

return PTR_ERR(page);

Do we need this?

return PTR_ERR(page) == -ENOENT ? 0 : PTR_ERR(page);

Thanks,

Quoted 7 lines

Thanks,

Quoted 4 lines
fs/f2fs/file.c +0 -0
 truncate_out:
 	f2fs_wait_on_page_writeback(page, DATA, true);
 	zero_user(page, offset, PAGE_SIZE - offset);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

#3 lore raw
Quoted 22 lines · Jaegeuk Kim
Quoted 14 lines · Chao Yu
Quoted 13 lines · Yunlei He

This patch fix a error return value in truncate_partial_data_page

---
 fs/f2fs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/file.c +0 -0
index c6ca00c..c186d75 100644
@@ -529,7 +529,7 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
 
Quoted 6 lines

fs/f2fs/file.c static int truncate_partial_data_page(struct inode *inode, u64 from, · line 532

Quoted 4 lines
fs/f2fs/file.c +1 -1
 	page = get_lock_data_page(inode, index, true);
 	if (IS_ERR(page))
-		return 0;
+		return page;

return PTR_ERR(page);

Quoted 3 lines

Do we need this?

return PTR_ERR(page) == -ENOENT ? 0 : PTR_ERR(page);

Oh, right, agreed. :)

Thanks,

Quoted 4 lines

Thanks,

Quoted 1 line
Quoted 9 lines
Quoted 6 lines

Thanks,

Quoted 4 lines
fs/f2fs/file.c +0 -0
 truncate_out:
 	f2fs_wait_on_page_writeback(page, DATA, true);
 	zero_user(page, offset, PAGE_SIZE - offset);

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

author
#4 lore raw
In reply to Jaegeuk Kim

Hi Jaegeuk,

Quoted 15 lines · Jaegeuk Kim
Quoted 14 lines · Chao Yu
Quoted 13 lines · Yunlei He

This patch fix a error return value in truncate_partial_data_page

---
 fs/f2fs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/file.c +0 -0
index c6ca00c..c186d75 100644
@@ -529,7 +529,7 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
 
Quoted 8 lines
Quoted 6 lines

fs/f2fs/file.c static int truncate_partial_data_page(struct inode *inode, u64 from, · line 532

Quoted 4 lines
fs/f2fs/file.c +1 -1
 	page = get_lock_data_page(inode, index, true);
 	if (IS_ERR(page))
-		return 0;
+		return page;

return PTR_ERR(page);

Do we need this?

Yes, you are right, we need this if file has holes.

Thanks.

Quoted 6 lines

return PTR_ERR(page) == -ENOENT ? 0 : PTR_ERR(page);

Thanks,

Quoted 1 line
Quoted 9 lines
Quoted 6 lines

Thanks,

Quoted 4 lines
fs/f2fs/file.c +0 -0
 truncate_out:
 	f2fs_wait_on_page_writeback(page, DATA, true);
 	zero_user(page, offset, PAGE_SIZE - offset);

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot