2023-12-13 00:07:28

by Al Viro

[permalink] [raw]
Subject: [minixfs] conversion to kmap_local_page()

Sat around since March; rebased to 6.7-rc1, the only
change is put_and_unmap_page() renamed to unmap_and_put_page() ;-)
That's a minixfs counterpart of ext2 and sysv patchsets.

Lives in vfs.git #work.minix, individual patches in
followups.

Shortlog:
Al Viro (4):
minixfs: use offset_in_page()
minixfs: change the signature of dir_get_page()
minixfs: Use dir_put_page() in minix_unlink() and minix_rename()
minixfs: switch to kmap_local_page()

Diffstat:
fs/minix/dir.c | 83 +++++++++++++++++++++++---------------------------------
fs/minix/namei.c | 12 +++-----
2 files changed, 38 insertions(+), 57 deletions(-)


2023-12-13 00:09:41

by Al Viro

[permalink] [raw]
Subject: [PATCH 1/4] minixfs: use offset_in_page()

It's cheaper and more idiomatic than subtracting page_address()
of the corresponding page...

Signed-off-by: Al Viro <[email protected]>
---
fs/minix/dir.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 62c313fc9a49..34a5d17f0796 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -268,7 +268,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
return -EINVAL;

got_it:
- pos = page_offset(page) + p - (char *)page_address(page);
+ pos = page_offset(page) + offset_in_page(p);
err = minix_prepare_chunk(page, pos, sbi->s_dirsize);
if (err)
goto out_unlock;
@@ -296,8 +296,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
{
struct inode *inode = page->mapping->host;
- char *kaddr = page_address(page);
- loff_t pos = page_offset(page) + (char*)de - kaddr;
+ loff_t pos = page_offset(page) + offset_in_page(de);
struct minix_sb_info *sbi = minix_sb(inode->i_sb);
unsigned len = sbi->s_dirsize;
int err;
@@ -421,8 +420,7 @@ int minix_set_link(struct minix_dir_entry *de, struct page *page,
{
struct inode *dir = page->mapping->host;
struct minix_sb_info *sbi = minix_sb(dir->i_sb);
- loff_t pos = page_offset(page) +
- (char *)de-(char*)page_address(page);
+ loff_t pos = page_offset(page) + offset_in_page(de);
int err;

lock_page(page);
--
2.39.2

2023-12-13 00:09:50

by Al Viro

[permalink] [raw]
Subject: [PATCH 2/4] minixfs: change the signature of dir_get_page()

Change the signature of dir_get_page() in order to prepare this function
to the conversion to the use of kmap_local_page(). Change also those call
sites which are required to adjust to the new signature.

Essentially a copy of the corresponding fs/sysv commit by
Fabio M. De Francesco <[email protected]>

Signed-off-by: Al Viro <[email protected]>
---
fs/minix/dir.c | 46 ++++++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 34a5d17f0796..4e5483adea40 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -70,13 +70,15 @@ static int minix_handle_dirsync(struct inode *dir)
return err;
}

-static struct page * dir_get_page(struct inode *dir, unsigned long n)
+static void *dir_get_page(struct inode *dir, unsigned long n, struct page **p)
{
struct address_space *mapping = dir->i_mapping;
struct page *page = read_mapping_page(mapping, n, NULL);
- if (!IS_ERR(page))
- kmap(page);
- return page;
+ if (IS_ERR(page))
+ return ERR_CAST(page);
+ kmap(page);
+ *p = page;
+ return page_address(page);
}

static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi)
@@ -104,11 +106,11 @@ static int minix_readdir(struct file *file, struct dir_context *ctx)

for ( ; n < npages; n++, offset = 0) {
char *p, *kaddr, *limit;
- struct page *page = dir_get_page(inode, n);
+ struct page *page;

- if (IS_ERR(page))
+ kaddr = dir_get_page(inode, n, &page);
+ if (IS_ERR(kaddr))
continue;
- kaddr = (char *)page_address(page);
p = kaddr+offset;
limit = kaddr + minix_last_byte(inode, n) - chunk_size;
for ( ; p <= limit; p = minix_next_entry(p, sbi)) {
@@ -173,11 +175,10 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page)
for (n = 0; n < npages; n++) {
char *kaddr, *limit;

- page = dir_get_page(dir, n);
- if (IS_ERR(page))
+ kaddr = dir_get_page(dir, n, &page);
+ if (IS_ERR(kaddr))
continue;

- kaddr = (char*)page_address(page);
limit = kaddr + minix_last_byte(dir, n) - sbi->s_dirsize;
for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) {
if (sbi->s_version == MINIX_V3) {
@@ -229,12 +230,10 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
for (n = 0; n <= npages; n++) {
char *limit, *dir_end;

- page = dir_get_page(dir, n);
- err = PTR_ERR(page);
- if (IS_ERR(page))
- goto out;
+ kaddr = dir_get_page(dir, n, &page);
+ if (IS_ERR(kaddr))
+ return PTR_ERR(kaddr);
lock_page(page);
- kaddr = (char*)page_address(page);
dir_end = kaddr + minix_last_byte(dir, n);
limit = kaddr + PAGE_SIZE - sbi->s_dirsize;
for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) {
@@ -286,7 +285,6 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
err = minix_handle_dirsync(dir);
out_put:
dir_put_page(page);
-out:
return err;
out_unlock:
unlock_page(page);
@@ -375,11 +373,10 @@ int minix_empty_dir(struct inode * inode)
for (i = 0; i < npages; i++) {
char *p, *kaddr, *limit;

- page = dir_get_page(inode, i);
- if (IS_ERR(page))
+ kaddr = dir_get_page(inode, i, &page);
+ if (IS_ERR(kaddr))
continue;

- kaddr = (char *)page_address(page);
limit = kaddr + minix_last_byte(inode, i) - sbi->s_dirsize;
for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) {
if (sbi->s_version == MINIX_V3) {
@@ -441,15 +438,12 @@ int minix_set_link(struct minix_dir_entry *de, struct page *page,

struct minix_dir_entry * minix_dotdot (struct inode *dir, struct page **p)
{
- struct page *page = dir_get_page(dir, 0);
struct minix_sb_info *sbi = minix_sb(dir->i_sb);
- struct minix_dir_entry *de = NULL;
+ struct minix_dir_entry *de = dir_get_page(dir, 0, p);

- if (!IS_ERR(page)) {
- de = minix_next_entry(page_address(page), sbi);
- *p = page;
- }
- return de;
+ if (!IS_ERR(de))
+ return minix_next_entry(de, sbi);
+ return NULL;
}

ino_t minix_inode_by_name(struct dentry *dentry)
--
2.39.2

2023-12-13 00:09:52

by Al Viro

[permalink] [raw]
Subject: [PATCH 4/4] minixfs: switch to kmap_local_page()

Again, a counterpart of Fabio's fs/sysv patch

Signed-off-by: Al Viro <[email protected]>
---
fs/minix/dir.c | 27 +++++++++++++--------------
fs/minix/minix.h | 5 -----
fs/minix/namei.c | 6 +++---
3 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index ccb6c47fd7fe..a224cf222570 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -70,9 +70,8 @@ static void *dir_get_page(struct inode *dir, unsigned long n, struct page **p)
struct page *page = read_mapping_page(mapping, n, NULL);
if (IS_ERR(page))
return ERR_CAST(page);
- kmap(page);
*p = page;
- return page_address(page);
+ return kmap_local_page(page);
}

static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi)
@@ -123,13 +122,13 @@ static int minix_readdir(struct file *file, struct dir_context *ctx)
unsigned l = strnlen(name, sbi->s_namelen);
if (!dir_emit(ctx, name, l,
inumber, DT_UNKNOWN)) {
- dir_put_page(page);
+ unmap_and_put_page(page, p);
return 0;
}
}
ctx->pos += chunk_size;
}
- dir_put_page(page);
+ unmap_and_put_page(page, kaddr);
}
return 0;
}
@@ -189,7 +188,7 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page)
if (namecompare(namelen, sbi->s_namelen, name, namx))
goto found;
}
- dir_put_page(page);
+ unmap_and_put_page(page, kaddr);
}
return NULL;

@@ -255,7 +254,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
goto out_unlock;
}
unlock_page(page);
- dir_put_page(page);
+ unmap_and_put_page(page, kaddr);
}
BUG();
return -EINVAL;
@@ -278,7 +277,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
mark_inode_dirty(dir);
err = minix_handle_dirsync(dir);
out_put:
- dir_put_page(page);
+ unmap_and_put_page(page, kaddr);
return err;
out_unlock:
unlock_page(page);
@@ -324,7 +323,7 @@ int minix_make_empty(struct inode *inode, struct inode *dir)
goto fail;
}

- kaddr = kmap_atomic(page);
+ kaddr = kmap_local_page(page);
memset(kaddr, 0, PAGE_SIZE);

if (sbi->s_version == MINIX_V3) {
@@ -344,7 +343,7 @@ int minix_make_empty(struct inode *inode, struct inode *dir)
de->inode = dir->i_ino;
strcpy(de->name, "..");
}
- kunmap_atomic(kaddr);
+ kunmap_local(kaddr);

dir_commit_chunk(page, 0, 2 * sbi->s_dirsize);
err = minix_handle_dirsync(inode);
@@ -361,11 +360,11 @@ int minix_empty_dir(struct inode * inode)
struct page *page = NULL;
unsigned long i, npages = dir_pages(inode);
struct minix_sb_info *sbi = minix_sb(inode->i_sb);
- char *name;
+ char *name, *kaddr;
__u32 inumber;

for (i = 0; i < npages; i++) {
- char *p, *kaddr, *limit;
+ char *p, *limit;

kaddr = dir_get_page(inode, i, &page);
if (IS_ERR(kaddr))
@@ -396,12 +395,12 @@ int minix_empty_dir(struct inode * inode)
goto not_empty;
}
}
- dir_put_page(page);
+ unmap_and_put_page(page, kaddr);
}
return 1;

not_empty:
- dir_put_page(page);
+ unmap_and_put_page(page, kaddr);
return 0;
}

@@ -455,7 +454,7 @@ ino_t minix_inode_by_name(struct dentry *dentry)
res = ((minix3_dirent *) de)->inode;
else
res = de->inode;
- dir_put_page(page);
+ unmap_and_put_page(page, de);
}
return res;
}
diff --git a/fs/minix/minix.h b/fs/minix/minix.h
index cb42b6cf7909..d493507c064f 100644
--- a/fs/minix/minix.h
+++ b/fs/minix/minix.h
@@ -64,11 +64,6 @@ extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int);
extern unsigned V1_minix_blocks(loff_t, struct super_block *);
extern unsigned V2_minix_blocks(loff_t, struct super_block *);

-static inline void dir_put_page(struct page *page)
-{
- kunmap(page);
- put_page(page);
-}
extern struct minix_dir_entry *minix_find_entry(struct dentry*, struct page**);
extern int minix_add_link(struct dentry*, struct inode*);
extern int minix_delete_entry(struct minix_dir_entry*, struct page*);
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index 20923a15e30a..d6031acc34f0 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -149,7 +149,7 @@ static int minix_unlink(struct inode * dir, struct dentry *dentry)
if (!de)
return -ENOENT;
err = minix_delete_entry(de, page);
- dir_put_page(page);
+ unmap_and_put_page(page, de);

if (err)
return err;
@@ -242,9 +242,9 @@ static int minix_rename(struct mnt_idmap *idmap,
}
out_dir:
if (dir_de)
- dir_put_page(dir_page);
+ unmap_and_put_page(dir_page, dir_de);
out_old:
- dir_put_page(old_page);
+ unmap_and_put_page(old_page, old_de);
out:
return err;
}
--
2.39.2

2023-12-14 11:52:14

by Fabio M. De Francesco

[permalink] [raw]
Subject: Re: [PATCH 1/4] minixfs: use offset_in_page()

On Wednesday, 13 December 2023 01:08:46 CET Al Viro wrote:
> It's cheaper and more idiomatic than subtracting page_address()
> of the corresponding page...
>
> Signed-off-by: Al Viro <[email protected]>
> ---
> fs/minix/dir.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)

Well, I know this code since the changes to fs/sysv and fs/ext2 ;)
Therefore, FWIW...

Reviewed-by: Fabio M. De Francesco <[email protected]>

Fabio

> diff --git a/fs/minix/dir.c b/fs/minix/dir.c
> index 62c313fc9a49..34a5d17f0796 100644
> --- a/fs/minix/dir.c
> +++ b/fs/minix/dir.c
> @@ -268,7 +268,7 @@ int minix_add_link(struct dentry *dentry, struct inode
> *inode) return -EINVAL;
>
> got_it:
> - pos = page_offset(page) + p - (char *)page_address(page);
> + pos = page_offset(page) + offset_in_page(p);
> err = minix_prepare_chunk(page, pos, sbi->s_dirsize);
> if (err)
> goto out_unlock;
> @@ -296,8 +296,7 @@ int minix_add_link(struct dentry *dentry, struct inode
> *inode) int minix_delete_entry(struct minix_dir_entry *de, struct page
> *page) {
> struct inode *inode = page->mapping->host;
> - char *kaddr = page_address(page);
> - loff_t pos = page_offset(page) + (char*)de - kaddr;
> + loff_t pos = page_offset(page) + offset_in_page(de);
> struct minix_sb_info *sbi = minix_sb(inode->i_sb);
> unsigned len = sbi->s_dirsize;
> int err;
> @@ -421,8 +420,7 @@ int minix_set_link(struct minix_dir_entry *de, struct
> page *page, {
> struct inode *dir = page->mapping->host;
> struct minix_sb_info *sbi = minix_sb(dir->i_sb);
> - loff_t pos = page_offset(page) +
> - (char *)de-(char*)page_address(page);
> + loff_t pos = page_offset(page) + offset_in_page(de);
> int err;
>
> lock_page(page);




2023-12-14 12:00:23

by Fabio M. De Francesco

[permalink] [raw]
Subject: Re: [PATCH 2/4] minixfs: change the signature of dir_get_page()

On Wednesday, 13 December 2023 01:08:47 CET Al Viro wrote:
> Change the signature of dir_get_page() in order to prepare this function
> to the conversion to the use of kmap_local_page(). Change also those call
> sites which are required to adjust to the new signature.
>
> Essentially a copy of the corresponding fs/sysv commit by
> Fabio M. De Francesco <[email protected]>
>
> Signed-off-by: Al Viro <[email protected]>
> ---
> fs/minix/dir.c | 46 ++++++++++++++++++++--------------------------
> 1 file changed, 20 insertions(+), 26 deletions(-)

Reviewed-by: Fabio M. De Francesco <[email protected]>

> diff --git a/fs/minix/dir.c b/fs/minix/dir.c
> index 34a5d17f0796..4e5483adea40 100644
> --- a/fs/minix/dir.c
> +++ b/fs/minix/dir.c
> @@ -70,13 +70,15 @@ static int minix_handle_dirsync(struct inode *dir)
> return err;
> }
>
> -static struct page * dir_get_page(struct inode *dir, unsigned long n)
> +static void *dir_get_page(struct inode *dir, unsigned long n, struct page
> **p) {
> struct address_space *mapping = dir->i_mapping;
> struct page *page = read_mapping_page(mapping, n, NULL);
> - if (!IS_ERR(page))
> - kmap(page);
> - return page;
> + if (IS_ERR(page))
> + return ERR_CAST(page);
> + kmap(page);
> + *p = page;
> + return page_address(page);
> }
>
> static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi)
> @@ -104,11 +106,11 @@ static int minix_readdir(struct file *file, struct
> dir_context *ctx)
>
> for ( ; n < npages; n++, offset = 0) {
> char *p, *kaddr, *limit;
> - struct page *page = dir_get_page(inode, n);
> + struct page *page;
>
> - if (IS_ERR(page))
> + kaddr = dir_get_page(inode, n, &page);
> + if (IS_ERR(kaddr))
> continue;
> - kaddr = (char *)page_address(page);
> p = kaddr+offset;
> limit = kaddr + minix_last_byte(inode, n) - chunk_size;
> for ( ; p <= limit; p = minix_next_entry(p, sbi)) {
> @@ -173,11 +175,10 @@ minix_dirent *minix_find_entry(struct dentry *dentry,
> struct page **res_page) for (n = 0; n < npages; n++) {
> char *kaddr, *limit;
>
> - page = dir_get_page(dir, n);
> - if (IS_ERR(page))
> + kaddr = dir_get_page(dir, n, &page);
> + if (IS_ERR(kaddr))
> continue;
>
> - kaddr = (char*)page_address(page);
> limit = kaddr + minix_last_byte(dir, n) - sbi->s_dirsize;
> for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) {
> if (sbi->s_version == MINIX_V3) {
> @@ -229,12 +230,10 @@ int minix_add_link(struct dentry *dentry, struct inode
> *inode) for (n = 0; n <= npages; n++) {
> char *limit, *dir_end;
>
> - page = dir_get_page(dir, n);
> - err = PTR_ERR(page);
> - if (IS_ERR(page))
> - goto out;
> + kaddr = dir_get_page(dir, n, &page);
> + if (IS_ERR(kaddr))
> + return PTR_ERR(kaddr);
> lock_page(page);
> - kaddr = (char*)page_address(page);
> dir_end = kaddr + minix_last_byte(dir, n);
> limit = kaddr + PAGE_SIZE - sbi->s_dirsize;
> for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) {
> @@ -286,7 +285,6 @@ int minix_add_link(struct dentry *dentry, struct inode
> *inode) err = minix_handle_dirsync(dir);
> out_put:
> dir_put_page(page);
> -out:
> return err;
> out_unlock:
> unlock_page(page);
> @@ -375,11 +373,10 @@ int minix_empty_dir(struct inode * inode)
> for (i = 0; i < npages; i++) {
> char *p, *kaddr, *limit;
>
> - page = dir_get_page(inode, i);
> - if (IS_ERR(page))
> + kaddr = dir_get_page(inode, i, &page);
> + if (IS_ERR(kaddr))
> continue;
>
> - kaddr = (char *)page_address(page);
> limit = kaddr + minix_last_byte(inode, i) - sbi->s_dirsize;
> for (p = kaddr; p <= limit; p = minix_next_entry(p, sbi)) {
> if (sbi->s_version == MINIX_V3) {
> @@ -441,15 +438,12 @@ int minix_set_link(struct minix_dir_entry *de, struct
> page *page,
>
> struct minix_dir_entry * minix_dotdot (struct inode *dir, struct page **p)
> {
> - struct page *page = dir_get_page(dir, 0);
> struct minix_sb_info *sbi = minix_sb(dir->i_sb);
> - struct minix_dir_entry *de = NULL;
> + struct minix_dir_entry *de = dir_get_page(dir, 0, p);
>
> - if (!IS_ERR(page)) {
> - de = minix_next_entry(page_address(page), sbi);
> - *p = page;
> - }
> - return de;
> + if (!IS_ERR(de))
> + return minix_next_entry(de, sbi);
> + return NULL;
> }
>
> ino_t minix_inode_by_name(struct dentry *dentry)




2023-12-14 12:07:23

by Fabio M. De Francesco

[permalink] [raw]
Subject: Re: [PATCH 4/4] minixfs: switch to kmap_local_page()

On Wednesday, 13 December 2023 01:08:49 CET Al Viro wrote:
> Again, a counterpart of Fabio's fs/sysv patch
>
> Signed-off-by: Al Viro <[email protected]>
> ---
> fs/minix/dir.c | 27 +++++++++++++--------------
> fs/minix/minix.h | 5 -----
> fs/minix/namei.c | 6 +++---
> 3 files changed, 16 insertions(+), 22 deletions(-)

Reviewed-by: Fabio M. De Francesco <[email protected]>

> diff --git a/fs/minix/dir.c b/fs/minix/dir.c
> index ccb6c47fd7fe..a224cf222570 100644
> --- a/fs/minix/dir.c
> +++ b/fs/minix/dir.c
> @@ -70,9 +70,8 @@ static void *dir_get_page(struct inode *dir, unsigned long
> n, struct page **p) struct page *page = read_mapping_page(mapping, n,
> NULL);
> if (IS_ERR(page))
> return ERR_CAST(page);
> - kmap(page);
> *p = page;
> - return page_address(page);
> + return kmap_local_page(page);
> }
>
> static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi)
> @@ -123,13 +122,13 @@ static int minix_readdir(struct file *file, struct
> dir_context *ctx) unsigned l = strnlen(name, sbi->s_namelen);
> if (!dir_emit(ctx, name, l,
> inumber, DT_UNKNOWN)) {
> - dir_put_page(page);
> + unmap_and_put_page(page, p);
> return 0;
> }
> }
> ctx->pos += chunk_size;
> }
> - dir_put_page(page);
> + unmap_and_put_page(page, kaddr);
> }
> return 0;
> }
> @@ -189,7 +188,7 @@ minix_dirent *minix_find_entry(struct dentry *dentry,
> struct page **res_page) if (namecompare(namelen, sbi->s_namelen, name,
> namx))
> goto found;
> }
> - dir_put_page(page);
> + unmap_and_put_page(page, kaddr);
> }
> return NULL;
>
> @@ -255,7 +254,7 @@ int minix_add_link(struct dentry *dentry, struct inode
> *inode) goto out_unlock;
> }
> unlock_page(page);
> - dir_put_page(page);
> + unmap_and_put_page(page, kaddr);
> }
> BUG();
> return -EINVAL;
> @@ -278,7 +277,7 @@ int minix_add_link(struct dentry *dentry, struct inode
> *inode) mark_inode_dirty(dir);
> err = minix_handle_dirsync(dir);
> out_put:
> - dir_put_page(page);
> + unmap_and_put_page(page, kaddr);
> return err;
> out_unlock:
> unlock_page(page);
> @@ -324,7 +323,7 @@ int minix_make_empty(struct inode *inode, struct inode
> *dir) goto fail;
> }
>
> - kaddr = kmap_atomic(page);
> + kaddr = kmap_local_page(page);
> memset(kaddr, 0, PAGE_SIZE);
>
> if (sbi->s_version == MINIX_V3) {
> @@ -344,7 +343,7 @@ int minix_make_empty(struct inode *inode, struct inode
> *dir) de->inode = dir->i_ino;
> strcpy(de->name, "..");
> }
> - kunmap_atomic(kaddr);
> + kunmap_local(kaddr);
>
> dir_commit_chunk(page, 0, 2 * sbi->s_dirsize);
> err = minix_handle_dirsync(inode);
> @@ -361,11 +360,11 @@ int minix_empty_dir(struct inode * inode)
> struct page *page = NULL;
> unsigned long i, npages = dir_pages(inode);
> struct minix_sb_info *sbi = minix_sb(inode->i_sb);
> - char *name;
> + char *name, *kaddr;
> __u32 inumber;
>
> for (i = 0; i < npages; i++) {
> - char *p, *kaddr, *limit;
> + char *p, *limit;
>
> kaddr = dir_get_page(inode, i, &page);
> if (IS_ERR(kaddr))
> @@ -396,12 +395,12 @@ int minix_empty_dir(struct inode * inode)
> goto not_empty;
> }
> }
> - dir_put_page(page);
> + unmap_and_put_page(page, kaddr);
> }
> return 1;
>
> not_empty:
> - dir_put_page(page);
> + unmap_and_put_page(page, kaddr);
> return 0;
> }
>
> @@ -455,7 +454,7 @@ ino_t minix_inode_by_name(struct dentry *dentry)
> res = ((minix3_dirent *) de)->inode;
> else
> res = de->inode;
> - dir_put_page(page);
> + unmap_and_put_page(page, de);
> }
> return res;
> }
> diff --git a/fs/minix/minix.h b/fs/minix/minix.h
> index cb42b6cf7909..d493507c064f 100644
> --- a/fs/minix/minix.h
> +++ b/fs/minix/minix.h
> @@ -64,11 +64,6 @@ extern int V2_minix_get_block(struct inode *, long,
> struct buffer_head *, int); extern unsigned V1_minix_blocks(loff_t, struct
> super_block *);
> extern unsigned V2_minix_blocks(loff_t, struct super_block *);
>
> -static inline void dir_put_page(struct page *page)
> -{
> - kunmap(page);
> - put_page(page);
> -}
> extern struct minix_dir_entry *minix_find_entry(struct dentry*, struct
> page**); extern int minix_add_link(struct dentry*, struct inode*);
> extern int minix_delete_entry(struct minix_dir_entry*, struct page*);
> diff --git a/fs/minix/namei.c b/fs/minix/namei.c
> index 20923a15e30a..d6031acc34f0 100644
> --- a/fs/minix/namei.c
> +++ b/fs/minix/namei.c
> @@ -149,7 +149,7 @@ static int minix_unlink(struct inode * dir, struct
> dentry *dentry) if (!de)
> return -ENOENT;
> err = minix_delete_entry(de, page);
> - dir_put_page(page);
> + unmap_and_put_page(page, de);
>
> if (err)
> return err;
> @@ -242,9 +242,9 @@ static int minix_rename(struct mnt_idmap *idmap,
> }
> out_dir:
> if (dir_de)
> - dir_put_page(dir_page);
> + unmap_and_put_page(dir_page, dir_de);
> out_old:
> - dir_put_page(old_page);
> + unmap_and_put_page(old_page, old_de);
> out:
> return err;
> }