From 9d2776f02b67354b58e9ff93bd7fe5b5495ee288 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Mon, 26 Oct 2020 13:30:22 +1100 Subject: [PATCH] LU-14073 ofd: remove use of smp_read_barrier_depends() Linux 5.9 removes smp_read_barrier_depends(), so lustre must stop using it. There is only one use: in ofd_access_log.c. This use is unnecessary and can simply be removed. The code is based on "Documentation/core-api/circular-buffers.rst" which gives no indication that this barrier is needed. The comment say its purpose is to ensure the index is read before the data is read. This is unnecessary. The data is written in osl_write_entry(), then a barrier is issued (smp_store_release) before the ->head is written. oal_read_entry() issues a barrier (smp_load_acquire()) before reading that head. 'tail' is read without a barrer, but it then compared against ->head in CIRC_CNT(). Even if reading ->tail was racey, the fact that comparing it wilth ->head succeeded means that the data written at ->tail must have been safely written, and we can now read it without any further barrier. Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: I9d0f0aeb67e1188d2012f4ae2e14b3656211c3e2 Reviewed-on: https://review.whamcloud.com/40394 Tested-by: jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/ofd/ofd_access_log.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lustre/ofd/ofd_access_log.c b/lustre/ofd/ofd_access_log.c index d7e96f5..706cdbf 100644 --- a/lustre/ofd/ofd_access_log.c +++ b/lustre/ofd/ofd_access_log.c @@ -190,9 +190,6 @@ static ssize_t oal_read_entry(struct oal_circ_buf *ocb, BUG_ON(CIRC_CNT(head, tail, oal->oal_log_size) < oal->oal_entry_size); - /* Read index before reading contents at that index. */ - smp_read_barrier_depends(); - /* Extract one entry from the buffer. */ rc = min_t(size_t, oal->oal_entry_size, entry_buf_size); memcpy(entry_buf, &circ->buf[tail], rc); -- 1.8.3.1