Changeset ab834d65 in rtems


Ignore:
Timestamp:
Dec 20, 2016, 7:23:49 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
71f29c12
Parents:
ade135d4
git-author:
Sebastian Huber <sebastian.huber@…> (12/20/16 07:23:49)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/20/16 07:28:23)
Message:

JFFS2: RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION

Update #2844.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/jffs2/include/rtems/jffs2.h

    rade135d4 rab834d65  
    231231
    232232/**
     233 * @brief Trigger garbage collection operation.
     234 *
     235 * An optional garbage collection thread may perform now a garbage collection
     236 * using the RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION IO control.
     237 *
     238 * The garbage collection must not run in the executing context.
     239 *
     240 * @param[in] self The flash control.
     241 */
     242typedef void (*rtems_jffs2_trigger_garbage_collection)(
     243  rtems_jffs2_flash_control *self
     244);
     245
     246/**
    233247 * @brief JFFS2 flash device control.
    234248 */
     
    276290   */
    277291  dev_t device_identifier;
     292
     293  /**
     294   * @brief Trigger garbage collection operation.
     295   *
     296   * This operation is optional and may be NULL.  This operation should wake up
     297   * a garbage collection thread.  The garbage collection thread should use the
     298   * RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION IO control to carry out the work.
     299   */
     300  rtems_jffs2_trigger_garbage_collection trigger_garbage_collection;
    278301};
    279302
     
    557580
    558581/**
     582 * @brief IO control to perform an on demand garbage collection in a JFFS2
     583 * filesystem instance.
     584 *
     585 * This operation is intended to be used by an optional garbage collection
     586 * thread.  See rtems_jffs2_flash_control::trigger_garbage_collection.
     587 */
     588#define RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION _IO('F', 2)
     589
     590/**
    559591 * @brief IO control to force a garbage collection in a JFFS2 filesystem
    560592 * instance.
  • cpukit/libfs/src/jffs2/src/fs-rtems.c

    rade135d4 rab834d65  
    553553}
    554554
     555static int rtems_jffs2_on_demand_garbage_collection(struct jffs2_sb_info *c)
     556{
     557        if (jffs2_thread_should_wake(c)) {
     558                return -jffs2_garbage_collect_pass(c);
     559        } else {
     560                return 0;
     561        }
     562}
     563
    555564static int rtems_jffs2_ioctl(
    556565        rtems_libio_t   *iop,
     
    568577                        rtems_jffs2_get_info(&inode->i_sb->jffs2_sb, buffer);
    569578                        eno = 0;
     579                        break;
     580                case RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION:
     581                        eno = rtems_jffs2_on_demand_garbage_collection(&inode->i_sb->jffs2_sb);
    570582                        break;
    571583                case RTEMS_JFFS2_FORCE_GARBAGE_COLLECTION:
  • cpukit/libfs/src/jffs2/src/os-rtems.h

    rade135d4 rab834d65  
    121121static inline void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c)
    122122{
    123        /* We don't have a GC thread in RTEMS (yet) */
     123        const struct super_block *sb = OFNI_BS_2SFFJ(c);
     124        rtems_jffs2_flash_control *fc = sb->s_flash_control;
     125
     126        if (fc->trigger_garbage_collection != NULL) {
     127                (*fc->trigger_garbage_collection)(fc);
     128        }
    124129}
    125130
  • testsuites/fstests/fsjffs2gc01/init.c

    rade135d4 rab834d65  
    280280  ASSERT_INFO(&info, &info_some_files_removed);
    281281
    282   rv = ioctl(fd, RTEMS_JFFS2_FORCE_GARBAGE_COLLECTION);
     282  rv = ioctl(fd, RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION);
     283  rtems_test_assert(rv == 0);
     284  ASSERT_INFO(&info, &info_after_first_gc);
     285
     286  rv = ioctl(fd, RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION);
    283287  rtems_test_assert(rv == 0);
    284288  ASSERT_INFO(&info, &info_after_first_gc);
Note: See TracChangeset for help on using the changeset viewer.