super.h (e7f72952508ac4354f9bec0607ac8a200d050e65) super.h (d4f6b31d721779d91b5e2f8072478af73b196c34)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _FS_CEPH_SUPER_H
3#define _FS_CEPH_SUPER_H
4
5#include <linux/ceph/ceph_debug.h>
6
7#include <asm/unaligned.h>
8#include <linux/backing-dev.h>

--- 515 unchanged lines hidden (view full) ---

524static inline int ceph_ino_compare(struct inode *inode, void *data)
525{
526 struct ceph_vino *pvino = (struct ceph_vino *)data;
527 struct ceph_inode_info *ci = ceph_inode(inode);
528 return ci->i_vino.ino == pvino->ino &&
529 ci->i_vino.snap == pvino->snap;
530}
531
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _FS_CEPH_SUPER_H
3#define _FS_CEPH_SUPER_H
4
5#include <linux/ceph/ceph_debug.h>
6
7#include <asm/unaligned.h>
8#include <linux/backing-dev.h>

--- 515 unchanged lines hidden (view full) ---

524static inline int ceph_ino_compare(struct inode *inode, void *data)
525{
526 struct ceph_vino *pvino = (struct ceph_vino *)data;
527 struct ceph_inode_info *ci = ceph_inode(inode);
528 return ci->i_vino.ino == pvino->ino &&
529 ci->i_vino.snap == pvino->snap;
530}
531
532/*
533 * The MDS reserves a set of inodes for its own usage. These should never
534 * be accessible by clients, and so the MDS has no reason to ever hand these
535 * out. The range is CEPH_MDS_INO_MDSDIR_OFFSET..CEPH_INO_SYSTEM_BASE.
536 *
537 * These come from src/mds/mdstypes.h in the ceph sources.
538 */
539#define CEPH_MAX_MDS 0x100
540#define CEPH_NUM_STRAY 10
541#define CEPH_MDS_INO_MDSDIR_OFFSET (1 * CEPH_MAX_MDS)
542#define CEPH_INO_SYSTEM_BASE ((6*CEPH_MAX_MDS) + (CEPH_MAX_MDS * CEPH_NUM_STRAY))
532
543
544static inline bool ceph_vino_is_reserved(const struct ceph_vino vino)
545{
546 if (vino.ino < CEPH_INO_SYSTEM_BASE &&
547 vino.ino >= CEPH_MDS_INO_MDSDIR_OFFSET) {
548 WARN_RATELIMIT(1, "Attempt to access reserved inode number 0x%llx", vino.ino);
549 return true;
550 }
551 return false;
552}
553
533static inline struct inode *ceph_find_inode(struct super_block *sb,
534 struct ceph_vino vino)
535{
554static inline struct inode *ceph_find_inode(struct super_block *sb,
555 struct ceph_vino vino)
556{
557 if (ceph_vino_is_reserved(vino))
558 return NULL;
559
536 /*
537 * NB: The hashval will be run through the fs/inode.c hash function
538 * anyway, so there is no need to squash the inode number down to
539 * 32-bits first. Just use low-order bits on arches with 32-bit long.
540 */
541 return ilookup5(sb, (unsigned long)vino.ino, ceph_ino_compare, &vino);
542}
543

--- 723 unchanged lines hidden ---
560 /*
561 * NB: The hashval will be run through the fs/inode.c hash function
562 * anyway, so there is no need to squash the inode number down to
563 * 32-bits first. Just use low-order bits on arches with 32-bit long.
564 */
565 return ilookup5(sb, (unsigned long)vino.ino, ceph_ino_compare, &vino);
566}
567

--- 723 unchanged lines hidden ---