linux/fs/bcachefs/fs.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _BCACHEFS_FS_H
#define _BCACHEFS_FS_H

#include "inode.h"
#include "opts.h"
#include "str_hash.h"
#include "quota_types.h"
#include "two_state_shared_lock.h"

#include <linux/seqlock.h>
#include <linux/stat.h>

struct bch_inode_info {};

#define bch2_pagecache_add_put(i)
#define bch2_pagecache_add_tryget(i)
#define bch2_pagecache_add_get(i)

#define bch2_pagecache_block_put(i)
#define bch2_pagecache_block_get(i)

static inline subvol_inum inode_inum(struct bch_inode_info *inode)
{}

/*
 * Set if we've gotten a btree error for this inode, and thus the vfs inode and
 * btree inode may be inconsistent:
 */
#define EI_INODE_ERROR

/*
 * Set in the inode is in a snapshot subvolume - we don't do quota accounting in
 * those:
 */
#define EI_INODE_SNAPSHOT

#define to_bch_ei(_inode)

static inline int ptrcmp(void *l, void *r)
{}

enum bch_inode_lock_op {};

#define bch2_lock_inodes(_locks, ...)

#define bch2_unlock_inodes(_locks, ...)

static inline struct bch_inode_info *file_bch_inode(struct file *file)
{}

static inline bool inode_attr_changing(struct bch_inode_info *dir,
				struct bch_inode_info *inode,
				enum inode_opt_id id)
{}

static inline bool inode_attrs_changing(struct bch_inode_info *dir,
				 struct bch_inode_info *inode)
{}

struct bch_inode_unpacked;

#ifndef NO_BCACHEFS_FS

struct bch_inode_info *
__bch2_create(struct mnt_idmap *, struct bch_inode_info *,
	      struct dentry *, umode_t, dev_t, subvol_inum, unsigned);

int bch2_fs_quota_transfer(struct bch_fs *,
			   struct bch_inode_info *,
			   struct bch_qid,
			   unsigned,
			   enum quota_acct_mode);

static inline int bch2_set_projid(struct bch_fs *c,
				  struct bch_inode_info *inode,
				  u32 projid)
{}

struct inode *bch2_vfs_inode_get(struct bch_fs *, subvol_inum);

/* returns 0 if we want to do the update, or error is passed up */
inode_set_fn;

void bch2_inode_update_after_write(struct btree_trans *,
				   struct bch_inode_info *,
				   struct bch_inode_unpacked *,
				   unsigned);
int __must_check bch2_write_inode(struct bch_fs *, struct bch_inode_info *,
				  inode_set_fn, void *, unsigned);

int bch2_setattr_nonsize(struct mnt_idmap *,
			 struct bch_inode_info *,
			 struct iattr *);
int __bch2_unlink(struct inode *, struct dentry *, bool);

void bch2_evict_subvolume_inodes(struct bch_fs *, snapshot_id_list *);

void bch2_vfs_exit(void);
int bch2_vfs_init(void);

#else

#define bch2_inode_update_after_write

static inline void bch2_evict_subvolume_inodes(struct bch_fs *c,
					       snapshot_id_list *s) {}
static inline void bch2_vfs_exit(void) {}
static inline int bch2_vfs_init(void) { return 0; }

#endif /* NO_BCACHEFS_FS */

#endif /* _BCACHEFS_FS_H */