affs-for-6.6-tag

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE8rQSAMVO+zA4DBdWxWXV+ddtWDsFAmTsk7MACgkQxWXV+ddt
 WDsKjRAAoKY1qtApAMWl7vX+fw4pyoexrZISvzsJpCmPDV0SlKZ8CqOfYGhyT845
 /pYUB8oxCm8UgpbswCTDVzppFANVqJBRIQEQc9d6yej4bA62Z/4Z561xROE1BEsO
 UR2UIKw4gtpAmSlCoLYljt4Eg0izRt0MNmYvIk9ccQTIzVO8u2E8keNW76OSbAW1
 J9AH0KgrxPgK9GPN/MlWg8THyuWgP3p/Qf4QS6JcDRCNFr4gmNwxP8Cj1kifYVT/
 iMxghN+Z2iFPN8gHIeebjYpyoJJ4ZHRVL9mUZ0SLwcbt6ZfV5DnYn2yepkxxHfyL
 CaUrRNJHE3Cb4vyJgtvVoAHE78Bqyk4WHKirNnrHly5j8K9ba3PIEpL+XjDVUckA
 597xlrBsaQhlvMHXn+sMOMAMs7EVkUfR/gzSoLirWWOlLJ9skl3H8vK/BunK1bo+
 +YYwMJwPtv3HmCdMbb00Rm9D2vVSVYM4iydEjmW6ILWBgecQII5O14CmkSH9zoG7
 sip4O5oDkxmnoq9TuKPjS6AEPi+6UsbCsv8Z8boXdj97w4+bJIZVGbDHXvdAIEkj
 2NmrYgqCqcbB46cSIc2VF1Fx0WO8Jh+GTFYGAPGFrabLFDVWeuwtdJahbYnSrmuL
 whMVNSH4sooZflCWjwANhV8H5wlIatnn+xh+lX3TWpKiBeqIGpw=
 =wPHe
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2023-08-28 12:18:26 -07:00
commit f678c890c6
2 changed files with 19 additions and 15 deletions

View File

@ -15,6 +15,7 @@
#include <linux/uio.h>
#include <linux/blkdev.h>
#include <linux/mpage.h>
#include "affs.h"
static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext);
@ -370,9 +371,10 @@ err_alloc:
return -ENOSPC;
}
static int affs_writepage(struct page *page, struct writeback_control *wbc)
static int affs_writepages(struct address_space *mapping,
struct writeback_control *wbc)
{
return block_write_full_page(page, affs_get_block, wbc);
return mpage_writepages(mapping, wbc, affs_get_block);
}
static int affs_read_folio(struct file *file, struct folio *folio)
@ -456,10 +458,11 @@ const struct address_space_operations affs_aops = {
.dirty_folio = block_dirty_folio,
.invalidate_folio = block_invalidate_folio,
.read_folio = affs_read_folio,
.writepage = affs_writepage,
.writepages = affs_writepages,
.write_begin = affs_write_begin,
.write_end = affs_write_end,
.direct_IO = affs_direct_IO,
.migrate_folio = buffer_migrate_folio,
.bmap = _affs_bmap
};
@ -835,9 +838,10 @@ const struct address_space_operations affs_aops_ofs = {
.dirty_folio = block_dirty_folio,
.invalidate_folio = block_invalidate_folio,
.read_folio = affs_read_folio_ofs,
//.writepage = affs_writepage_ofs,
//.writepages = affs_writepages_ofs,
.write_begin = affs_write_begin_ofs,
.write_end = affs_write_end_ofs
.write_end = affs_write_end_ofs,
.migrate_folio = filemap_migrate_folio,
};
/* Free any preallocated blocks. */

View File

@ -43,7 +43,7 @@ affs_get_toupper(struct super_block *sb)
* Note: the dentry argument is the parent dentry.
*/
static inline int
__affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t toupper, bool notruncate)
__affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t fn, bool notruncate)
{
const u8 *name = qstr->name;
unsigned long hash;
@ -57,7 +57,7 @@ __affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t tou
hash = init_name_hash(dentry);
len = min(qstr->len, AFFSNAMEMAX);
for (; len > 0; name++, len--)
hash = partial_name_hash(toupper(*name), hash);
hash = partial_name_hash(fn(*name), hash);
qstr->hash = end_name_hash(hash);
return 0;
@ -80,7 +80,7 @@ affs_intl_hash_dentry(const struct dentry *dentry, struct qstr *qstr)
}
static inline int __affs_compare_dentry(unsigned int len,
const char *str, const struct qstr *name, toupper_t toupper,
const char *str, const struct qstr *name, toupper_t fn,
bool notruncate)
{
const u8 *aname = str;
@ -106,7 +106,7 @@ static inline int __affs_compare_dentry(unsigned int len,
return 1;
for (; len > 0; len--)
if (toupper(*aname++) != toupper(*bname++))
if (fn(*aname++) != fn(*bname++))
return 1;
return 0;
@ -135,7 +135,7 @@ affs_intl_compare_dentry(const struct dentry *dentry,
*/
static inline int
affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
affs_match(struct dentry *dentry, const u8 *name2, toupper_t fn)
{
const u8 *name = dentry->d_name.name;
int len = dentry->d_name.len;
@ -148,7 +148,7 @@ affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
return 0;
for (name2++; len > 0; len--)
if (toupper(*name++) != toupper(*name2++))
if (fn(*name++) != fn(*name2++))
return 0;
return 1;
}
@ -156,12 +156,12 @@ affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
int
affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len)
{
toupper_t toupper = affs_get_toupper(sb);
toupper_t fn = affs_get_toupper(sb);
u32 hash;
hash = len = min(len, AFFSNAMEMAX);
for (; len > 0; len--)
hash = (hash * 13 + toupper(*name++)) & 0x7ff;
hash = (hash * 13 + fn(*name++)) & 0x7ff;
return hash % AFFS_SB(sb)->s_hashsize;
}
@ -171,7 +171,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry)
{
struct super_block *sb = dir->i_sb;
struct buffer_head *bh;
toupper_t toupper = affs_get_toupper(sb);
toupper_t fn = affs_get_toupper(sb);
u32 key;
pr_debug("%s(\"%pd\")\n", __func__, dentry);
@ -189,7 +189,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry)
bh = affs_bread(sb, key);
if (!bh)
return ERR_PTR(-EIO);
if (affs_match(dentry, AFFS_TAIL(sb, bh)->name, toupper))
if (affs_match(dentry, AFFS_TAIL(sb, bh)->name, fn))
return bh;
key = be32_to_cpu(AFFS_TAIL(sb, bh)->hash_chain);
}