]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
FileJournal: clarify locking in header
authorSamuel Just <samuel.just@dreamhost.com>
Tue, 17 Apr 2012 19:56:58 +0000 (12:56 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Tue, 17 Apr 2012 19:56:58 +0000 (12:56 -0700)
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/os/FileJournal.h

index 5e2f788bc9ce5da01fe79cfb212ec2911c14dff5..284f429b702bf33c8a26a6d104a46be285125cf1 100644 (file)
@@ -29,8 +29,14 @@ using std::deque;
 # include <libaio.h>
 #endif
 
+/**
+ * Implements journaling on top of block device or file.
+ *
+ * Lock ordering is write_lock > aio_lock > queue_lock > flush_lock
+ */
 class FileJournal : public Journal {
 public:
+  /// Protected by queue_lock
   struct completion_item {
     uint64_t seq;
     Context *finish;
@@ -65,6 +71,7 @@ public:
   void submit_entry(uint64_t seq, bufferlist& bl, int alignment,
                    Context *oncommit,
                    TrackedOpRef osd_op = TrackedOpRef());
+  /// End protected by queue_lock
 
   /*
    * journal header
@@ -157,9 +164,11 @@ public:
 private:
   string fn;
 
+  /// Protected by flush_lock
   Mutex flush_lock;
   Cond write_empty_cond;
   bool writing;
+  /// End protected by flush_lock
 
   char *zero_buf;
 
@@ -173,6 +182,7 @@ private:
 
 #ifdef HAVE_LIBAIO
   /// state associated with an in-flight aio request
+  /// Protected by aio_lock
   struct aio_info {
     struct iocb iocb;
     bufferlist bl;
@@ -195,6 +205,7 @@ private:
   io_context_t aio_ctx;
   list<aio_info> aio_queue;
   int aio_num, aio_bytes;
+  /// End protected by aio_lock
 #endif
 
   uint64_t last_committed_seq;