From 44ab23b9b3c7a73c738b37a8f5f84adb7d66c267 Mon Sep 17 00:00:00 2001 From: "Matthew Wilcox (Oracle)" Date: Thu, 3 Mar 2022 13:43:29 -0500 Subject: ntfs3: Call ntfs_write_begin() and ntfs_write_end() directly There is only one kind of write_begin/write_end aops, so we don't need to look up which aop it is, just make ntfs_write_begin() and ntfs_write_end() available to this file and call them directly. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Namjae Jeon Reviewed-by: Christoph Hellwig --- fs/ntfs3/file.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'fs/ntfs3/file.c') diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 787b53b984ee..c2e7e561958a 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -157,15 +157,14 @@ static int ntfs_extend_initialized_size(struct file *file, if (pos + len > new_valid) len = new_valid - pos; - err = pagecache_write_begin(file, mapping, pos, len, 0, &page, - &fsdata); + err = ntfs_write_begin(file, mapping, pos, len, &page, &fsdata); if (err) goto out; zero_user_segment(page, zerofrom, PAGE_SIZE); /* This function in any case puts page. */ - err = pagecache_write_end(file, mapping, pos, len, len, page, + err = ntfs_write_end(file, mapping, pos, len, len, page, fsdata); if (err < 0) goto out; -- cgit v1.2.3 From 652118b8c979e7f21358016b5568aac4b25c64d9 Mon Sep 17 00:00:00 2001 From: "Matthew Wilcox (Oracle)" Date: Sun, 8 May 2022 14:40:32 -0400 Subject: ntfs3: Remove fsdata parameter from ntfs_extend_initialized_size() After the last patch, Smatch reports: fs/ntfs3/file.c:168 ntfs_extend_initialized_size() error: uninitialized symbol 'fsdata'. fsdata is indeed unused. This is not new, but Smatch couldn't see it before because calls through pagecache_write_begin()/pagecache_write_end() could theoretically call any implemention of ->write_begin/write_end, some of which do use fsdata. Now that the calls are direct, Smatch can see they're never used. Fix this by simply passing NULL. While ntfs3 does pass this parameter on to generic functions, those generic functions also never dereference the fsdata parameter, so it's unnecessary to pass the address of a real pointer. Reported-by: Dan Carpenter Signed-off-by: Matthew Wilcox (Oracle) --- fs/ntfs3/file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs/ntfs3/file.c') diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index c2e7e561958a..e61f335c9c63 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -115,7 +115,6 @@ static int ntfs_extend_initialized_size(struct file *file, for (;;) { u32 zerofrom, len; struct page *page; - void *fsdata; u8 bits; CLST vcn, lcn, clen; @@ -157,15 +156,14 @@ static int ntfs_extend_initialized_size(struct file *file, if (pos + len > new_valid) len = new_valid - pos; - err = ntfs_write_begin(file, mapping, pos, len, &page, &fsdata); + err = ntfs_write_begin(file, mapping, pos, len, &page, NULL); if (err) goto out; zero_user_segment(page, zerofrom, PAGE_SIZE); /* This function in any case puts page. */ - err = ntfs_write_end(file, mapping, pos, len, len, page, - fsdata); + err = ntfs_write_end(file, mapping, pos, len, len, page, NULL); if (err < 0) goto out; pos += len; -- cgit v1.2.3