Commit 163eae0f authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Christian Brauner
Browse files

netfs: Switch debug logging to pr_debug()



Instead of inventing a custom way to conditionally enable debugging,
just make use of pr_debug(), which also has dynamic debugging facilities
and is more likely known to someone who hunts a problem in the netfs
code. Also drop the module parameter netfs_debug which didn't have any
effect without further source changes. (The variable netfs_debug was
only used in #ifdef blocks for cpp vars that don't exist; Note that
CONFIG_NETFS_DEBUG isn't settable via kconfig, a variable with that name
never existed in the mainline and is probably just taken over (and
renamed) from similar custom debug logging implementations.)

Signed-off-by: default avatarUwe Kleine-König <ukleinek@kernel.org>
Link: https://lore.kernel.org/r/20240608151352.22860-2-ukleinek@kernel.org


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 1613e604
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ void netfs_rreq_unlock_folios(struct netfs_io_request *rreq)
		if (!test_bit(NETFS_RREQ_DONT_UNLOCK_FOLIOS, &rreq->flags)) {
			if (folio->index == rreq->no_unlock_folio &&
			    test_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags))
				_debug("no unlock");
				kdebug("no unlock");
			else
				folio_unlock(folio);
		}
@@ -204,7 +204,7 @@ void netfs_readahead(struct readahead_control *ractl)
	struct netfs_inode *ctx = netfs_inode(ractl->mapping->host);
	int ret;

	_enter("%lx,%x", readahead_index(ractl), readahead_count(ractl));
	kenter("%lx,%x", readahead_index(ractl), readahead_count(ractl));

	if (readahead_count(ractl) == 0)
		return;
@@ -268,7 +268,7 @@ int netfs_read_folio(struct file *file, struct folio *folio)
	struct folio *sink = NULL;
	int ret;

	_enter("%lx", folio->index);
	kenter("%lx", folio->index);

	rreq = netfs_alloc_request(mapping, file,
				   folio_file_pos(folio), folio_size(folio),
@@ -508,7 +508,7 @@ int netfs_write_begin(struct netfs_inode *ctx,

have_folio:
	*_folio = folio;
	_leave(" = 0");
	kleave(" = 0");
	return 0;

error_put:
@@ -518,7 +518,7 @@ int netfs_write_begin(struct netfs_inode *ctx,
		folio_unlock(folio);
		folio_put(folio);
	}
	_leave(" = %d", ret);
	kleave(" = %d", ret);
	return ret;
}
EXPORT_SYMBOL(netfs_write_begin);
@@ -536,7 +536,7 @@ int netfs_prefetch_for_write(struct file *file, struct folio *folio,
	size_t flen = folio_size(folio);
	int ret;

	_enter("%zx @%llx", flen, start);
	kenter("%zx @%llx", flen, start);

	ret = -ENOMEM;

@@ -567,7 +567,7 @@ int netfs_prefetch_for_write(struct file *file, struct folio *folio,
error_put:
	netfs_put_request(rreq, false, netfs_rreq_trace_put_discard);
error:
	_leave(" = %d", ret);
	kleave(" = %d", ret);
	return ret;
}

+6 −6
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static enum netfs_how_to_modify netfs_how_to_modify(struct netfs_inode *ctx,
	struct netfs_group *group = netfs_folio_group(folio);
	loff_t pos = folio_file_pos(folio);

	_enter("");
	kenter("");

	if (group != netfs_group && group != NETFS_FOLIO_COPY_TO_CACHE)
		return NETFS_FLUSH_CONTENT;
@@ -272,12 +272,12 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,
		 */
		howto = netfs_how_to_modify(ctx, file, folio, netfs_group,
					    flen, offset, part, maybe_trouble);
		_debug("howto %u", howto);
		kdebug("howto %u", howto);
		switch (howto) {
		case NETFS_JUST_PREFETCH:
			ret = netfs_prefetch_for_write(file, folio, offset, part);
			if (ret < 0) {
				_debug("prefetch = %zd", ret);
				kdebug("prefetch = %zd", ret);
				goto error_folio_unlock;
			}
			break;
@@ -418,7 +418,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,
	}

	iocb->ki_pos += written;
	_leave(" = %zd [%zd]", written, ret);
	kleave(" = %zd [%zd]", written, ret);
	return written ? written : ret;

error_folio_unlock:
@@ -491,7 +491,7 @@ ssize_t netfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
	struct netfs_inode *ictx = netfs_inode(inode);
	ssize_t ret;

	_enter("%llx,%zx,%llx", iocb->ki_pos, iov_iter_count(from), i_size_read(inode));
	kenter("%llx,%zx,%llx", iocb->ki_pos, iov_iter_count(from), i_size_read(inode));

	if (!iov_iter_count(from))
		return 0;
@@ -528,7 +528,7 @@ vm_fault_t netfs_page_mkwrite(struct vm_fault *vmf, struct netfs_group *netfs_gr
	vm_fault_t ret = VM_FAULT_RETRY;
	int err;

	_enter("%lx", folio->index);
	kenter("%lx", folio->index);

	sb_start_pagefault(inode->i_sb);

+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *i
	size_t orig_count = iov_iter_count(iter);
	bool async = !is_sync_kiocb(iocb);

	_enter("");
	kenter("");

	if (!orig_count)
		return 0; /* Don't update atime */
+4 −4
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *
	size_t len = iov_iter_count(iter);
	bool async = !is_sync_kiocb(iocb);

	_enter("");
	kenter("");

	/* We're going to need a bounce buffer if what we transmit is going to
	 * be different in some way to the source buffer, e.g. because it gets
@@ -45,7 +45,7 @@ ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *
	 */
	// TODO

	_debug("uw %llx-%llx", start, end);
	kdebug("uw %llx-%llx", start, end);

	wreq = netfs_create_write_req(iocb->ki_filp->f_mapping, iocb->ki_filp, start,
				      iocb->ki_flags & IOCB_DIRECT ?
@@ -95,7 +95,7 @@ ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *
	wreq->cleanup = netfs_cleanup_dio_write;
	ret = netfs_unbuffered_write(wreq, is_sync_kiocb(iocb), iov_iter_count(&wreq->io_iter));
	if (ret < 0) {
		_debug("begin = %zd", ret);
		kdebug("begin = %zd", ret);
		goto out;
	}

@@ -142,7 +142,7 @@ ssize_t netfs_unbuffered_write_iter(struct kiocb *iocb, struct iov_iter *from)
	loff_t pos = iocb->ki_pos;
	unsigned long long end = pos + iov_iter_count(from) - 1;

	_enter("%llx,%zx,%llx", pos, iov_iter_count(from), i_size_read(inode));
	kenter("%llx,%zx,%llx", pos, iov_iter_count(from), i_size_read(inode));

	if (!iov_iter_count(from))
		return 0;
+2 −2
Original line number Diff line number Diff line
@@ -237,7 +237,7 @@ int fscache_add_cache(struct fscache_cache *cache,
{
	int n_accesses;

	_enter("{%s,%s}", ops->name, cache->name);
	kenter("{%s,%s}", ops->name, cache->name);

	BUG_ON(fscache_cache_state(cache) != FSCACHE_CACHE_IS_PREPARING);

@@ -257,7 +257,7 @@ int fscache_add_cache(struct fscache_cache *cache,

	up_write(&fscache_addremove_sem);
	pr_notice("Cache \"%s\" added (type %s)\n", cache->name, ops->name);
	_leave(" = 0 [%s]", cache->name);
	kleave(" = 0 [%s]", cache->name);
	return 0;
}
EXPORT_SYMBOL(fscache_add_cache);
Loading