Whamcloud - gitweb
LU-7659 mdc: expose changelog through char devices 00/18900/15
authorHenri Doreau <henri.doreau@cea.fr>
Wed, 13 Jan 2016 14:53:00 +0000 (15:53 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 6 Apr 2017 13:46:25 +0000 (13:46 +0000)
commit1d40214d96dd6e36bd39a35f8419f753bae8d305
tree12b85045bfde0d96c8cf9157b36220692eee70b4
parent21fc71fc9f2002207ad6178beb66fc020c386a57
LU-7659 mdc: expose changelog through char devices

Register one character device per MDT in order to allow non-llapi to
read them and to make delivery more efficient.

- open() spawns a thread to prefetch records and enqueue them into a
  local buffer (unless the device is open in write-only mode).
- lseek() can be used to jump to a specific record, in which case the
  offset is a record number (with SEEK_SET) or a number of records to
  skip (SEEK_CUR). Movement can only be done forward.
- read() copies records to userland. No truncation happens, so short
  reads are likely.
- write() is used to transmit control commands to the device.
  The only available one is changelog_clear, which is done by writing
  "clear:cl<user>:<recno>" into the device.
- close() terminates the prefetch thread if any, and releases resources.

It is possible to poll() on the device to get notified when new records
are available for read.

Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Change-Id: I14709fdbac76b5512e58099e4e536cf9c973868c
Reviewed-on: https://review.whamcloud.com/18900
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
15 files changed:
lustre/include/lustre/lustre_user.h
lustre/include/lustre/lustreapi.h
lustre/include/lustre_ioctl.h
lustre/include/obd.h
lustre/include/uapi_kernelcomm.h
lustre/ldlm/ldlm_lib.c
lustre/llite/dir.c
lustre/lmv/lmv_obd.c
lustre/mdc/Makefile.in
lustre/mdc/mdc_changelog.c [new file with mode: 0644]
lustre/mdc/mdc_internal.h
lustre/mdc/mdc_request.c
lustre/utils/Makefile.am
lustre/utils/liblustreapi.c
lustre/utils/liblustreapi_chlg.c [new file with mode: 0644]