* [PATCH 0/3] fs/ntfs3: Deadcoding
@ 2025-02-19 1:45 linux
2025-02-19 1:45 ` [PATCH 1/3] fs/ntfs3: Remove unused ni_load_attr linux
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: linux @ 2025-02-19 1:45 UTC (permalink / raw)
To: almaz.alexandrovich, ntfs3; +Cc: linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
Hi,
This is a small set of deadcode removal;
whole functions that haven't been called.
Note the last one in the set has a commented
out call which makes me a little suspicious what the intent
is.
Dave
Dr. David Alan Gilbert (3):
fs/ntfs3: Remove unused ni_load_attr
fs/ntfs3: Remove unused ntfs_sb_read
fs/ntfs3: Remove unused ntfs_flush_inodes
fs/ntfs3/frecord.c | 57 ----------------------------------------------
fs/ntfs3/fsntfs.c | 28 -----------------------
fs/ntfs3/inode.c | 40 --------------------------------
fs/ntfs3/ntfs_fs.h | 6 -----
4 files changed, 131 deletions(-)
--
2.48.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] fs/ntfs3: Remove unused ni_load_attr
2025-02-19 1:45 [PATCH 0/3] fs/ntfs3: Deadcoding linux
@ 2025-02-19 1:45 ` linux
2025-02-19 1:45 ` [PATCH 2/3] fs/ntfs3: Remove unused ntfs_sb_read linux
2025-02-19 1:45 ` [PATCH 3/3] fs/ntfs3: Remove unused ntfs_flush_inodes linux
2 siblings, 0 replies; 4+ messages in thread
From: linux @ 2025-02-19 1:45 UTC (permalink / raw)
To: almaz.alexandrovich, ntfs3; +Cc: linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
ni_load_attr() was added in 2021 by
commit 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
but hasn't been used.
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
fs/ntfs3/frecord.c | 57 ----------------------------------------------
fs/ntfs3/ntfs_fs.h | 3 ---
2 files changed, 60 deletions(-)
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 5df6a0b5add9..d227f9923290 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -280,63 +280,6 @@ struct ATTRIB *ni_enum_attr_ex(struct ntfs_inode *ni, struct ATTRIB *attr,
return rec_find_attr_le(ni, mi2, le2);
}
-/*
- * ni_load_attr - Load attribute that contains given VCN.
- */
-struct ATTRIB *ni_load_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
- const __le16 *name, u8 name_len, CLST vcn,
- struct mft_inode **pmi)
-{
- struct ATTR_LIST_ENTRY *le;
- struct ATTRIB *attr;
- struct mft_inode *mi;
- struct ATTR_LIST_ENTRY *next;
-
- if (!ni->attr_list.size) {
- if (pmi)
- *pmi = &ni->mi;
- return mi_find_attr(ni, &ni->mi, NULL, type, name, name_len,
- NULL);
- }
-
- le = al_find_ex(ni, NULL, type, name, name_len, NULL);
- if (!le)
- return NULL;
-
- /*
- * Unfortunately ATTR_LIST_ENTRY contains only start VCN.
- * So to find the ATTRIB segment that contains 'vcn' we should
- * enumerate some entries.
- */
- if (vcn) {
- for (;; le = next) {
- next = al_find_ex(ni, le, type, name, name_len, NULL);
- if (!next || le64_to_cpu(next->vcn) > vcn)
- break;
- }
- }
-
- if (ni_load_mi(ni, le, &mi))
- return NULL;
-
- if (pmi)
- *pmi = mi;
-
- attr = mi_find_attr(ni, mi, NULL, type, name, name_len, &le->id);
- if (!attr)
- return NULL;
-
- if (!attr->non_res)
- return attr;
-
- if (le64_to_cpu(attr->nres.svcn) <= vcn &&
- vcn <= le64_to_cpu(attr->nres.evcn))
- return attr;
-
- _ntfs_bad_inode(&ni->vfs_inode);
- return NULL;
-}
-
/*
* ni_load_all_mi - Load all subrecords.
*/
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 382820464dee..2034dca90a5e 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -530,9 +530,6 @@ struct ATTRIB *ni_find_attr(struct ntfs_inode *ni, struct ATTRIB *attr,
struct ATTRIB *ni_enum_attr_ex(struct ntfs_inode *ni, struct ATTRIB *attr,
struct ATTR_LIST_ENTRY **le,
struct mft_inode **mi);
-struct ATTRIB *ni_load_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
- const __le16 *name, u8 name_len, CLST vcn,
- struct mft_inode **pmi);
int ni_load_all_mi(struct ntfs_inode *ni);
bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi);
int ni_remove_attr(struct ntfs_inode *ni, enum ATTR_TYPE type,
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] fs/ntfs3: Remove unused ntfs_sb_read
2025-02-19 1:45 [PATCH 0/3] fs/ntfs3: Deadcoding linux
2025-02-19 1:45 ` [PATCH 1/3] fs/ntfs3: Remove unused ni_load_attr linux
@ 2025-02-19 1:45 ` linux
2025-02-19 1:45 ` [PATCH 3/3] fs/ntfs3: Remove unused ntfs_flush_inodes linux
2 siblings, 0 replies; 4+ messages in thread
From: linux @ 2025-02-19 1:45 UTC (permalink / raw)
To: almaz.alexandrovich, ntfs3; +Cc: linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
ntfs_sb_read() was added in 2021 by
commit 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
but hasn't been used.
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
fs/ntfs3/fsntfs.c | 28 ----------------------------
fs/ntfs3/ntfs_fs.h | 1 -
2 files changed, 29 deletions(-)
diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index 938d351ebac7..df81f1f7330c 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -1035,34 +1035,6 @@ struct buffer_head *ntfs_bread(struct super_block *sb, sector_t block)
return NULL;
}
-int ntfs_sb_read(struct super_block *sb, u64 lbo, size_t bytes, void *buffer)
-{
- struct block_device *bdev = sb->s_bdev;
- u32 blocksize = sb->s_blocksize;
- u64 block = lbo >> sb->s_blocksize_bits;
- u32 off = lbo & (blocksize - 1);
- u32 op = blocksize - off;
-
- for (; bytes; block += 1, off = 0, op = blocksize) {
- struct buffer_head *bh = __bread(bdev, block, blocksize);
-
- if (!bh)
- return -EIO;
-
- if (op > bytes)
- op = bytes;
-
- memcpy(buffer, bh->b_data + off, op);
-
- put_bh(bh);
-
- bytes -= op;
- buffer = Add2Ptr(buffer, op);
- }
-
- return 0;
-}
-
int ntfs_sb_write(struct super_block *sb, u64 lbo, size_t bytes,
const void *buf, int wait)
{
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 2034dca90a5e..0e34c944b622 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -616,7 +616,6 @@ enum NTFS_DIRTY_FLAGS {
NTFS_DIRTY_ERROR = 2,
};
int ntfs_set_state(struct ntfs_sb_info *sbi, enum NTFS_DIRTY_FLAGS dirty);
-int ntfs_sb_read(struct super_block *sb, u64 lbo, size_t bytes, void *buffer);
int ntfs_sb_write(struct super_block *sb, u64 lbo, size_t bytes,
const void *buffer, int wait);
int ntfs_sb_write_run(struct ntfs_sb_info *sbi, const struct runs_tree *run,
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] fs/ntfs3: Remove unused ntfs_flush_inodes
2025-02-19 1:45 [PATCH 0/3] fs/ntfs3: Deadcoding linux
2025-02-19 1:45 ` [PATCH 1/3] fs/ntfs3: Remove unused ni_load_attr linux
2025-02-19 1:45 ` [PATCH 2/3] fs/ntfs3: Remove unused ntfs_sb_read linux
@ 2025-02-19 1:45 ` linux
2 siblings, 0 replies; 4+ messages in thread
From: linux @ 2025-02-19 1:45 UTC (permalink / raw)
To: almaz.alexandrovich, ntfs3; +Cc: linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
ntfs_flush_inodes() was added in 2021 by
commit 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
but has remained unused.
Remove it, and it's helper function.
Note: There is a commented out call to ntfs_flush_inodes in
ntfs_truncate() - I've left that in place.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
fs/ntfs3/inode.c | 40 ----------------------------------------
fs/ntfs3/ntfs_fs.h | 2 --
2 files changed, 42 deletions(-)
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index a1e11228dafd..3e2957a1e360 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -1024,46 +1024,6 @@ int ntfs_sync_inode(struct inode *inode)
return _ni_write_inode(inode, 1);
}
-/*
- * writeback_inode - Helper function for ntfs_flush_inodes().
- *
- * This writes both the inode and the file data blocks, waiting
- * for in flight data blocks before the start of the call. It
- * does not wait for any io started during the call.
- */
-static int writeback_inode(struct inode *inode)
-{
- int ret = sync_inode_metadata(inode, 0);
-
- if (!ret)
- ret = filemap_fdatawrite(inode->i_mapping);
- return ret;
-}
-
-/*
- * ntfs_flush_inodes
- *
- * Write data and metadata corresponding to i1 and i2. The io is
- * started but we do not wait for any of it to finish.
- *
- * filemap_flush() is used for the block device, so if there is a dirty
- * page for a block already in flight, we will not wait and start the
- * io over again.
- */
-int ntfs_flush_inodes(struct super_block *sb, struct inode *i1,
- struct inode *i2)
-{
- int ret = 0;
-
- if (i1)
- ret = writeback_inode(i1);
- if (!ret && i2)
- ret = writeback_inode(i2);
- if (!ret)
- ret = filemap_flush(sb->s_bdev_file->f_mapping);
- return ret;
-}
-
/*
* Helper function to read file.
*/
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 0e34c944b622..d628977e2556 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -713,8 +713,6 @@ int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
u32 len, u32 copied, struct folio *folio, void *fsdata);
int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc);
int ntfs_sync_inode(struct inode *inode);
-int ntfs_flush_inodes(struct super_block *sb, struct inode *i1,
- struct inode *i2);
int inode_read_data(struct inode *inode, void *data, size_t bytes);
int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
struct dentry *dentry, const struct cpu_str *uni,
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-19 1:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 1:45 [PATCH 0/3] fs/ntfs3: Deadcoding linux
2025-02-19 1:45 ` [PATCH 1/3] fs/ntfs3: Remove unused ni_load_attr linux
2025-02-19 1:45 ` [PATCH 2/3] fs/ntfs3: Remove unused ntfs_sb_read linux
2025-02-19 1:45 ` [PATCH 3/3] fs/ntfs3: Remove unused ntfs_flush_inodes linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox