]> Git Repo - linux.git/blame - fs/ocfs2/aops.h
Linux 6.14-rc3
[linux.git] / fs / ocfs2 / aops.h
CommitLineData
328970de 1/* SPDX-License-Identifier: GPL-2.0-or-later */
fa60ce2c 2/*
ccd979bd 3 * Copyright (C) 2002, 2004, 2005 Oracle. All rights reserved.
ccd979bd
MF
4 */
5
6#ifndef OCFS2_AOPS_H
7#define OCFS2_AOPS_H
8
e2e40f2c 9#include <linux/fs.h>
a27bb332 10
0313500d 11int ocfs2_map_folio_blocks(struct folio *folio, u64 *p_blkno,
60b11392
MF
12 struct inode *inode, unsigned int from,
13 unsigned int to, int new);
14
7e119cff 15void ocfs2_unlock_and_free_folios(struct folio **folios, int num_folios);
1d410a6e 16
60b11392
MF
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
7307de80 25int ocfs2_write_end_nolock(struct address_space *mapping,
07f38d97 26 loff_t pos, unsigned len, unsigned copied, void *fsdata);
7307de80 27
c1ad1e3c
RD
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,
b4f3b496
MWO
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);
7307de80 38
03902e65 39int ocfs2_read_inline_data(struct inode *inode, struct folio *folio,
1afc32b9
MF
40 struct buffer_head *di_bh);
41int ocfs2_size_fits_inline_data(struct buffer_head *di_bh, u64 new_size);
42
6f70fa51
TM
43int ocfs2_get_block(struct inode *inode, sector_t iblock,
44 struct buffer_head *bh_result, int create);
ccd979bd
MF
45/* all ocfs2_dio_end_io()'s fault */
46#define ocfs2_iocb_is_rw_locked(iocb) \
47 test_bit(0, (unsigned long *)&iocb->private)
7cdfc3a1
MF
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}
39c99f12
TY
56
57/*
58 * Using a named enum representing lock types in terms of #N bit stored in
25985edc 59 * iocb->private, which is going to be used for communication between
1202d4ba 60 * ocfs2_dio_end_io() and ocfs2_file_write/read_iter().
39c99f12
TY
61 */
62enum ocfs2_iocb_lock_bits {
63 OCFS2_IOCB_RW_LOCK = 0,
64 OCFS2_IOCB_RW_LOCK_LEVEL,
39c99f12
TY
65 OCFS2_IOCB_NUM_LOCKS
66};
67
adc77b19
DA
68#define ocfs2_iocb_init_rw_locked(iocb) \
69 (iocb->private = NULL)
ccd979bd 70#define ocfs2_iocb_clear_rw_locked(iocb) \
39c99f12 71 clear_bit(OCFS2_IOCB_RW_LOCK, (unsigned long *)&iocb->private)
7cdfc3a1 72#define ocfs2_iocb_rw_locked_level(iocb) \
39c99f12 73 test_bit(OCFS2_IOCB_RW_LOCK_LEVEL, (unsigned long *)&iocb->private)
a11f7e63 74
ccd979bd 75#endif /* OCFS2_FILE_H */
This page took 1.358422 seconds and 4 git commands to generate.