18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* -*- mode: c; c-basic-offset: 8; -*- 38c2ecf20Sopenharmony_ci * vim: noexpandtab sw=8 ts=8 sts=0: 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2002, 2004, 2005 Oracle. All rights reserved. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef OCFS2_AOPS_H 98c2ecf20Sopenharmony_ci#define OCFS2_AOPS_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/fs.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cihandle_t *ocfs2_start_walk_page_trans(struct inode *inode, 148c2ecf20Sopenharmony_ci struct page *page, 158c2ecf20Sopenharmony_ci unsigned from, 168c2ecf20Sopenharmony_ci unsigned to); 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciint ocfs2_map_page_blocks(struct page *page, u64 *p_blkno, 198c2ecf20Sopenharmony_ci struct inode *inode, unsigned int from, 208c2ecf20Sopenharmony_ci unsigned int to, int new); 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_civoid ocfs2_unlock_and_free_pages(struct page **pages, int num_pages); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciint walk_page_buffers( handle_t *handle, 258c2ecf20Sopenharmony_ci struct buffer_head *head, 268c2ecf20Sopenharmony_ci unsigned from, 278c2ecf20Sopenharmony_ci unsigned to, 288c2ecf20Sopenharmony_ci int *partial, 298c2ecf20Sopenharmony_ci int (*fn)( handle_t *handle, 308c2ecf20Sopenharmony_ci struct buffer_head *bh)); 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciint ocfs2_write_end_nolock(struct address_space *mapping, 338c2ecf20Sopenharmony_ci loff_t pos, unsigned len, unsigned copied, void *fsdata); 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_citypedef enum { 368c2ecf20Sopenharmony_ci OCFS2_WRITE_BUFFER = 0, 378c2ecf20Sopenharmony_ci OCFS2_WRITE_DIRECT, 388c2ecf20Sopenharmony_ci OCFS2_WRITE_MMAP, 398c2ecf20Sopenharmony_ci} ocfs2_write_type_t; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciint ocfs2_write_begin_nolock(struct address_space *mapping, 428c2ecf20Sopenharmony_ci loff_t pos, unsigned len, ocfs2_write_type_t type, 438c2ecf20Sopenharmony_ci struct page **pagep, void **fsdata, 448c2ecf20Sopenharmony_ci struct buffer_head *di_bh, struct page *mmap_page); 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ciint ocfs2_read_inline_data(struct inode *inode, struct page *page, 478c2ecf20Sopenharmony_ci struct buffer_head *di_bh); 488c2ecf20Sopenharmony_ciint ocfs2_size_fits_inline_data(struct buffer_head *di_bh, u64 new_size); 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciint ocfs2_get_block(struct inode *inode, sector_t iblock, 518c2ecf20Sopenharmony_ci struct buffer_head *bh_result, int create); 528c2ecf20Sopenharmony_ci/* all ocfs2_dio_end_io()'s fault */ 538c2ecf20Sopenharmony_ci#define ocfs2_iocb_is_rw_locked(iocb) \ 548c2ecf20Sopenharmony_ci test_bit(0, (unsigned long *)&iocb->private) 558c2ecf20Sopenharmony_cistatic inline void ocfs2_iocb_set_rw_locked(struct kiocb *iocb, int level) 568c2ecf20Sopenharmony_ci{ 578c2ecf20Sopenharmony_ci set_bit(0, (unsigned long *)&iocb->private); 588c2ecf20Sopenharmony_ci if (level) 598c2ecf20Sopenharmony_ci set_bit(1, (unsigned long *)&iocb->private); 608c2ecf20Sopenharmony_ci else 618c2ecf20Sopenharmony_ci clear_bit(1, (unsigned long *)&iocb->private); 628c2ecf20Sopenharmony_ci} 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci * Using a named enum representing lock types in terms of #N bit stored in 668c2ecf20Sopenharmony_ci * iocb->private, which is going to be used for communication between 678c2ecf20Sopenharmony_ci * ocfs2_dio_end_io() and ocfs2_file_write/read_iter(). 688c2ecf20Sopenharmony_ci */ 698c2ecf20Sopenharmony_cienum ocfs2_iocb_lock_bits { 708c2ecf20Sopenharmony_ci OCFS2_IOCB_RW_LOCK = 0, 718c2ecf20Sopenharmony_ci OCFS2_IOCB_RW_LOCK_LEVEL, 728c2ecf20Sopenharmony_ci OCFS2_IOCB_NUM_LOCKS 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define ocfs2_iocb_clear_rw_locked(iocb) \ 768c2ecf20Sopenharmony_ci clear_bit(OCFS2_IOCB_RW_LOCK, (unsigned long *)&iocb->private) 778c2ecf20Sopenharmony_ci#define ocfs2_iocb_rw_locked_level(iocb) \ 788c2ecf20Sopenharmony_ci test_bit(OCFS2_IOCB_RW_LOCK_LEVEL, (unsigned long *)&iocb->private) 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#endif /* OCFS2_FILE_H */ 81