// SPDX-License-Identifier: GPL-2.0 /* * Copyright 1999 Hans Reiser, see reiserfs/README for licensing and copyright * details */ #include <linux/time.h> #include <linux/pagemap.h> #include <linux/buffer_head.h> #include "reiserfs.h" /* * access to tail : when one is going to read tail it must make sure, that is * not running. direct2indirect and indirect2direct can not run concurrently */ /* * Converts direct items to an unformatted node. Panics if file has no * tail. -ENOSPC if no disk space for conversion */ /* * path points to first direct item of the file regardless of how many of * them are there */ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode, struct treepath *path, struct buffer_head *unbh, loff_t tail_offset) { … } /* stolen from fs/buffer.c */ void reiserfs_unmap_buffer(struct buffer_head *bh) { … } /* * this first locks inode (neither reads nor sync are permitted), * reads tail through page cache, insert direct item. When direct item * inserted successfully inode is left locked. Return value is always * what we expect from it (number of cut bytes). But when tail remains * in the unformatted node, we set mode to SKIP_BALANCING and unlock * inode */ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *inode, struct page *page, struct treepath *path, /* path to the indirect item. */ const struct cpu_key *item_key, /* Key to look for * unformatted node * pointer to be cut. */ loff_t n_new_file_size, /* New file size. */ char *mode) { … }