@@ -224,8 +224,7 @@ int nilfs_transaction_begin(struct super_block *sb,
224224int nilfs_transaction_commit (struct super_block * sb )
225225{
226226 struct nilfs_transaction_info * ti = current -> journal_info ;
227- struct nilfs_sb_info * sbi ;
228- struct nilfs_sc_info * sci ;
227+ struct the_nilfs * nilfs = NILFS_SB (sb )-> s_nilfs ;
229228 int err = 0 ;
230229
231230 BUG_ON (ti == NULL || ti -> ti_magic != NILFS_TI_MAGIC );
@@ -234,16 +233,15 @@ int nilfs_transaction_commit(struct super_block *sb)
234233 ti -> ti_count -- ;
235234 return 0 ;
236235 }
237- sbi = NILFS_SB ( sb );
238- sci = NILFS_SC ( sbi ) ;
239- if ( sci != NULL ) {
236+ if ( nilfs -> ns_writer ) {
237+ struct nilfs_sc_info * sci = nilfs -> ns_writer ;
238+
240239 if (ti -> ti_flags & NILFS_TI_COMMIT )
241240 nilfs_segctor_start_timer (sci );
242- if (atomic_read (& sbi -> s_nilfs -> ns_ndirtyblks ) >
243- sci -> sc_watermark )
241+ if (atomic_read (& nilfs -> ns_ndirtyblks ) > sci -> sc_watermark )
244242 nilfs_segctor_do_flush (sci , 0 );
245243 }
246- up_read (& sbi -> s_nilfs -> ns_segctor_sem );
244+ up_read (& nilfs -> ns_segctor_sem );
247245 current -> journal_info = ti -> ti_save ;
248246
249247 if (ti -> ti_flags & NILFS_TI_SYNC )
@@ -271,9 +269,8 @@ void nilfs_transaction_abort(struct super_block *sb)
271269
272270void nilfs_relax_pressure_in_lock (struct super_block * sb )
273271{
274- struct nilfs_sb_info * sbi = NILFS_SB (sb );
275- struct nilfs_sc_info * sci = NILFS_SC (sbi );
276- struct the_nilfs * nilfs = sbi -> s_nilfs ;
272+ struct the_nilfs * nilfs = NILFS_SB (sb )-> s_nilfs ;
273+ struct nilfs_sc_info * sci = nilfs -> ns_writer ;
277274
278275 if (!sci || !sci -> sc_flush_request )
279276 return ;
@@ -298,6 +295,8 @@ static void nilfs_transaction_lock(struct nilfs_sb_info *sbi,
298295 int gcflag )
299296{
300297 struct nilfs_transaction_info * cur_ti = current -> journal_info ;
298+ struct the_nilfs * nilfs = sbi -> s_nilfs ;
299+ struct nilfs_sc_info * sci = nilfs -> ns_writer ;
301300
302301 WARN_ON (cur_ti );
303302 ti -> ti_flags = NILFS_TI_WRITER ;
@@ -308,11 +307,11 @@ static void nilfs_transaction_lock(struct nilfs_sb_info *sbi,
308307 current -> journal_info = ti ;
309308
310309 for (;;) {
311- down_write (& sbi -> s_nilfs -> ns_segctor_sem );
312- if (!test_bit (NILFS_SC_PRIOR_FLUSH , & NILFS_SC ( sbi ) -> sc_flags ))
310+ down_write (& nilfs -> ns_segctor_sem );
311+ if (!test_bit (NILFS_SC_PRIOR_FLUSH , & sci -> sc_flags ))
313312 break ;
314313
315- nilfs_segctor_do_immediate_flush (NILFS_SC ( sbi ) );
314+ nilfs_segctor_do_immediate_flush (sci );
316315
317316 up_write (& sbi -> s_nilfs -> ns_segctor_sem );
318317 yield ();
@@ -2169,8 +2168,8 @@ static void nilfs_segctor_do_flush(struct nilfs_sc_info *sci, int bn)
21692168 */
21702169void nilfs_flush_segment (struct super_block * sb , ino_t ino )
21712170{
2172- struct nilfs_sb_info * sbi = NILFS_SB (sb );
2173- struct nilfs_sc_info * sci = NILFS_SC ( sbi ) ;
2171+ struct the_nilfs * nilfs = NILFS_SB (sb )-> s_nilfs ;
2172+ struct nilfs_sc_info * sci = nilfs -> ns_writer ;
21742173
21752174 if (!sci || nilfs_doing_construction ())
21762175 return ;
@@ -2259,8 +2258,8 @@ static void nilfs_segctor_wakeup(struct nilfs_sc_info *sci, int err)
22592258 */
22602259int nilfs_construct_segment (struct super_block * sb )
22612260{
2262- struct nilfs_sb_info * sbi = NILFS_SB (sb );
2263- struct nilfs_sc_info * sci = NILFS_SC ( sbi ) ;
2261+ struct the_nilfs * nilfs = NILFS_SB (sb )-> s_nilfs ;
2262+ struct nilfs_sc_info * sci = nilfs -> ns_writer ;
22642263 struct nilfs_transaction_info * ti ;
22652264 int err ;
22662265
@@ -2299,7 +2298,7 @@ int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode,
22992298{
23002299 struct nilfs_sb_info * sbi = NILFS_SB (sb );
23012300 struct the_nilfs * nilfs = sbi -> s_nilfs ;
2302- struct nilfs_sc_info * sci = NILFS_SC ( sbi ) ;
2301+ struct nilfs_sc_info * sci = nilfs -> ns_writer ;
23032302 struct nilfs_inode_info * ii ;
23042303 struct nilfs_transaction_info ti ;
23052304 int err = 0 ;
@@ -2445,8 +2444,8 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
24452444 void * * kbufs )
24462445{
24472446 struct nilfs_sb_info * sbi = NILFS_SB (sb );
2448- struct nilfs_sc_info * sci = NILFS_SC (sbi );
24492447 struct the_nilfs * nilfs = sbi -> s_nilfs ;
2448+ struct nilfs_sc_info * sci = nilfs -> ns_writer ;
24502449 struct nilfs_transaction_info ti ;
24512450 int err ;
24522451
@@ -2787,9 +2786,10 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)
27872786int nilfs_attach_segment_constructor (struct nilfs_sb_info * sbi ,
27882787 struct nilfs_root * root )
27892788{
2789+ struct the_nilfs * nilfs = sbi -> s_nilfs ;
27902790 int err ;
27912791
2792- if (NILFS_SC ( sbi ) ) {
2792+ if (nilfs -> ns_writer ) {
27932793 /*
27942794 * This happens if the filesystem was remounted
27952795 * read/write after nilfs_error degenerated it into a
@@ -2798,14 +2798,14 @@ int nilfs_attach_segment_constructor(struct nilfs_sb_info *sbi,
27982798 nilfs_detach_segment_constructor (sbi );
27992799 }
28002800
2801- sbi -> s_sc_info = nilfs_segctor_new (sbi , root );
2802- if (!sbi -> s_sc_info )
2801+ nilfs -> ns_writer = nilfs_segctor_new (sbi , root );
2802+ if (!nilfs -> ns_writer )
28032803 return - ENOMEM ;
28042804
2805- err = nilfs_segctor_start_thread (NILFS_SC ( sbi ) );
2805+ err = nilfs_segctor_start_thread (nilfs -> ns_writer );
28062806 if (err ) {
2807- kfree (sbi -> s_sc_info );
2808- sbi -> s_sc_info = NULL ;
2807+ kfree (nilfs -> ns_writer );
2808+ nilfs -> ns_writer = NULL ;
28092809 }
28102810 return err ;
28112811}
@@ -2823,9 +2823,9 @@ void nilfs_detach_segment_constructor(struct nilfs_sb_info *sbi)
28232823 LIST_HEAD (garbage_list );
28242824
28252825 down_write (& nilfs -> ns_segctor_sem );
2826- if (NILFS_SC ( sbi ) ) {
2827- nilfs_segctor_destroy (NILFS_SC ( sbi ) );
2828- sbi -> s_sc_info = NULL ;
2826+ if (nilfs -> ns_writer ) {
2827+ nilfs_segctor_destroy (nilfs -> ns_writer );
2828+ nilfs -> ns_writer = NULL ;
28292829 }
28302830
28312831 /* Force to free the list of dirty files */
0 commit comments