Offering: HULK hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT
--------------------------------
So that the same helper function can be used when determining whether a new version of xattr is needed.
Signed-off-by: Baokun Li libaokun1@huawei.com --- fs/cachefiles/key.c | 12 ++++++------ fs/erofs/fscache.c | 2 +- fs/fscache/cookie.c | 4 ++-- include/linux/fscache.h | 14 +++++++------- 4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/fs/cachefiles/key.c b/fs/cachefiles/key.c index 772ad69c49ba..d1adeb58f35c 100644 --- a/fs/cachefiles/key.c +++ b/fs/cachefiles/key.c @@ -41,10 +41,10 @@ static int cachefiles_cook_csum(struct fscache_cookie *cookie, const u8 *raw, unsigned char csum = 0; int loop;
- if (volume_new_location(cookie)) + if (volume_new_version(cookie)) return 1;
- if (data_new_location(cookie)) { + if (data_new_version(cookie)) { csum = (u8)cookie->key_hash; } else { for (loop = 0; loop < keylen; loop++) @@ -156,7 +156,7 @@ char *cachefiles_cook_key(struct cachefiles_object *object, BUG_ON(keylen < 2 || keylen > 514);
print = 1; - if (!volume_new_location(cookie)) { + if (!volume_new_version(cookie)) { for (loop = 2; loop < keylen; loop++) print &= cachefiles_filecharmap[raw[loop]]; } @@ -170,7 +170,7 @@ char *cachefiles_cook_key(struct cachefiles_object *object, * is ((514 + 251) / 252) = 3 */ max += 1; /* NUL on end */ - } else if (data_new_location(cookie)) { + } else if (data_new_version(cookie)) { max = 5; /* @checksum/M */ max += 1; /* NUL on end */ } else { @@ -197,7 +197,7 @@ char *cachefiles_cook_key(struct cachefiles_object *object, mark = len - 1;
if (print) { - if (!volume_new_location(cookie) && !data_new_location(cookie)) + if (!volume_new_version(cookie) && !data_new_version(cookie)) cachefiles_cook_acc(key, *(uint16_t *) raw, &len); raw += 2; seg = 250; @@ -218,7 +218,7 @@ char *cachefiles_cook_key(struct cachefiles_object *object, case FSCACHE_COOKIE_TYPE_DATAFILE: type = 'D'; break; default: type = 'S'; break; } - } else if (data_new_location(cookie)) { + } else if (data_new_version(cookie)) { int nlen; char *name = cachefiles_cook_data_key(raw + 2, keylen - 2); char *new_key; diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index 2389b50c7906..17640adf574d 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -30,7 +30,7 @@ const struct fscache_cookie_def erofs_fscache_super_index_def = { .name = "EROFS.super", .type = FSCACHE_COOKIE_TYPE_INDEX, .check_aux = NULL, - .new_location = true, + .new_version = true, };
const struct fscache_cookie_def erofs_fscache_inode_object_def = { diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c index fd1a05821a6c..bd4a6734d163 100644 --- a/fs/fscache/cookie.c +++ b/fs/fscache/cookie.c @@ -87,10 +87,10 @@ static int fscache_set_key_hash(struct fscache_cookie *cookie, u32 *buf, { unsigned int salt = 0;
- if (volume_new_location(cookie)) + if (volume_new_version(cookie)) return fscache_set_volume_key_hash(cookie, buf);
- if (data_new_location(cookie)) + if (data_new_version(cookie)) salt = cookie->parent->key_hash;
cookie->key_hash = fscache_hash(salt, buf, bufs); diff --git a/include/linux/fscache.h b/include/linux/fscache.h index 40ede2ff29dc..d4af91675c3c 100644 --- a/include/linux/fscache.h +++ b/include/linux/fscache.h @@ -71,10 +71,10 @@ struct fscache_cookie_def { #define FSCACHE_COOKIE_TYPE_DATAFILE 1
/* - * Used for index cookie. If set, the location of cachefile will be the - * same as mainline kernel v5.18+. + * Used for index cookie. If set, the location/xattr of cachefiles + * will be the same as mainline kernel v5.18+. */ - bool new_location; + bool new_version;
/* select the cache into which to insert an entry in this index * - optional @@ -882,18 +882,18 @@ void fscache_enable_cookie(struct fscache_cookie *cookie, can_enable, data); }
-static inline bool volume_new_location(struct fscache_cookie *cookie) +static inline bool volume_new_version(struct fscache_cookie *cookie) { return cookie->def && cookie->type == FSCACHE_COOKIE_TYPE_INDEX && - cookie->def->new_location; + cookie->def->new_version; }
-static inline bool data_new_location(struct fscache_cookie *cookie) +static inline bool data_new_version(struct fscache_cookie *cookie) { if (cookie->type != FSCACHE_COOKIE_TYPE_DATAFILE) return false;
- return cookie->parent && volume_new_location(cookie->parent); + return cookie->parent && volume_new_version(cookie->parent); }
#endif /* _LINUX_FSCACHE_H */