Skip to content

Commit ede3ef5

Browse files
author
Al Viro
committed
sysv: switch to put_and_unmap_page()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 8ad77c5 commit ede3ef5

3 files changed

Lines changed: 15 additions & 22 deletions

File tree

fs/sysv/dir.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ const struct file_operations sysv_dir_operations = {
2828
.fsync = generic_file_fsync,
2929
};
3030

31-
inline void dir_put_page(struct page *page, void *page_addr)
32-
{
33-
kunmap_local(page_addr);
34-
put_page(page);
35-
}
36-
3731
static void dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
3832
{
3933
struct address_space *mapping = page->mapping;
@@ -58,7 +52,7 @@ static int sysv_handle_dirsync(struct inode *dir)
5852
}
5953

6054
/*
61-
* Calls to dir_get_page()/dir_put_page() must be nested according to the
55+
* Calls to dir_get_page()/put_and_unmap_page() must be nested according to the
6256
* rules documented in mm/highmem.rst.
6357
*
6458
* NOTE: sysv_find_entry() and sysv_dotdot() act as calls to dir_get_page()
@@ -109,11 +103,11 @@ static int sysv_readdir(struct file *file, struct dir_context *ctx)
109103
if (!dir_emit(ctx, name, strnlen(name,SYSV_NAMELEN),
110104
fs16_to_cpu(SYSV_SB(sb), de->inode),
111105
DT_UNKNOWN)) {
112-
dir_put_page(page, kaddr);
106+
put_and_unmap_page(page, kaddr);
113107
return 0;
114108
}
115109
}
116-
dir_put_page(page, kaddr);
110+
put_and_unmap_page(page, kaddr);
117111
}
118112
return 0;
119113
}
@@ -137,7 +131,7 @@ static inline int namecompare(int len, int maxlen,
137131
* itself (as a parameter - res_dir). It does NOT read the inode of the
138132
* entry - you'll have to do that yourself if you want to.
139133
*
140-
* On Success dir_put_page() should be called on *res_page.
134+
* On Success put_and_unmap_page() should be called on *res_page.
141135
*
142136
* sysv_find_entry() acts as a call to dir_get_page() and must be treated
143137
* accordingly for nesting purposes.
@@ -172,7 +166,7 @@ struct sysv_dir_entry *sysv_find_entry(struct dentry *dentry, struct page **res_
172166
name, de->name))
173167
goto found;
174168
}
175-
dir_put_page(page, kaddr);
169+
put_and_unmap_page(page, kaddr);
176170
}
177171

178172
if (++n >= npages)
@@ -215,7 +209,7 @@ int sysv_add_link(struct dentry *dentry, struct inode *inode)
215209
goto out_page;
216210
de++;
217211
}
218-
dir_put_page(page, kaddr);
212+
put_and_unmap_page(page, kaddr);
219213
}
220214
BUG();
221215
return -EINVAL;
@@ -234,7 +228,7 @@ int sysv_add_link(struct dentry *dentry, struct inode *inode)
234228
mark_inode_dirty(dir);
235229
err = sysv_handle_dirsync(dir);
236230
out_page:
237-
dir_put_page(page, kaddr);
231+
put_and_unmap_page(page, kaddr);
238232
return err;
239233
out_unlock:
240234
unlock_page(page);
@@ -327,12 +321,12 @@ int sysv_empty_dir(struct inode * inode)
327321
if (de->name[1] != '.' || de->name[2])
328322
goto not_empty;
329323
}
330-
dir_put_page(page, kaddr);
324+
put_and_unmap_page(page, kaddr);
331325
}
332326
return 1;
333327

334328
not_empty:
335-
dir_put_page(page, kaddr);
329+
put_and_unmap_page(page, kaddr);
336330
return 0;
337331
}
338332

@@ -358,7 +352,7 @@ int sysv_set_link(struct sysv_dir_entry *de, struct page *page,
358352
}
359353

360354
/*
361-
* Calls to dir_get_page()/dir_put_page() must be nested according to the
355+
* Calls to dir_get_page()/put_and_unmap_page() must be nested according to the
362356
* rules documented in mm/highmem.rst.
363357
*
364358
* sysv_dotdot() acts as a call to dir_get_page() and must be treated
@@ -382,7 +376,7 @@ ino_t sysv_inode_by_name(struct dentry *dentry)
382376

383377
if (de) {
384378
res = fs16_to_cpu(SYSV_SB(dentry->d_sb), de->inode);
385-
dir_put_page(page, de);
379+
put_and_unmap_page(page, de);
386380
}
387381
return res;
388382
}

fs/sysv/namei.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static int sysv_unlink(struct inode * dir, struct dentry * dentry)
164164
inode->i_ctime = dir->i_ctime;
165165
inode_dec_link_count(inode);
166166
}
167-
dir_put_page(page, de);
167+
put_and_unmap_page(page, de);
168168
return err;
169169
}
170170

@@ -227,7 +227,7 @@ static int sysv_rename(struct mnt_idmap *idmap, struct inode *old_dir,
227227
if (!new_de)
228228
goto out_dir;
229229
err = sysv_set_link(new_de, new_page, old_inode);
230-
dir_put_page(new_page, new_de);
230+
put_and_unmap_page(new_page, new_de);
231231
if (err)
232232
goto out_dir;
233233
new_inode->i_ctime = current_time(new_inode);
@@ -256,9 +256,9 @@ static int sysv_rename(struct mnt_idmap *idmap, struct inode *old_dir,
256256

257257
out_dir:
258258
if (dir_de)
259-
dir_put_page(dir_page, dir_de);
259+
put_and_unmap_page(dir_page, dir_de);
260260
out_old:
261-
dir_put_page(old_page, old_de);
261+
put_and_unmap_page(old_page, old_de);
262262
out:
263263
return err;
264264
}

fs/sysv/sysv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ extern void sysv_destroy_icache(void);
148148

149149

150150
/* dir.c */
151-
extern void dir_put_page(struct page *page, void *vaddr);
152151
extern struct sysv_dir_entry *sysv_find_entry(struct dentry *, struct page **);
153152
extern int sysv_add_link(struct dentry *, struct inode *);
154153
extern int sysv_delete_entry(struct sysv_dir_entry *, struct page *);

0 commit comments

Comments
 (0)