Re: [PATCH v6] Move BTRFS RCU string to common library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2014-11-08 at 00:46 -0800, Omar Sandoval wrote:
> The RCU-friendly string API used internally by BTRFS is generic enough for
> common use. This doesn't add any new functionality, but instead just moves the
> code and documents the existing API.

Some more trivia, can be updated later if desired.

> diff --git a/include/linux/rcustring.h b/include/linux/rcustring.h
> new file mode 100644
[]
> +
> +/**
> + * printk_in_rcu() - printk in an RCU read-side critical section

It'd be nice to show the arguments for kernel-doc here

> + */
> +#define printk_in_rcu(fmt, ...)			\
> +	do {					\
> +		rcu_read_lock();		\
> +		printk(fmt, __VA_ARGS__);	\

This should use ##__VA_ARGS__ to allow the
compiler to elide the comma when using

	printk_in_rcu("Hello World!");

> +		rcu_read_unlock();		\
> +	} while (0)
> +
> +/**
> + * printk_ratelimited_in_rcu() - printk_ratelimited in an RCU read-side critical
> + * section
> + */
> +#define printk_ratelimited_in_rcu(fmt, ...)		\
> +	do {						\
> +		rcu_read_lock();			\
> +		printk_ratelimited(fmt, __VA_ARGS__);	\
> +		rcu_read_unlock();			\
> +	} while (0)
> +
> +#endif

Here too

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux