Re: [PATCH 7/8] rpdfs: add rpdfs_write_iter/rpdfs_read_iter

Zach Brown <[email protected]> Mon, 27 Apr 2026 16:19:34 -0700
Newsgroups dev.linux.lists.rpdfs-devel
Message-ID <[email protected]>
On Fri, Apr 24, 2026 at 04:05:19PM +0200, Valerie Aurora wrote:
> Implement write_iter/read_iter with generic functions.

> +static ssize_t rpdfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
> +{
> +	struct file *file = iocb->ki_filp;
> +	struct inode *inode = file_inode(file);
> +	int ret;
> +
> +	rpdfs_prd("ino %llu count %lu pos %lu",
> +		  rpdfs_inode_ino(inode), iov_iter_count(from), (unsigned long) iocb->ki_pos);
> +
> +	ret = generic_write_checks(iocb, from);
> +	if (ret <= 0)
> +		goto out;
> +
> +	ret = generic_perform_write(iocb, from);
> +out:
> +	return ret;
> +}

This needs to refresh the inode and serialize with both local and remote
writers.  generic_file_write_iter() shows the pattern, but we need to
serialize with the network inside of the inode_lock().  We'd copy it and
nest our network locking inside the inode_lock().

This is where the block cache offering "locking" comes in.  Today we'd
get the inode block handle here, but we can't hold that across all of
the _perform_write because that could make an enormous transaction.  We
should add the call that pins/unpins write mode on the inode block while
it can be dirtied and written as many times as needed.

- z