File Index
Files and directories
Sign in
FILE

aops.h

File preview with syntax highlighting.

linux-6.19.14/fs/ocfs2/aops.h C
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2/*
 3 * Copyright (C) 2002, 2004, 2005 Oracle.  All rights reserved.
 4 */
 5
 6#ifndef OCFS2_AOPS_H
 7#define OCFS2_AOPS_H
 8
 9#include <linux/fs.h>
10
11int ocfs2_map_folio_blocks(struct folio *folio, u64 *p_blkno,
12			  struct inode *inode, unsigned int from,
13			  unsigned int to, int new);
14
15void ocfs2_unlock_and_free_folios(struct folio **folios, int num_folios);
16
17int walk_page_buffers(	handle_t *handle,
18			struct buffer_head *head,
19			unsigned from,
20			unsigned to,
21			int *partial,
22			int (*fn)(	handle_t *handle,
23					struct buffer_head *bh));
24
25int ocfs2_write_end_nolock(struct address_space *mapping,
26			   loff_t pos, unsigned len, unsigned copied, void *fsdata);
27
28typedef enum {
29	OCFS2_WRITE_BUFFER = 0,
30	OCFS2_WRITE_DIRECT,
31	OCFS2_WRITE_MMAP,
32} ocfs2_write_type_t;
33
34int ocfs2_write_begin_nolock(struct address_space *mapping,
35		loff_t pos, unsigned len, ocfs2_write_type_t type,
36		struct folio **foliop, void **fsdata,
37		struct buffer_head *di_bh, struct folio *mmap_folio);
38
39int ocfs2_read_inline_data(struct inode *inode, struct folio *folio,
40			   struct buffer_head *di_bh);
41int ocfs2_size_fits_inline_data(struct buffer_head *di_bh, u64 new_size);
42
43int ocfs2_get_block(struct inode *inode, sector_t iblock,
44		    struct buffer_head *bh_result, int create);
45/* all ocfs2_dio_end_io()'s fault */
46#define ocfs2_iocb_is_rw_locked(iocb) \
47	test_bit(0, (unsigned long *)&iocb->private)
48static inline void ocfs2_iocb_set_rw_locked(struct kiocb *iocb, int level)
49{
50	set_bit(0, (unsigned long *)&iocb->private);
51	if (level)
52		set_bit(1, (unsigned long *)&iocb->private);
53	else
54		clear_bit(1, (unsigned long *)&iocb->private);
55}
56
57/*
58 * Using a named enum representing lock types in terms of #N bit stored in
59 * iocb->private, which is going to be used for communication between
60 * ocfs2_dio_end_io() and ocfs2_file_write/read_iter().
61 */
62enum ocfs2_iocb_lock_bits {
63	OCFS2_IOCB_RW_LOCK = 0,
64	OCFS2_IOCB_RW_LOCK_LEVEL,
65	OCFS2_IOCB_NUM_LOCKS
66};
67
68#define ocfs2_iocb_init_rw_locked(iocb) \
69	(iocb->private = NULL)
70#define ocfs2_iocb_clear_rw_locked(iocb) \
71	clear_bit(OCFS2_IOCB_RW_LOCK, (unsigned long *)&iocb->private)
72#define ocfs2_iocb_rw_locked_level(iocb) \
73	test_bit(OCFS2_IOCB_RW_LOCK_LEVEL, (unsigned long *)&iocb->private)
74
75#endif /* OCFS2_FILE_H */
~/ Read-only file preview.