1
Unfortunately the other filesystems I checked make adjustments after
1
Unfortunately the other filesystems I checked make adjustments after
2
their own call to generic_fillattr() and consequently can't benefit.
2
their own call to generic_fillattr() and consequently can't benefit.
3
3
4
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
4
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
5
---
5
---
6
6
7
There are weird slowdowns on fstat, this is a byproduct of trying to
7
v2:
8
straighten out the fast path.
8
- also patch vfs_getattr_nosec
9
10
There are weird slowdowns on fstat, this submission is a byproduct of
11
trying to straighten out the fast path.
9
12
10
Not benchmarked, but I did confirm the compiler jmps out to the routine
13
Not benchmarked, but I did confirm the compiler jmps out to the routine
11
instead of emitting a call which is the right thing to do here.
14
instead of emitting a call which is the right thing to do here.
12
15
13
that said I'm not going to argue, but I like to see this out of the way.
16
that said I'm not going to argue, but I like to see this out of the way.
...
...
86
void generic_fill_statx_attr(struct inode *inode, struct kstat *stat);
89
void generic_fill_statx_attr(struct inode *inode, struct kstat *stat);
87
void generic_fill_statx_atomic_writes(struct kstat *stat,
90
void generic_fill_statx_atomic_writes(struct kstat *stat,
88
                 unsigned int unit_min,
91
                 unsigned int unit_min,
89
--
92
--
90
2.43.0
93
2.43.0
94
95
fs/ext2/inode.c | 3 +--
96
fs/ext4/inode.c | 3 +--
97
fs/stat.c | 9 ++++++---
98
include/linux/fs.h | 2 +-
99
4 files changed, 9 insertions(+), 8 deletions(-)
100
101
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
102
index XXXXXXX..XXXXXXX 100644
103
--- a/fs/ext2/inode.c
104
+++ b/fs/ext2/inode.c
105
@@ -XXX,XX +XXX,XX @@ int ext2_getattr(struct mnt_idmap *idmap, const struct path *path,
106
            STATX_ATTR_IMMUTABLE |
107
            STATX_ATTR_NODUMP);
108
109
-    generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
110
-    return 0;
111
+    return generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
112
}
113
114
int ext2_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
115
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
116
index XXXXXXX..XXXXXXX 100644
117
--- a/fs/ext4/inode.c
118
+++ b/fs/ext4/inode.c
119
@@ -XXX,XX +XXX,XX @@ int ext4_getattr(struct mnt_idmap *idmap, const struct path *path,
120
                 STATX_ATTR_NODUMP |
121
                 STATX_ATTR_VERITY);
122
123
-    generic_fillattr(idmap, request_mask, inode, stat);
124
-    return 0;
125
+    return generic_fillattr(idmap, request_mask, inode, stat);
126
}
127
128
int ext4_file_getattr(struct mnt_idmap *idmap,
129
diff --git a/fs/stat.c b/fs/stat.c
130
index XXXXXXX..XXXXXXX 100644
131
--- a/fs/stat.c
132
+++ b/fs/stat.c
133
@@ -XXX,XX +XXX,XX @@ EXPORT_SYMBOL(fill_mg_cmtime);
134
* take care to map the inode according to @idmap before filling in the
135
* uid and gid filds. On non-idmapped mounts or if permission checking is to be
136
* performed on the raw inode simply pass @nop_mnt_idmap.
137
+ *
138
+ * The routine always succeeds. We make it return a value so that consumers can
139
+ * tail-call it.
140
*/
141
-void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask,
142
+int generic_fillattr(struct mnt_idmap *idmap, u32 request_mask,
143
         struct inode *inode, struct kstat *stat)
144
{
145
    vfsuid_t vfsuid = i_uid_into_vfsuid(idmap, inode);
146
@@ -XXX,XX +XXX,XX @@ void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask,
147
        stat->change_cookie = inode_query_iversion(inode);
148
    }
149
150
+    return 0;
151
}
152
EXPORT_SYMBOL(generic_fillattr);
153
154
@@ -XXX,XX +XXX,XX @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
155
                     request_mask,
156
                     query_flags);
157
158
-    generic_fillattr(idmap, request_mask, inode, stat);
159
-    return 0;
160
+    return generic_fillattr(idmap, request_mask, inode, stat);
161
}
162
EXPORT_SYMBOL(vfs_getattr_nosec);
163
164
diff --git a/include/linux/fs.h b/include/linux/fs.h
165
index XXXXXXX..XXXXXXX 100644
166
--- a/include/linux/fs.h
167
+++ b/include/linux/fs.h
168
@@ -XXX,XX +XXX,XX @@ extern int page_symlink(struct inode *inode, const char *symname, int len);
169
extern const struct inode_operations page_symlink_inode_operations;
170
extern void kfree_link(void *);
171
void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode);
172
-void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
173
+int generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
174
void generic_fill_statx_attr(struct inode *inode, struct kstat *stat);
175
void generic_fill_statx_atomic_writes(struct kstat *stat,
176
                 unsigned int unit_min,
177
--
178
2.43.0
diff view generated by jsdifflib