Skip to content

Commit d0e1354

Browse files
xp4ns3brauner
authored andcommitted
highmem: Rename put_and_unmap_page() to unmap_and_put_page()
With commit 849ad04 ("new helper: put_and_unmap_page()"), Al Viro introduced the put_and_unmap_page() to use in those many places where we have a common pattern consisting of calls to kunmap_local() + put_page(). Obviously, first we unmap and then we put pages. Instead, the original name of this helper seems to imply that we first put and then unmap. Therefore, rename the helper and change the only known upstreamed user (i.e., fs/sysv) before this helper enters common use and might become difficult to find all call sites and instead easy to break the builds. Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Message-Id: <20230602103307.5637-1-fmdefrancesco@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 79aa284 commit d0e1354

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

fs/sysv/dir.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static int sysv_handle_dirsync(struct inode *dir)
5252
}
5353

5454
/*
55-
* Calls to dir_get_page()/put_and_unmap_page() must be nested according to the
55+
* Calls to dir_get_page()/unmap_and_put_page() must be nested according to the
5656
* rules documented in mm/highmem.rst.
5757
*
5858
* NOTE: sysv_find_entry() and sysv_dotdot() act as calls to dir_get_page()
@@ -103,11 +103,11 @@ static int sysv_readdir(struct file *file, struct dir_context *ctx)
103103
if (!dir_emit(ctx, name, strnlen(name,SYSV_NAMELEN),
104104
fs16_to_cpu(SYSV_SB(sb), de->inode),
105105
DT_UNKNOWN)) {
106-
put_and_unmap_page(page, kaddr);
106+
unmap_and_put_page(page, kaddr);
107107
return 0;
108108
}
109109
}
110-
put_and_unmap_page(page, kaddr);
110+
unmap_and_put_page(page, kaddr);
111111
}
112112
return 0;
113113
}
@@ -131,7 +131,7 @@ static inline int namecompare(int len, int maxlen,
131131
* itself (as a parameter - res_dir). It does NOT read the inode of the
132132
* entry - you'll have to do that yourself if you want to.
133133
*
134-
* On Success put_and_unmap_page() should be called on *res_page.
134+
* On Success unmap_and_put_page() should be called on *res_page.
135135
*
136136
* sysv_find_entry() acts as a call to dir_get_page() and must be treated
137137
* accordingly for nesting purposes.
@@ -166,7 +166,7 @@ struct sysv_dir_entry *sysv_find_entry(struct dentry *dentry, struct page **res_
166166
name, de->name))
167167
goto found;
168168
}
169-
put_and_unmap_page(page, kaddr);
169+
unmap_and_put_page(page, kaddr);
170170
}
171171

172172
if (++n >= npages)
@@ -209,7 +209,7 @@ int sysv_add_link(struct dentry *dentry, struct inode *inode)
209209
goto out_page;
210210
de++;
211211
}
212-
put_and_unmap_page(page, kaddr);
212+
unmap_and_put_page(page, kaddr);
213213
}
214214
BUG();
215215
return -EINVAL;
@@ -228,7 +228,7 @@ int sysv_add_link(struct dentry *dentry, struct inode *inode)
228228
mark_inode_dirty(dir);
229229
err = sysv_handle_dirsync(dir);
230230
out_page:
231-
put_and_unmap_page(page, kaddr);
231+
unmap_and_put_page(page, kaddr);
232232
return err;
233233
out_unlock:
234234
unlock_page(page);
@@ -321,12 +321,12 @@ int sysv_empty_dir(struct inode * inode)
321321
if (de->name[1] != '.' || de->name[2])
322322
goto not_empty;
323323
}
324-
put_and_unmap_page(page, kaddr);
324+
unmap_and_put_page(page, kaddr);
325325
}
326326
return 1;
327327

328328
not_empty:
329-
put_and_unmap_page(page, kaddr);
329+
unmap_and_put_page(page, kaddr);
330330
return 0;
331331
}
332332

@@ -352,7 +352,7 @@ int sysv_set_link(struct sysv_dir_entry *de, struct page *page,
352352
}
353353

354354
/*
355-
* Calls to dir_get_page()/put_and_unmap_page() must be nested according to the
355+
* Calls to dir_get_page()/unmap_and_put_page() must be nested according to the
356356
* rules documented in mm/highmem.rst.
357357
*
358358
* sysv_dotdot() acts as a call to dir_get_page() and must be treated
@@ -376,7 +376,7 @@ ino_t sysv_inode_by_name(struct dentry *dentry)
376376

377377
if (de) {
378378
res = fs16_to_cpu(SYSV_SB(dentry->d_sb), de->inode);
379-
put_and_unmap_page(page, de);
379+
unmap_and_put_page(page, de);
380380
}
381381
return res;
382382
}

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-
put_and_unmap_page(page, de);
167+
unmap_and_put_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-
put_and_unmap_page(new_page, new_de);
230+
unmap_and_put_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-
put_and_unmap_page(dir_page, dir_de);
259+
unmap_and_put_page(dir_page, dir_de);
260260
out_old:
261-
put_and_unmap_page(old_page, old_de);
261+
unmap_and_put_page(old_page, old_de);
262262
out:
263263
return err;
264264
}

include/linux/highmem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ static inline void folio_zero_range(struct folio *folio,
507507
zero_user_segments(&folio->page, start, start + length, 0, 0);
508508
}
509509

510-
static inline void put_and_unmap_page(struct page *page, void *addr)
510+
static inline void unmap_and_put_page(struct page *page, void *addr)
511511
{
512512
kunmap_local(addr);
513513
put_page(page);

0 commit comments

Comments
 (0)