Commit 5eccc067 authored by Ryusuke Konishi's avatar Ryusuke Konishi Committed by Andrew Morton

nilfs2: convert cpfile to use kmap_local

Convert all remaining usages of kmap_atomic in cpfile to kmap_local.

Link: https://lkml.kernel.org/r/20240122140202.6950-16-konishi.ryusuke@gmail.comSigned-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 78ce4915
...@@ -460,7 +460,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, ...@@ -460,7 +460,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
continue; continue;
} }
kaddr = kmap_atomic(cp_bh->b_page); kaddr = kmap_local_page(cp_bh->b_page);
cp = nilfs_cpfile_block_get_checkpoint( cp = nilfs_cpfile_block_get_checkpoint(
cpfile, cno, cp_bh, kaddr); cpfile, cno, cp_bh, kaddr);
nicps = 0; nicps = 0;
...@@ -482,7 +482,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, ...@@ -482,7 +482,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
cpfile, cp_bh, kaddr, nicps); cpfile, cp_bh, kaddr, nicps);
if (count == 0) { if (count == 0) {
/* make hole */ /* make hole */
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(cp_bh); brelse(cp_bh);
ret = ret =
nilfs_cpfile_delete_checkpoint_block( nilfs_cpfile_delete_checkpoint_block(
...@@ -497,18 +497,18 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, ...@@ -497,18 +497,18 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
} }
} }
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(cp_bh); brelse(cp_bh);
} }
if (tnicps > 0) { if (tnicps > 0) {
kaddr = kmap_atomic(header_bh->b_page); kaddr = kmap_local_page(header_bh->b_page);
header = nilfs_cpfile_block_get_header(cpfile, header_bh, header = nilfs_cpfile_block_get_header(cpfile, header_bh,
kaddr); kaddr);
le64_add_cpu(&header->ch_ncheckpoints, -(u64)tnicps); le64_add_cpu(&header->ch_ncheckpoints, -(u64)tnicps);
mark_buffer_dirty(header_bh); mark_buffer_dirty(header_bh);
nilfs_mdt_mark_dirty(cpfile); nilfs_mdt_mark_dirty(cpfile);
kunmap_atomic(kaddr); kunmap_local(kaddr);
} }
brelse(header_bh); brelse(header_bh);
...@@ -560,7 +560,7 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop, ...@@ -560,7 +560,7 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop,
} }
ncps = nilfs_cpfile_checkpoints_in_block(cpfile, cno, cur_cno); ncps = nilfs_cpfile_checkpoints_in_block(cpfile, cno, cur_cno);
kaddr = kmap_atomic(bh->b_page); kaddr = kmap_local_page(bh->b_page);
cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, bh, kaddr); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, bh, kaddr);
for (i = 0; i < ncps && n < nci; i++, cp = (void *)cp + cpsz) { for (i = 0; i < ncps && n < nci; i++, cp = (void *)cp + cpsz) {
if (!nilfs_checkpoint_invalid(cp)) { if (!nilfs_checkpoint_invalid(cp)) {
...@@ -570,7 +570,7 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop, ...@@ -570,7 +570,7 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop,
n++; n++;
} }
} }
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(bh); brelse(bh);
} }
...@@ -604,10 +604,10 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop, ...@@ -604,10 +604,10 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop,
ret = nilfs_cpfile_get_header_block(cpfile, &bh); ret = nilfs_cpfile_get_header_block(cpfile, &bh);
if (ret < 0) if (ret < 0)
goto out; goto out;
kaddr = kmap_atomic(bh->b_page); kaddr = kmap_local_page(bh->b_page);
header = nilfs_cpfile_block_get_header(cpfile, bh, kaddr); header = nilfs_cpfile_block_get_header(cpfile, bh, kaddr);
curr = le64_to_cpu(header->ch_snapshot_list.ssl_next); curr = le64_to_cpu(header->ch_snapshot_list.ssl_next);
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(bh); brelse(bh);
if (curr == 0) { if (curr == 0) {
ret = 0; ret = 0;
...@@ -625,7 +625,7 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop, ...@@ -625,7 +625,7 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop,
ret = 0; /* No snapshots (started from a hole block) */ ret = 0; /* No snapshots (started from a hole block) */
goto out; goto out;
} }
kaddr = kmap_atomic(bh->b_page); kaddr = kmap_local_page(bh->b_page);
while (n < nci) { while (n < nci) {
cp = nilfs_cpfile_block_get_checkpoint(cpfile, curr, bh, kaddr); cp = nilfs_cpfile_block_get_checkpoint(cpfile, curr, bh, kaddr);
curr = ~(__u64)0; /* Terminator */ curr = ~(__u64)0; /* Terminator */
...@@ -641,7 +641,7 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop, ...@@ -641,7 +641,7 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop,
next_blkoff = nilfs_cpfile_get_blkoff(cpfile, next); next_blkoff = nilfs_cpfile_get_blkoff(cpfile, next);
if (curr_blkoff != next_blkoff) { if (curr_blkoff != next_blkoff) {
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(bh); brelse(bh);
ret = nilfs_cpfile_get_checkpoint_block(cpfile, next, ret = nilfs_cpfile_get_checkpoint_block(cpfile, next,
0, &bh); 0, &bh);
...@@ -649,12 +649,12 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop, ...@@ -649,12 +649,12 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop,
WARN_ON(ret == -ENOENT); WARN_ON(ret == -ENOENT);
goto out; goto out;
} }
kaddr = kmap_atomic(bh->b_page); kaddr = kmap_local_page(bh->b_page);
} }
curr = next; curr = next;
curr_blkoff = next_blkoff; curr_blkoff = next_blkoff;
} }
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(bh); brelse(bh);
*cnop = curr; *cnop = curr;
ret = n; ret = n;
...@@ -763,24 +763,24 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno) ...@@ -763,24 +763,24 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno)
ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh);
if (ret < 0) if (ret < 0)
goto out_sem; goto out_sem;
kaddr = kmap_atomic(cp_bh->b_page); kaddr = kmap_local_page(cp_bh->b_page);
cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr);
if (nilfs_checkpoint_invalid(cp)) { if (nilfs_checkpoint_invalid(cp)) {
ret = -ENOENT; ret = -ENOENT;
kunmap_atomic(kaddr); kunmap_local(kaddr);
goto out_cp; goto out_cp;
} }
if (nilfs_checkpoint_snapshot(cp)) { if (nilfs_checkpoint_snapshot(cp)) {
ret = 0; ret = 0;
kunmap_atomic(kaddr); kunmap_local(kaddr);
goto out_cp; goto out_cp;
} }
kunmap_atomic(kaddr); kunmap_local(kaddr);
ret = nilfs_cpfile_get_header_block(cpfile, &header_bh); ret = nilfs_cpfile_get_header_block(cpfile, &header_bh);
if (ret < 0) if (ret < 0)
goto out_cp; goto out_cp;
kaddr = kmap_atomic(header_bh->b_page); kaddr = kmap_local_page(header_bh->b_page);
header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr); header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr);
list = &header->ch_snapshot_list; list = &header->ch_snapshot_list;
curr_bh = header_bh; curr_bh = header_bh;
...@@ -792,13 +792,13 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno) ...@@ -792,13 +792,13 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno)
prev_blkoff = nilfs_cpfile_get_blkoff(cpfile, prev); prev_blkoff = nilfs_cpfile_get_blkoff(cpfile, prev);
curr = prev; curr = prev;
if (curr_blkoff != prev_blkoff) { if (curr_blkoff != prev_blkoff) {
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(curr_bh); brelse(curr_bh);
ret = nilfs_cpfile_get_checkpoint_block(cpfile, curr, ret = nilfs_cpfile_get_checkpoint_block(cpfile, curr,
0, &curr_bh); 0, &curr_bh);
if (ret < 0) if (ret < 0)
goto out_header; goto out_header;
kaddr = kmap_atomic(curr_bh->b_page); kaddr = kmap_local_page(curr_bh->b_page);
} }
curr_blkoff = prev_blkoff; curr_blkoff = prev_blkoff;
cp = nilfs_cpfile_block_get_checkpoint( cp = nilfs_cpfile_block_get_checkpoint(
...@@ -806,7 +806,7 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno) ...@@ -806,7 +806,7 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno)
list = &cp->cp_snapshot_list; list = &cp->cp_snapshot_list;
prev = le64_to_cpu(list->ssl_prev); prev = le64_to_cpu(list->ssl_prev);
} }
kunmap_atomic(kaddr); kunmap_local(kaddr);
if (prev != 0) { if (prev != 0) {
ret = nilfs_cpfile_get_checkpoint_block(cpfile, prev, 0, ret = nilfs_cpfile_get_checkpoint_block(cpfile, prev, 0,
...@@ -818,29 +818,29 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno) ...@@ -818,29 +818,29 @@ static int nilfs_cpfile_set_snapshot(struct inode *cpfile, __u64 cno)
get_bh(prev_bh); get_bh(prev_bh);
} }
kaddr = kmap_atomic(curr_bh->b_page); kaddr = kmap_local_page(curr_bh->b_page);
list = nilfs_cpfile_block_get_snapshot_list( list = nilfs_cpfile_block_get_snapshot_list(
cpfile, curr, curr_bh, kaddr); cpfile, curr, curr_bh, kaddr);
list->ssl_prev = cpu_to_le64(cno); list->ssl_prev = cpu_to_le64(cno);
kunmap_atomic(kaddr); kunmap_local(kaddr);
kaddr = kmap_atomic(cp_bh->b_page); kaddr = kmap_local_page(cp_bh->b_page);
cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr);
cp->cp_snapshot_list.ssl_next = cpu_to_le64(curr); cp->cp_snapshot_list.ssl_next = cpu_to_le64(curr);
cp->cp_snapshot_list.ssl_prev = cpu_to_le64(prev); cp->cp_snapshot_list.ssl_prev = cpu_to_le64(prev);
nilfs_checkpoint_set_snapshot(cp); nilfs_checkpoint_set_snapshot(cp);
kunmap_atomic(kaddr); kunmap_local(kaddr);
kaddr = kmap_atomic(prev_bh->b_page); kaddr = kmap_local_page(prev_bh->b_page);
list = nilfs_cpfile_block_get_snapshot_list( list = nilfs_cpfile_block_get_snapshot_list(
cpfile, prev, prev_bh, kaddr); cpfile, prev, prev_bh, kaddr);
list->ssl_next = cpu_to_le64(cno); list->ssl_next = cpu_to_le64(cno);
kunmap_atomic(kaddr); kunmap_local(kaddr);
kaddr = kmap_atomic(header_bh->b_page); kaddr = kmap_local_page(header_bh->b_page);
header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr); header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr);
le64_add_cpu(&header->ch_nsnapshots, 1); le64_add_cpu(&header->ch_nsnapshots, 1);
kunmap_atomic(kaddr); kunmap_local(kaddr);
mark_buffer_dirty(prev_bh); mark_buffer_dirty(prev_bh);
mark_buffer_dirty(curr_bh); mark_buffer_dirty(curr_bh);
...@@ -881,23 +881,23 @@ static int nilfs_cpfile_clear_snapshot(struct inode *cpfile, __u64 cno) ...@@ -881,23 +881,23 @@ static int nilfs_cpfile_clear_snapshot(struct inode *cpfile, __u64 cno)
ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh);
if (ret < 0) if (ret < 0)
goto out_sem; goto out_sem;
kaddr = kmap_atomic(cp_bh->b_page); kaddr = kmap_local_page(cp_bh->b_page);
cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr);
if (nilfs_checkpoint_invalid(cp)) { if (nilfs_checkpoint_invalid(cp)) {
ret = -ENOENT; ret = -ENOENT;
kunmap_atomic(kaddr); kunmap_local(kaddr);
goto out_cp; goto out_cp;
} }
if (!nilfs_checkpoint_snapshot(cp)) { if (!nilfs_checkpoint_snapshot(cp)) {
ret = 0; ret = 0;
kunmap_atomic(kaddr); kunmap_local(kaddr);
goto out_cp; goto out_cp;
} }
list = &cp->cp_snapshot_list; list = &cp->cp_snapshot_list;
next = le64_to_cpu(list->ssl_next); next = le64_to_cpu(list->ssl_next);
prev = le64_to_cpu(list->ssl_prev); prev = le64_to_cpu(list->ssl_prev);
kunmap_atomic(kaddr); kunmap_local(kaddr);
ret = nilfs_cpfile_get_header_block(cpfile, &header_bh); ret = nilfs_cpfile_get_header_block(cpfile, &header_bh);
if (ret < 0) if (ret < 0)
...@@ -921,29 +921,29 @@ static int nilfs_cpfile_clear_snapshot(struct inode *cpfile, __u64 cno) ...@@ -921,29 +921,29 @@ static int nilfs_cpfile_clear_snapshot(struct inode *cpfile, __u64 cno)
get_bh(prev_bh); get_bh(prev_bh);
} }
kaddr = kmap_atomic(next_bh->b_page); kaddr = kmap_local_page(next_bh->b_page);
list = nilfs_cpfile_block_get_snapshot_list( list = nilfs_cpfile_block_get_snapshot_list(
cpfile, next, next_bh, kaddr); cpfile, next, next_bh, kaddr);
list->ssl_prev = cpu_to_le64(prev); list->ssl_prev = cpu_to_le64(prev);
kunmap_atomic(kaddr); kunmap_local(kaddr);
kaddr = kmap_atomic(prev_bh->b_page); kaddr = kmap_local_page(prev_bh->b_page);
list = nilfs_cpfile_block_get_snapshot_list( list = nilfs_cpfile_block_get_snapshot_list(
cpfile, prev, prev_bh, kaddr); cpfile, prev, prev_bh, kaddr);
list->ssl_next = cpu_to_le64(next); list->ssl_next = cpu_to_le64(next);
kunmap_atomic(kaddr); kunmap_local(kaddr);
kaddr = kmap_atomic(cp_bh->b_page); kaddr = kmap_local_page(cp_bh->b_page);
cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, cp_bh, kaddr);
cp->cp_snapshot_list.ssl_next = cpu_to_le64(0); cp->cp_snapshot_list.ssl_next = cpu_to_le64(0);
cp->cp_snapshot_list.ssl_prev = cpu_to_le64(0); cp->cp_snapshot_list.ssl_prev = cpu_to_le64(0);
nilfs_checkpoint_clear_snapshot(cp); nilfs_checkpoint_clear_snapshot(cp);
kunmap_atomic(kaddr); kunmap_local(kaddr);
kaddr = kmap_atomic(header_bh->b_page); kaddr = kmap_local_page(header_bh->b_page);
header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr); header = nilfs_cpfile_block_get_header(cpfile, header_bh, kaddr);
le64_add_cpu(&header->ch_nsnapshots, -1); le64_add_cpu(&header->ch_nsnapshots, -1);
kunmap_atomic(kaddr); kunmap_local(kaddr);
mark_buffer_dirty(next_bh); mark_buffer_dirty(next_bh);
mark_buffer_dirty(prev_bh); mark_buffer_dirty(prev_bh);
...@@ -1002,13 +1002,13 @@ int nilfs_cpfile_is_snapshot(struct inode *cpfile, __u64 cno) ...@@ -1002,13 +1002,13 @@ int nilfs_cpfile_is_snapshot(struct inode *cpfile, __u64 cno)
ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &bh); ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &bh);
if (ret < 0) if (ret < 0)
goto out; goto out;
kaddr = kmap_atomic(bh->b_page); kaddr = kmap_local_page(bh->b_page);
cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, bh, kaddr); cp = nilfs_cpfile_block_get_checkpoint(cpfile, cno, bh, kaddr);
if (nilfs_checkpoint_invalid(cp)) if (nilfs_checkpoint_invalid(cp))
ret = -ENOENT; ret = -ENOENT;
else else
ret = nilfs_checkpoint_snapshot(cp); ret = nilfs_checkpoint_snapshot(cp);
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(bh); brelse(bh);
out: out:
...@@ -1085,12 +1085,12 @@ int nilfs_cpfile_get_stat(struct inode *cpfile, struct nilfs_cpstat *cpstat) ...@@ -1085,12 +1085,12 @@ int nilfs_cpfile_get_stat(struct inode *cpfile, struct nilfs_cpstat *cpstat)
ret = nilfs_cpfile_get_header_block(cpfile, &bh); ret = nilfs_cpfile_get_header_block(cpfile, &bh);
if (ret < 0) if (ret < 0)
goto out_sem; goto out_sem;
kaddr = kmap_atomic(bh->b_page); kaddr = kmap_local_page(bh->b_page);
header = nilfs_cpfile_block_get_header(cpfile, bh, kaddr); header = nilfs_cpfile_block_get_header(cpfile, bh, kaddr);
cpstat->cs_cno = nilfs_mdt_cno(cpfile); cpstat->cs_cno = nilfs_mdt_cno(cpfile);
cpstat->cs_ncps = le64_to_cpu(header->ch_ncheckpoints); cpstat->cs_ncps = le64_to_cpu(header->ch_ncheckpoints);
cpstat->cs_nsss = le64_to_cpu(header->ch_nsnapshots); cpstat->cs_nsss = le64_to_cpu(header->ch_nsnapshots);
kunmap_atomic(kaddr); kunmap_local(kaddr);
brelse(bh); brelse(bh);
out_sem: out_sem:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment