log.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. /*
  2. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  3. * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
  4. *
  5. * This copyrighted material is made available to anyone wishing to use,
  6. * modify, copy, or redistribute it subject to the terms and conditions
  7. * of the GNU General Public License v.2.
  8. */
  9. #include <linux/sched.h>
  10. #include <linux/slab.h>
  11. #include <linux/spinlock.h>
  12. #include <linux/completion.h>
  13. #include <linux/buffer_head.h>
  14. #include <linux/gfs2_ondisk.h>
  15. #include <linux/crc32.h>
  16. #include <asm/semaphore.h>
  17. #include "gfs2.h"
  18. #include "lm_interface.h"
  19. #include "incore.h"
  20. #include "bmap.h"
  21. #include "glock.h"
  22. #include "log.h"
  23. #include "lops.h"
  24. #include "meta_io.h"
  25. #include "util.h"
  26. #include "dir.h"
  27. #define PULL 1
  28. /**
  29. * gfs2_struct2blk - compute stuff
  30. * @sdp: the filesystem
  31. * @nstruct: the number of structures
  32. * @ssize: the size of the structures
  33. *
  34. * Compute the number of log descriptor blocks needed to hold a certain number
  35. * of structures of a certain size.
  36. *
  37. * Returns: the number of blocks needed (minimum is always 1)
  38. */
  39. unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
  40. unsigned int ssize)
  41. {
  42. unsigned int blks;
  43. unsigned int first, second;
  44. blks = 1;
  45. first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) /
  46. ssize;
  47. if (nstruct > first) {
  48. second = (sdp->sd_sb.sb_bsize -
  49. sizeof(struct gfs2_meta_header)) / ssize;
  50. blks += DIV_ROUND_UP(nstruct - first, second);
  51. }
  52. return blks;
  53. }
  54. void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags)
  55. {
  56. struct list_head *head = &sdp->sd_ail1_list;
  57. uint64_t sync_gen;
  58. struct list_head *first, *tmp;
  59. struct gfs2_ail *first_ai, *ai;
  60. gfs2_log_lock(sdp);
  61. if (list_empty(head)) {
  62. gfs2_log_unlock(sdp);
  63. return;
  64. }
  65. sync_gen = sdp->sd_ail_sync_gen++;
  66. first = head->prev;
  67. first_ai = list_entry(first, struct gfs2_ail, ai_list);
  68. first_ai->ai_sync_gen = sync_gen;
  69. gfs2_ail1_start_one(sdp, first_ai);
  70. if (flags & DIO_ALL)
  71. first = NULL;
  72. for (;;) {
  73. if (first && (head->prev != first ||
  74. gfs2_ail1_empty_one(sdp, first_ai, 0)))
  75. break;
  76. for (tmp = head->prev; tmp != head; tmp = tmp->prev) {
  77. ai = list_entry(tmp, struct gfs2_ail, ai_list);
  78. if (ai->ai_sync_gen >= sync_gen)
  79. continue;
  80. ai->ai_sync_gen = sync_gen;
  81. gfs2_ail1_start_one(sdp, ai);
  82. break;
  83. }
  84. if (tmp == head)
  85. break;
  86. }
  87. gfs2_log_unlock(sdp);
  88. }
  89. int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags)
  90. {
  91. struct gfs2_ail *ai, *s;
  92. int ret;
  93. gfs2_log_lock(sdp);
  94. list_for_each_entry_safe_reverse(ai, s, &sdp->sd_ail1_list, ai_list) {
  95. if (gfs2_ail1_empty_one(sdp, ai, flags))
  96. list_move(&ai->ai_list, &sdp->sd_ail2_list);
  97. else if (!(flags & DIO_ALL))
  98. break;
  99. }
  100. ret = list_empty(&sdp->sd_ail1_list);
  101. gfs2_log_unlock(sdp);
  102. return ret;
  103. }
  104. static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail)
  105. {
  106. struct gfs2_ail *ai, *safe;
  107. unsigned int old_tail = sdp->sd_log_tail;
  108. int wrap = (new_tail < old_tail);
  109. int a, b, rm;
  110. gfs2_log_lock(sdp);
  111. list_for_each_entry_safe(ai, safe, &sdp->sd_ail2_list, ai_list) {
  112. a = (old_tail <= ai->ai_first);
  113. b = (ai->ai_first < new_tail);
  114. rm = (wrap) ? (a || b) : (a && b);
  115. if (!rm)
  116. continue;
  117. gfs2_ail2_empty_one(sdp, ai);
  118. list_del(&ai->ai_list);
  119. gfs2_assert_warn(sdp, list_empty(&ai->ai_ail1_list));
  120. gfs2_assert_warn(sdp, list_empty(&ai->ai_ail2_list));
  121. kfree(ai);
  122. }
  123. gfs2_log_unlock(sdp);
  124. }
  125. /**
  126. * gfs2_log_reserve - Make a log reservation
  127. * @sdp: The GFS2 superblock
  128. * @blks: The number of blocks to reserve
  129. *
  130. * Returns: errno
  131. */
  132. int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks)
  133. {
  134. unsigned int try = 0;
  135. if (gfs2_assert_warn(sdp, blks) ||
  136. gfs2_assert_warn(sdp, blks <= sdp->sd_jdesc->jd_blocks))
  137. return -EINVAL;
  138. mutex_lock(&sdp->sd_log_reserve_mutex);
  139. gfs2_log_lock(sdp);
  140. while(sdp->sd_log_blks_free <= blks) {
  141. gfs2_log_unlock(sdp);
  142. gfs2_ail1_empty(sdp, 0);
  143. gfs2_log_flush(sdp, NULL);
  144. if (try++)
  145. gfs2_ail1_start(sdp, 0);
  146. gfs2_log_lock(sdp);
  147. }
  148. sdp->sd_log_blks_free -= blks;
  149. /* printk(KERN_INFO "reserved %u blocks (%u left)\n", blks, sdp->sd_log_blks_free); */
  150. gfs2_log_unlock(sdp);
  151. mutex_unlock(&sdp->sd_log_reserve_mutex);
  152. down_read(&sdp->sd_log_flush_lock);
  153. return 0;
  154. }
  155. /**
  156. * gfs2_log_release - Release a given number of log blocks
  157. * @sdp: The GFS2 superblock
  158. * @blks: The number of blocks
  159. *
  160. */
  161. void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
  162. {
  163. gfs2_log_lock(sdp);
  164. sdp->sd_log_blks_free += blks;
  165. /* printk(KERN_INFO "released %u blocks (%u left)\n", blks, sdp->sd_log_blks_free); */
  166. gfs2_assert_withdraw(sdp,
  167. sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
  168. gfs2_log_unlock(sdp);
  169. up_read(&sdp->sd_log_flush_lock);
  170. }
  171. static uint64_t log_bmap(struct gfs2_sbd *sdp, unsigned int lbn)
  172. {
  173. int new = 0;
  174. uint64_t dbn;
  175. int error;
  176. int bdy;
  177. error = gfs2_block_map(sdp->sd_jdesc->jd_inode, lbn, &new, &dbn, &bdy);
  178. gfs2_assert_withdraw(sdp, !error && dbn);
  179. return dbn;
  180. }
  181. /**
  182. * log_distance - Compute distance between two journal blocks
  183. * @sdp: The GFS2 superblock
  184. * @newer: The most recent journal block of the pair
  185. * @older: The older journal block of the pair
  186. *
  187. * Compute the distance (in the journal direction) between two
  188. * blocks in the journal
  189. *
  190. * Returns: the distance in blocks
  191. */
  192. static inline unsigned int log_distance(struct gfs2_sbd *sdp,
  193. unsigned int newer,
  194. unsigned int older)
  195. {
  196. int dist;
  197. dist = newer - older;
  198. if (dist < 0)
  199. dist += sdp->sd_jdesc->jd_blocks;
  200. return dist;
  201. }
  202. static unsigned int current_tail(struct gfs2_sbd *sdp)
  203. {
  204. struct gfs2_ail *ai;
  205. unsigned int tail;
  206. gfs2_log_lock(sdp);
  207. if (list_empty(&sdp->sd_ail1_list))
  208. tail = sdp->sd_log_head;
  209. else {
  210. ai = list_entry(sdp->sd_ail1_list.prev,
  211. struct gfs2_ail, ai_list);
  212. tail = ai->ai_first;
  213. }
  214. gfs2_log_unlock(sdp);
  215. return tail;
  216. }
  217. static inline void log_incr_head(struct gfs2_sbd *sdp)
  218. {
  219. if (sdp->sd_log_flush_head == sdp->sd_log_tail)
  220. gfs2_assert_withdraw(sdp,
  221. sdp->sd_log_flush_head == sdp->sd_log_head);
  222. if (++sdp->sd_log_flush_head == sdp->sd_jdesc->jd_blocks) {
  223. sdp->sd_log_flush_head = 0;
  224. sdp->sd_log_flush_wrapped = 1;
  225. }
  226. }
  227. /**
  228. * gfs2_log_get_buf - Get and initialize a buffer to use for log control data
  229. * @sdp: The GFS2 superblock
  230. *
  231. * Returns: the buffer_head
  232. */
  233. struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp)
  234. {
  235. uint64_t blkno = log_bmap(sdp, sdp->sd_log_flush_head);
  236. struct gfs2_log_buf *lb;
  237. struct buffer_head *bh;
  238. lb = kzalloc(sizeof(struct gfs2_log_buf), GFP_NOFS | __GFP_NOFAIL);
  239. list_add(&lb->lb_list, &sdp->sd_log_flush_list);
  240. bh = lb->lb_bh = sb_getblk(sdp->sd_vfs, blkno);
  241. lock_buffer(bh);
  242. memset(bh->b_data, 0, bh->b_size);
  243. set_buffer_uptodate(bh);
  244. clear_buffer_dirty(bh);
  245. unlock_buffer(bh);
  246. log_incr_head(sdp);
  247. return bh;
  248. }
  249. /**
  250. * gfs2_log_fake_buf - Build a fake buffer head to write metadata buffer to log
  251. * @sdp: the filesystem
  252. * @data: the data the buffer_head should point to
  253. *
  254. * Returns: the log buffer descriptor
  255. */
  256. struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp,
  257. struct buffer_head *real)
  258. {
  259. uint64_t blkno = log_bmap(sdp, sdp->sd_log_flush_head);
  260. struct gfs2_log_buf *lb;
  261. struct buffer_head *bh;
  262. lb = kzalloc(sizeof(struct gfs2_log_buf), GFP_NOFS | __GFP_NOFAIL);
  263. list_add(&lb->lb_list, &sdp->sd_log_flush_list);
  264. lb->lb_real = real;
  265. bh = lb->lb_bh = alloc_buffer_head(GFP_NOFS | __GFP_NOFAIL);
  266. atomic_set(&bh->b_count, 1);
  267. bh->b_state = (1 << BH_Mapped) | (1 << BH_Uptodate);
  268. set_bh_page(bh, real->b_page, bh_offset(real));
  269. bh->b_blocknr = blkno;
  270. bh->b_size = sdp->sd_sb.sb_bsize;
  271. bh->b_bdev = sdp->sd_vfs->s_bdev;
  272. log_incr_head(sdp);
  273. return bh;
  274. }
  275. static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail, int pull)
  276. {
  277. unsigned int dist = log_distance(sdp, new_tail, sdp->sd_log_tail);
  278. ail2_empty(sdp, new_tail);
  279. gfs2_log_lock(sdp);
  280. sdp->sd_log_blks_free += dist - ((pull) ? 1 : 0);
  281. /* printk(KERN_INFO "pull tail refunding %u blocks (%u left) pull=%d\n", dist - ((pull) ? 1 : 0), sdp->sd_log_blks_free, pull); */
  282. gfs2_assert_withdraw(sdp,
  283. sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks);
  284. gfs2_log_unlock(sdp);
  285. sdp->sd_log_tail = new_tail;
  286. }
  287. /**
  288. * log_write_header - Get and initialize a journal header buffer
  289. * @sdp: The GFS2 superblock
  290. *
  291. * Returns: the initialized log buffer descriptor
  292. */
  293. static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull)
  294. {
  295. uint64_t blkno = log_bmap(sdp, sdp->sd_log_flush_head);
  296. struct buffer_head *bh;
  297. struct gfs2_log_header *lh;
  298. unsigned int tail;
  299. uint32_t hash;
  300. /* printk(KERN_INFO "log write header start (flags=%08x, pull=%d)\n", flags, pull); */
  301. bh = sb_getblk(sdp->sd_vfs, blkno);
  302. lock_buffer(bh);
  303. memset(bh->b_data, 0, bh->b_size);
  304. set_buffer_uptodate(bh);
  305. clear_buffer_dirty(bh);
  306. unlock_buffer(bh);
  307. gfs2_ail1_empty(sdp, 0);
  308. tail = current_tail(sdp);
  309. lh = (struct gfs2_log_header *)bh->b_data;
  310. memset(lh, 0, sizeof(struct gfs2_log_header));
  311. lh->lh_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
  312. lh->lh_header.mh_type = cpu_to_be32(GFS2_METATYPE_LH);
  313. lh->lh_header.mh_format = cpu_to_be32(GFS2_FORMAT_LH);
  314. lh->lh_sequence = be64_to_cpu(sdp->sd_log_sequence++);
  315. lh->lh_flags = be32_to_cpu(flags);
  316. lh->lh_tail = be32_to_cpu(tail);
  317. lh->lh_blkno = be32_to_cpu(sdp->sd_log_flush_head);
  318. hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
  319. lh->lh_hash = cpu_to_be32(hash);
  320. set_buffer_dirty(bh);
  321. if (sync_dirty_buffer(bh))
  322. gfs2_io_error_bh(sdp, bh);
  323. brelse(bh);
  324. if (sdp->sd_log_tail != tail)
  325. log_pull_tail(sdp, tail, pull);
  326. else
  327. gfs2_assert_withdraw(sdp, !pull);
  328. sdp->sd_log_idle = (tail == sdp->sd_log_flush_head);
  329. log_incr_head(sdp);
  330. /* printk(KERN_INFO "log write header out\n"); */
  331. }
  332. static void log_flush_commit(struct gfs2_sbd *sdp)
  333. {
  334. struct list_head *head = &sdp->sd_log_flush_list;
  335. struct gfs2_log_buf *lb;
  336. struct buffer_head *bh;
  337. #if 0
  338. unsigned int d;
  339. d = log_distance(sdp, sdp->sd_log_flush_head, sdp->sd_log_head);
  340. gfs2_assert_withdraw(sdp, d + 1 == sdp->sd_log_blks_reserved);
  341. #endif
  342. while (!list_empty(head)) {
  343. lb = list_entry(head->next, struct gfs2_log_buf, lb_list);
  344. list_del(&lb->lb_list);
  345. bh = lb->lb_bh;
  346. wait_on_buffer(bh);
  347. if (!buffer_uptodate(bh))
  348. gfs2_io_error_bh(sdp, bh);
  349. if (lb->lb_real) {
  350. while (atomic_read(&bh->b_count) != 1) /* Grrrr... */
  351. schedule();
  352. free_buffer_head(bh);
  353. } else
  354. brelse(bh);
  355. kfree(lb);
  356. }
  357. log_write_header(sdp, 0, 0);
  358. }
  359. /**
  360. * gfs2_log_flush - flush incore transaction(s)
  361. * @sdp: the filesystem
  362. * @gl: The glock structure to flush. If NULL, flush the whole incore log
  363. *
  364. */
  365. void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
  366. {
  367. struct gfs2_ail *ai;
  368. down_write(&sdp->sd_log_flush_lock);
  369. if (gl) {
  370. gfs2_log_lock(sdp);
  371. if (list_empty(&gl->gl_le.le_list)) {
  372. gfs2_log_unlock(sdp);
  373. up_write(&sdp->sd_log_flush_lock);
  374. return;
  375. }
  376. gfs2_log_unlock(sdp);
  377. }
  378. ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
  379. INIT_LIST_HEAD(&ai->ai_ail1_list);
  380. INIT_LIST_HEAD(&ai->ai_ail2_list);
  381. gfs2_assert_withdraw(sdp,
  382. sdp->sd_log_num_buf == sdp->sd_log_commited_buf);
  383. gfs2_assert_withdraw(sdp,
  384. sdp->sd_log_num_revoke == sdp->sd_log_commited_revoke);
  385. sdp->sd_log_flush_head = sdp->sd_log_head;
  386. sdp->sd_log_flush_wrapped = 0;
  387. ai->ai_first = sdp->sd_log_flush_head;
  388. lops_before_commit(sdp);
  389. if (!list_empty(&sdp->sd_log_flush_list))
  390. log_flush_commit(sdp);
  391. else if (sdp->sd_log_tail != current_tail(sdp) && !sdp->sd_log_idle)
  392. log_write_header(sdp, 0, PULL);
  393. lops_after_commit(sdp, ai);
  394. sdp->sd_log_head = sdp->sd_log_flush_head;
  395. /* printk(KERN_INFO "sd_log_num_hdrs %u\n", sdp->sd_log_num_hdrs); */
  396. sdp->sd_log_blks_free -= sdp->sd_log_num_hdrs;
  397. sdp->sd_log_blks_reserved =
  398. sdp->sd_log_commited_buf =
  399. sdp->sd_log_num_hdrs =
  400. sdp->sd_log_commited_revoke = 0;
  401. gfs2_log_lock(sdp);
  402. if (!list_empty(&ai->ai_ail1_list)) {
  403. list_add(&ai->ai_list, &sdp->sd_ail1_list);
  404. ai = NULL;
  405. }
  406. gfs2_log_unlock(sdp);
  407. sdp->sd_vfs->s_dirt = 0;
  408. up_write(&sdp->sd_log_flush_lock);
  409. kfree(ai);
  410. }
  411. static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
  412. {
  413. unsigned int reserved = 1;
  414. unsigned int old;
  415. gfs2_log_lock(sdp);
  416. sdp->sd_log_commited_buf += tr->tr_num_buf_new - tr->tr_num_buf_rm;
  417. gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_buf) >= 0);
  418. sdp->sd_log_commited_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm;
  419. gfs2_assert_withdraw(sdp, ((int)sdp->sd_log_commited_revoke) >= 0);
  420. if (sdp->sd_log_commited_buf)
  421. reserved += sdp->sd_log_commited_buf;
  422. if (sdp->sd_log_commited_revoke)
  423. reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke,
  424. sizeof(uint64_t));
  425. old = sdp->sd_log_blks_free;
  426. sdp->sd_log_blks_free += tr->tr_reserved -
  427. (reserved - sdp->sd_log_blks_reserved);
  428. gfs2_assert_withdraw(sdp, sdp->sd_log_blks_free >= old);
  429. gfs2_assert_withdraw(sdp,
  430. sdp->sd_log_blks_free <= sdp->sd_jdesc->jd_blocks +
  431. sdp->sd_log_num_hdrs);
  432. sdp->sd_log_blks_reserved = reserved;
  433. gfs2_log_unlock(sdp);
  434. }
  435. /**
  436. * gfs2_log_commit - Commit a transaction to the log
  437. * @sdp: the filesystem
  438. * @tr: the transaction
  439. *
  440. * Returns: errno
  441. */
  442. void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
  443. {
  444. log_refund(sdp, tr);
  445. lops_incore_commit(sdp, tr);
  446. sdp->sd_vfs->s_dirt = 1;
  447. up_read(&sdp->sd_log_flush_lock);
  448. gfs2_log_lock(sdp);
  449. if (sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks)) {
  450. gfs2_log_unlock(sdp);
  451. gfs2_log_flush(sdp, NULL);
  452. } else
  453. gfs2_log_unlock(sdp);
  454. }
  455. /**
  456. * gfs2_log_shutdown - write a shutdown header into a journal
  457. * @sdp: the filesystem
  458. *
  459. */
  460. void gfs2_log_shutdown(struct gfs2_sbd *sdp)
  461. {
  462. down_write(&sdp->sd_log_flush_lock);
  463. gfs2_assert_withdraw(sdp, !sdp->sd_log_blks_reserved);
  464. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_gl);
  465. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_buf);
  466. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_jdata);
  467. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke);
  468. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_rg);
  469. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_databuf);
  470. gfs2_assert_withdraw(sdp, !sdp->sd_log_num_hdrs);
  471. gfs2_assert_withdraw(sdp, list_empty(&sdp->sd_ail1_list));
  472. sdp->sd_log_flush_head = sdp->sd_log_head;
  473. sdp->sd_log_flush_wrapped = 0;
  474. log_write_header(sdp, GFS2_LOG_HEAD_UNMOUNT, 0);
  475. /* printk(KERN_INFO "sd_log_blks_free %u, sd_jdesc->jd_blocks %u\n", sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks); */
  476. gfs2_assert_warn(sdp, sdp->sd_log_blks_free == sdp->sd_jdesc->jd_blocks);
  477. gfs2_assert_warn(sdp, sdp->sd_log_head == sdp->sd_log_tail);
  478. gfs2_assert_warn(sdp, list_empty(&sdp->sd_ail2_list));
  479. sdp->sd_log_head = sdp->sd_log_flush_head;
  480. sdp->sd_log_tail = sdp->sd_log_head;
  481. up_write(&sdp->sd_log_flush_lock);
  482. }