Skip to content

Commit f678c89

Browse files
committed
Merge tag 'affs-for-6.6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull affs updates from David Sterba: "Two minor updates for AFFS: - reimplement writepage() address space callback on top of migrate_folio() - fix a build warning, local parameters 'toupper' collide with the standard ctype.h name" * tag 'affs-for-6.6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: affs: rename local toupper() to fn() to avoid confusion affs: remove writepage implementation
2 parents 3bb156a + 4d4f146 commit f678c89

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

fs/affs/file.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <linux/uio.h>
1717
#include <linux/blkdev.h>
18+
#include <linux/mpage.h>
1819
#include "affs.h"
1920

2021
static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext);
@@ -370,9 +371,10 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
370371
return -ENOSPC;
371372
}
372373

373-
static int affs_writepage(struct page *page, struct writeback_control *wbc)
374+
static int affs_writepages(struct address_space *mapping,
375+
struct writeback_control *wbc)
374376
{
375-
return block_write_full_page(page, affs_get_block, wbc);
377+
return mpage_writepages(mapping, wbc, affs_get_block);
376378
}
377379

378380
static int affs_read_folio(struct file *file, struct folio *folio)
@@ -456,10 +458,11 @@ const struct address_space_operations affs_aops = {
456458
.dirty_folio = block_dirty_folio,
457459
.invalidate_folio = block_invalidate_folio,
458460
.read_folio = affs_read_folio,
459-
.writepage = affs_writepage,
461+
.writepages = affs_writepages,
460462
.write_begin = affs_write_begin,
461463
.write_end = affs_write_end,
462464
.direct_IO = affs_direct_IO,
465+
.migrate_folio = buffer_migrate_folio,
463466
.bmap = _affs_bmap
464467
};
465468

@@ -835,9 +838,10 @@ const struct address_space_operations affs_aops_ofs = {
835838
.dirty_folio = block_dirty_folio,
836839
.invalidate_folio = block_invalidate_folio,
837840
.read_folio = affs_read_folio_ofs,
838-
//.writepage = affs_writepage_ofs,
841+
//.writepages = affs_writepages_ofs,
839842
.write_begin = affs_write_begin_ofs,
840-
.write_end = affs_write_end_ofs
843+
.write_end = affs_write_end_ofs,
844+
.migrate_folio = filemap_migrate_folio,
841845
};
842846

843847
/* Free any preallocated blocks. */

fs/affs/namei.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ affs_get_toupper(struct super_block *sb)
4343
* Note: the dentry argument is the parent dentry.
4444
*/
4545
static inline int
46-
__affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t toupper, bool notruncate)
46+
__affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t fn, bool notruncate)
4747
{
4848
const u8 *name = qstr->name;
4949
unsigned long hash;
@@ -57,7 +57,7 @@ __affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t tou
5757
hash = init_name_hash(dentry);
5858
len = min(qstr->len, AFFSNAMEMAX);
5959
for (; len > 0; name++, len--)
60-
hash = partial_name_hash(toupper(*name), hash);
60+
hash = partial_name_hash(fn(*name), hash);
6161
qstr->hash = end_name_hash(hash);
6262

6363
return 0;
@@ -80,7 +80,7 @@ affs_intl_hash_dentry(const struct dentry *dentry, struct qstr *qstr)
8080
}
8181

8282
static inline int __affs_compare_dentry(unsigned int len,
83-
const char *str, const struct qstr *name, toupper_t toupper,
83+
const char *str, const struct qstr *name, toupper_t fn,
8484
bool notruncate)
8585
{
8686
const u8 *aname = str;
@@ -106,7 +106,7 @@ static inline int __affs_compare_dentry(unsigned int len,
106106
return 1;
107107

108108
for (; len > 0; len--)
109-
if (toupper(*aname++) != toupper(*bname++))
109+
if (fn(*aname++) != fn(*bname++))
110110
return 1;
111111

112112
return 0;
@@ -135,7 +135,7 @@ affs_intl_compare_dentry(const struct dentry *dentry,
135135
*/
136136

137137
static inline int
138-
affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
138+
affs_match(struct dentry *dentry, const u8 *name2, toupper_t fn)
139139
{
140140
const u8 *name = dentry->d_name.name;
141141
int len = dentry->d_name.len;
@@ -148,20 +148,20 @@ affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
148148
return 0;
149149

150150
for (name2++; len > 0; len--)
151-
if (toupper(*name++) != toupper(*name2++))
151+
if (fn(*name++) != fn(*name2++))
152152
return 0;
153153
return 1;
154154
}
155155

156156
int
157157
affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len)
158158
{
159-
toupper_t toupper = affs_get_toupper(sb);
159+
toupper_t fn = affs_get_toupper(sb);
160160
u32 hash;
161161

162162
hash = len = min(len, AFFSNAMEMAX);
163163
for (; len > 0; len--)
164-
hash = (hash * 13 + toupper(*name++)) & 0x7ff;
164+
hash = (hash * 13 + fn(*name++)) & 0x7ff;
165165

166166
return hash % AFFS_SB(sb)->s_hashsize;
167167
}
@@ -171,7 +171,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry)
171171
{
172172
struct super_block *sb = dir->i_sb;
173173
struct buffer_head *bh;
174-
toupper_t toupper = affs_get_toupper(sb);
174+
toupper_t fn = affs_get_toupper(sb);
175175
u32 key;
176176

177177
pr_debug("%s(\"%pd\")\n", __func__, dentry);
@@ -189,7 +189,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry)
189189
bh = affs_bread(sb, key);
190190
if (!bh)
191191
return ERR_PTR(-EIO);
192-
if (affs_match(dentry, AFFS_TAIL(sb, bh)->name, toupper))
192+
if (affs_match(dentry, AFFS_TAIL(sb, bh)->name, fn))
193193
return bh;
194194
key = be32_to_cpu(AFFS_TAIL(sb, bh)->hash_chain);
195195
}

0 commit comments

Comments
 (0)