Skip to contentSkip to conversation

fs: clean up __block_commit_write

PATCH Superseded Bob Peterson 2 participants 3 messages Feb 11, 2020 – Feb 13, 2020 1 message not in the archive VFS

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 fs: clean up __block_commit_write

In reply to a message not in the archive

Hi,

Function __block_commit_write did nothing with the inode passed in and it always returned 0. This patch changes it to a void and gets rid of the overhead needed to pass in the inode.

---
 fs/buffer.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
fs/buffer.c +3 -7
index b8d28370cfd7..19bfc86e6a8f 100644
@@ -2059,8 +2059,7 @@ int __block_write_begin(struct page *page, loff_t pos, unsigned len,
 }
 EXPORT_SYMBOL(__block_write_begin);
 
-static int __block_commit_write(struct inode *inode, struct page *page,
-		unsigned from, unsigned to)
+static void __block_commit_write(struct page *page, unsigned from, unsigned to)
 {
 	unsigned block_start, block_end;
 	int partial = 0;
@@ -2094,7 +2093,6 @@ static int __block_commit_write(struct inode *inode, struct page *page,
 	 */
 	if (!partial)
 		SetPageUptodate(page);
-	return 0;
 }
 
 /*
@@ -2130,7 +2128,6 @@ int block_write_end(struct file *file, struct address_space *mapping,
 			loff_t pos, unsigned len, unsigned copied,
 			struct page *page, void *fsdata)
 {
-	struct inode *inode = mapping->host;
 	unsigned start;
 
 	start = pos & (PAGE_SIZE - 1);
@@ -2156,7 +2153,7 @@ int block_write_end(struct file *file, struct address_space *mapping,
 	flush_dcache_page(page);
 
 	/* This could be a short (even 0-length) commit */
-	__block_commit_write(inode, page, start, start+copied);
+	__block_commit_write(page, start, start+copied);
 
 	return copied;
 }
@@ -2469,8 +2466,7 @@ EXPORT_SYMBOL(cont_write_begin);
 
 int block_commit_write(struct page *page, unsigned from, unsigned to)
 {
-	struct inode *inode = page->mapping->host;
-	__block_commit_write(inode,page,from,to);
+	__block_commit_write(page, from, to);
 	return 0;
 }
 EXPORT_SYMBOL(block_commit_write);
Reviewed-by on v1 1/1
#2 lore raw

fs/buffer.c int block_write_end(struct file *file, struct address_space *mapping, · line 2156

Quoted 2 lines
fs/buffer.c +1 -1
-	__block_commit_write(inode, page, start, start+copied);
+	__block_commit_write(page, start, start+copied);

Please throew in the missing whitespaces around the + here.

Otherwise looks fine:

#3 lore raw

PATCH v2 1/1 fs: clean up __block_commit_write

In reply to Bob Peterson

Al,

Can you add this to your tree then? (Christoph's suggestion has been implemented).

Bob

Function __block_commit_write did nothing with the inode passed in and it always returned 0. This patch changes it to a void and gets rid of the overhead needed to pass in the inode.

---
 fs/buffer.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
fs/buffer.c +3 -7
index b8d28370cfd7..07e0a327be4a 100644
@@ -2059,8 +2059,7 @@ int __block_write_begin(struct page *page, loff_t pos, unsigned len,
 }
 EXPORT_SYMBOL(__block_write_begin);
 
-static int __block_commit_write(struct inode *inode, struct page *page,
-		unsigned from, unsigned to)
+static void __block_commit_write(struct page *page, unsigned from, unsigned to)
 {
 	unsigned block_start, block_end;
 	int partial = 0;
@@ -2094,7 +2093,6 @@ static int __block_commit_write(struct inode *inode, struct page *page,
 	 */
 	if (!partial)
 		SetPageUptodate(page);
-	return 0;
 }
 
 /*
@@ -2130,7 +2128,6 @@ int block_write_end(struct file *file, struct address_space *mapping,
 			loff_t pos, unsigned len, unsigned copied,
 			struct page *page, void *fsdata)
 {
-	struct inode *inode = mapping->host;
 	unsigned start;
 
 	start = pos & (PAGE_SIZE - 1);
@@ -2156,7 +2153,7 @@ int block_write_end(struct file *file, struct address_space *mapping,
 	flush_dcache_page(page);
 
 	/* This could be a short (even 0-length) commit */
-	__block_commit_write(inode, page, start, start+copied);
+	__block_commit_write(page, start, start + copied);
 
 	return copied;
 }
@@ -2469,8 +2466,7 @@ EXPORT_SYMBOL(cont_write_begin);
 
 int block_commit_write(struct page *page, unsigned from, unsigned to)
 {
-	struct inode *inode = page->mapping->host;
-	__block_commit_write(inode,page,from,to);
+	__block_commit_write(page, from, to);
 	return 0;
 }
 EXPORT_SYMBOL(block_commit_write);